lkml.org 
[lkml]   [2017]   [Dec]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v4 2/2] fs: fat: add ioctl method in fat filesystem driver
Date
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>

\
 
 \ /
  Last update: 2017-12-26 17:17    [W:0.036 / U:1.448 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site