2012/12/6, OGAWA Hirofumi <hirofumi@xxxxxxxxxxxxxxxxxx>: > Namjae Jeon <linkinjeon@xxxxxxxxx> writes: > >>> I know encode_fh(). But NFS is network protocol, and network can input >>> any data, and I guess the userland interface (open_by_handle()?) can be >>> any too. >>> >>> And generic_fh_to_dentry()'s input verify choose to check the minimum >>> length only. But your logic choose the exact length. >>> >>> I think the both is sane and correct. But I wonder why did you changed >>> it. >> There was no particular reason for us to put those conditions. It is >> just we knew what fh lengths we have chosen for the 2 cases >> WITH/WITHOUT parent. >> i.e., we checked with encoded length. >> Now, when I check the export functions of other filesystems(btrfs, >> nilfs2, udf). They also adopt the same method of checking the exact >> length and type. >> If there is any particular reason, we will look into that and can also >> updated on that. > > OK. Then, just cleanup code, and let's use strict checking version. > > Removing strange fallthrou, something like the following. > > static struct dentry *fat_fh_to_dentry_nostale(struct super_block *sb, > struct fid *fh, int fh_len, > int fh_type) > { > struct inode *inode = NULL; > struct fat_fid *fid = (struct fat_fid *)fh; > loff_t i_pos; > > switch (fh_type) { > case FILEID_FAT_WITHOUT_PARENT: > if (fh_len < FAT_FID_SIZE_WITHOUT_PARENT) > return NULL; > break; > case FILEID_FAT_WITH_PARENT: > if (fh_len < FAT_FID_SIZE_WITH_PARENT) > return NULL; > break; > default: > return NULL; > } > > i_pos = fid->i_pos_hi; > i_pos = (i_pos << 32) | (fid->i_pos_low); > inode = __fat_nfs_get_inode(sb, 0, fid->i_gen, i_pos); > > return d_obtain_alias(inode); > } Okay. I will change like this on next patch-set. Thanks OGAWA! > > > -- > OGAWA Hirofumi <hirofumi@xxxxxxxxxxxxxxxxxx> > -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html