gfs2-utils: RHEL7 - fsck.gfs2: Change basic dentry checks for too long of file names

Andrew Price andyp at fedoraproject.org
Tue Apr 7 21:23:18 UTC 2015


Gitweb:        http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=4e0f9f4761f6cc41a0ad74b0b30d9264fe6c0ce0
Commit:        4e0f9f4761f6cc41a0ad74b0b30d9264fe6c0ce0
Parent:        a1c46f990cff3c45164272fc0e720440b47a716c
Author:        Bob Peterson <rpeterso at redhat.com>
AuthorDate:    Tue Nov 11 14:40:39 2014 -0600
Committer:     Andrew Price <anprice at redhat.com>
CommitterDate: Wed Apr 1 16:51:35 2015 +0100

fsck.gfs2: Change basic dentry checks for too long of file names

This patch adds a check to the basic dentry check such that it will reject
any dirents that have a file name more than the maximum allowed.
---
 gfs2/fsck/pass2.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/gfs2/fsck/pass2.c b/gfs2/fsck/pass2.c
index 3c10fef..631dc56 100644
--- a/gfs2/fsck/pass2.c
+++ b/gfs2/fsck/pass2.c
@@ -468,7 +468,8 @@ static int basic_dentry_checks(struct gfs2_inode *ip, struct gfs2_dirent *dent,
 		}
 	}
 
-	if (de->de_rec_len < GFS2_DIRENT_SIZE(de->de_name_len)) {
+	if (de->de_rec_len < GFS2_DIRENT_SIZE(de->de_name_len) ||
+	    de->de_name_len > GFS2_FNAMESIZE) {
 		log_err( _("Dir entry with bad record or name length\n"
 			"\tRecord length = %u\n\tName length = %u\n"),
 			de->de_rec_len, de->de_name_len);
@@ -476,9 +477,12 @@ static int basic_dentry_checks(struct gfs2_inode *ip, struct gfs2_dirent *dent,
 			log_err( _("Directory entry not fixed.\n"));
 			return 0;
 		}
+		/* Don't be tempted to do this:
 		fsck_blockmap_set(ip, ip->i_di.di_num.no_addr,
 				  _("corrupt directory entry"),
 				  gfs2_inode_invalid);
+		We can't free it because another dir may have a valid reference
+		to it. Just return 1 so we can delete the bad dirent. */
 		log_err( _("Bad directory entry deleted.\n"));
 		return 1;
 	}


More information about the cluster-commits mailing list