Skip to content

Commit

Permalink
fs/ntfs3: Do not allow to change label if volume is read-only
Browse files Browse the repository at this point in the history
[ Upstream commit e52dce6 ]

Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
aalexandrovich authored and gregkh committed Nov 8, 2023
1 parent da05aa7 commit d408008
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion fs/ntfs3/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,12 @@ static ssize_t ntfs3_label_write(struct file *file, const char __user *buffer,
struct super_block *sb = pde_data(file_inode(file));
struct ntfs_sb_info *sbi = sb->s_fs_info;
ssize_t ret = count;
u8 *label = kmalloc(count, GFP_NOFS);
u8 *label;

if (sb_rdonly(sb))
return -EROFS;

label = kmalloc(count, GFP_NOFS);

if (!label)
return -ENOMEM;
Expand Down

0 comments on commit d408008

Please sign in to comment.