All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] udf: parse umask, mode and dmode as octal again
@ 2026-12-02  0:22 Yifan Feng
  0 siblings, 0 replies; only message in thread
From: Yifan Feng @ 2026-12-02  0:22 UTC (permalink / raw)
  To: Jan Kara; +Cc: Eric Sandeen, linux-fsdevel, linux-kernel, Yifan Feng

Before the conversion to the new mount API these three options were
parsed with match_octal().  Now they are fsparam_u32, which takes a
number without a leading zero as decimal.  So mode=644,dmode=755 gives
files the permissions 0204 and directories 0363.

udf_show_options() prints the values in octal without a leading zero,
so they are also read back as other values.  mount(8) passes the
options of /proc/mounts again when it is given the mount point only,
and every such remount changes the permissions:

  # mount -o umask=022 /dev/vda /mnt
  # findmnt -no OPTIONS /mnt
  rw,relatime,umask=22,iocharset=utf8
  # mount -o remount,noatime /mnt
  # findmnt -no OPTIONS /mnt
  rw,noatime,umask=26,iocharset=utf8

Use fsparam_u32oct for the three options.

Fixes: c4e89cc674ac ("udf: convert to new mount API")
Signed-off-by: Yifan Feng <evanfengff@gmail.com>
---
Tested in QEMU with mount(8) from util-linux 2.38.1. umask=8 and mode=0x1a4 are rejected again, as before the conversion. The checkpatch warnings are the existing style of the table.
Found and written with the help of an AI coding assistant.

 fs/udf/super.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/udf/super.c b/fs/udf/super.c
index a81a8509524a..5a07271b9745 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -502,7 +502,7 @@ static const struct fs_parameter_spec udf_param_spec[] = {
 	fsparam_flag	("longad",		Opt_longad),
 	fsparam_string	("gid",			Opt_gid),
 	fsparam_string	("uid",			Opt_uid),
-	fsparam_u32	("umask",		Opt_umask),
+	fsparam_u32oct	("umask",		Opt_umask),
 	fsparam_u32	("session",		Opt_session),
 	fsparam_u32	("lastblock",		Opt_lastblock),
 	fsparam_u32	("anchor",		Opt_anchor),
@@ -512,8 +512,8 @@ static const struct fs_parameter_spec udf_param_spec[] = {
 	fsparam_u32	("rootdir",		Opt_rootdir),
 	fsparam_flag	("utf8",		Opt_utf8),
 	fsparam_string	("iocharset",		Opt_iocharset),
-	fsparam_u32	("mode",		Opt_fmode),
-	fsparam_u32	("dmode",		Opt_dmode),
+	fsparam_u32oct	("mode",		Opt_fmode),
+	fsparam_u32oct	("dmode",		Opt_dmode),
 	{}
  };
 

base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244
-- 
2.39.3 (Apple Git-146)


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-12-02  0:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02  0:22 [PATCH] udf: parse umask, mode and dmode as octal again Yifan Feng

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.