cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [Cluster-devel] [fsck.gfs2 patch] fsck.gfs2: Change basic dentry checks for too long of file names
       [not found] <1271926811.6839573.1420830748659.JavaMail.zimbra@redhat.com>
@ 2015-01-09 19:14 ` Bob Peterson
  0 siblings, 0 replies; only message in thread
From: Bob Peterson @ 2015-01-09 19:14 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Hi,

This is the first in a series of patches to fsck.gfs2. I've uncovered some
problems during recent testing, and these patches fix them.

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.

Regards,

Bob Peterson
Red Hat File Systems

Signed-off-by: Bob Peterson <rpeterso@redhat.com> 
---
diff --git a/gfs2/fsck/pass2.c b/gfs2/fsck/pass2.c
index 1559d8e..bdcf77c 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;
 	}



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-01-09 19:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1271926811.6839573.1420830748659.JavaMail.zimbra@redhat.com>
2015-01-09 19:14 ` [Cluster-devel] [fsck.gfs2 patch] fsck.gfs2: Change basic dentry checks for too long of file names Bob Peterson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).