fsck.gfs2: Change basic dentry checks for too long of file names
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 fsck.gfs2: Change basic dentry checks for too long of file names
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 <[email protected]>
---
gfs2/fsck/pass2.c +5 -1
@@ -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 ; }