diff options
author | Konstantin Komarov <almaz.alexandrovich@paragon-software.com> | 2023-09-25 10:56:15 +0300 |
---|---|---|
committer | Konstantin Komarov <almaz.alexandrovich@paragon-software.com> | 2023-09-28 15:04:02 +0300 |
commit | e52dce610a2d53bf2b5e94a8843c71cb73a91ea5 (patch) | |
tree | a4e94dfcd6669344d690401dd443c9dde8d6dd96 /fs/ntfs3 | |
parent | d27e202b9ac416e52093edf8789614d93dbd6231 (diff) | |
download | linux-stable-e52dce610a2d53bf2b5e94a8843c71cb73a91ea5.tar.gz linux-stable-e52dce610a2d53bf2b5e94a8843c71cb73a91ea5.tar.bz2 linux-stable-e52dce610a2d53bf2b5e94a8843c71cb73a91ea5.zip |
fs/ntfs3: Do not allow to change label if volume is read-only
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Diffstat (limited to 'fs/ntfs3')
-rw-r--r-- | fs/ntfs3/super.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c index 5811da7e9d45..cf0a720523f0 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -497,7 +497,12 @@ static ssize_t ntfs3_label_write(struct file *file, const char __user *buffer, int err; struct super_block *sb = pde_data(file_inode(file)); 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; |