[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87po71wjk6.fsf@mail.parknet.co.jp>
Date: Wed, 27 Dec 2017 01:16:57 +0900
From: OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>
To: ChenGuanqiao <chen.chenchacha@...mail.com>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 2/2] fs: fat: add ioctl method in fat filesystem driver
ChenGuanqiao <chen.chenchacha@...mail.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@...l.parknet.co.jp>
Powered by blists - more mailing lists