mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] fs/ntfs3: reject FS_IOC_SETFSLABEL on readonly mounts
@ 2026-06-30  0:59 Baolin Liu
  2026-06-30  1:07 ` liubaolin
  2026-09-16 11:09 ` Konstantin Komarov
  0 siblings, 2 replies; 3+ messages in thread
From: Baolin Liu @ 2026-06-30  0:59 UTC (permalink / raw)
  To: almaz.alexandrovich, ethan.ferguson
  Cc: ntfs3, linux-kernel, liubaolin12138, Baolin Liu

From: Baolin Liu <liubaolin@kylinos.cn>

FS_IOC_SETFSLABEL does not check for readonly mounts and
can report success without persisting the label change.

Return -EROFS on readonly mounts.

Fixes: 21dc07ac9c25 ("ntfs3: add FS_IOC_SETFSLABEL ioctl")
Signed-off-by: Baolin Liu <liubaolin@kylinos.cn>
---
 fs/ntfs3/file.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c
index b041639ab406..f43baa46ec5c 100644
--- a/fs/ntfs3/file.c
+++ b/fs/ntfs3/file.c
@@ -105,6 +105,9 @@ static int ntfs_ioctl_set_volume_label(struct ntfs_sb_info *sbi, u8 __user *buf)
 	if (!capable(CAP_SYS_ADMIN))
 		return -EPERM;
 
+	if (sb_rdonly(sbi->sb))
+		return -EROFS;
+
 	if (copy_from_user(user, buf, FSLABEL_MAX))
 		return -EFAULT;
 
-- 
2.51.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-09-16 11:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-30  0:59 [PATCH] fs/ntfs3: reject FS_IOC_SETFSLABEL on readonly mounts Baolin Liu
2026-06-30  1:07 ` liubaolin
2026-09-16 11:09 ` Konstantin Komarov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®