Skip to content

Commit e52dce6

Browse files
fs/ntfs3: Do not allow to change label if volume is read-only
Signed-off-by: Konstantin Komarov <[email protected]>
1 parent d27e202 commit e52dce6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

fs/ntfs3/super.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,12 @@ static ssize_t ntfs3_label_write(struct file *file, const char __user *buffer,
497497
int err;
498498
struct super_block *sb = pde_data(file_inode(file));
499499
ssize_t ret = count;
500-
u8 *label = kmalloc(count, GFP_NOFS);
500+
u8 *label;
501+
502+
if (sb_rdonly(sb))
503+
return -EROFS;
504+
505+
label = kmalloc(count, GFP_NOFS);
501506

502507
if (!label)
503508
return -ENOMEM;

0 commit comments

Comments
 (0)