Messages in this thread | | | From | OGAWA Hirofumi <> | Subject | Re: [PATCH v4 2/2] fs: fat: add ioctl method in fat filesystem driver | Date | Wed, 27 Dec 2017 01:16:57 +0900 |
| |
ChenGuanqiao <chen.chenchacha@foxmail.com> writes:
> +static int fat_check_volume_label(const char *label) > +{ > + int i; > + > + for (i=0; i<11; ++i) { > + if (islower(label[i])) > + return -EINVAL; > + } > + return 0; > +}
What happen if '\0' is included, or invalid chars as FAT filename?
> +static int fat_ioctl_get_volume_label(struct inode *inode, > + u8 __user *vol_label) > +{ > + int err = 0; > + struct buffer_head *bh; > + struct msdos_dir_entry *de; > + struct super_block *sb = inode->i_sb; > + struct msdos_sb_info *sbi = MSDOS_SB(sb); > + > + if (sbi->fat_bits == 32) > + bh = sb_bread(sb, sbi->data_start); > + else > + bh = sb_bread(sb, sbi->dir_start); > + > + if (bh == NULL) { > + fat_msg(sb, KERN_ERR, "unable to read root directory"); > + err = -EIO; > + goto out; > + } > + > + de = (struct msdos_dir_entry *)bh->b_data;
The volume label is not fixed place in root dir. You have to find ATTR_VOLUME, but not ATTR_EXT.
Thanks. -- OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
| |