Skip to content

Commit fccbe38

Browse files
bsach64brauner
authored andcommitted
statmount: permission check should return EPERM
Currently, statmount() returns ENOENT when caller is not CAP_SYS_ADMIN in the user namespace owner of target mount namespace. This should be EPERM instead. Suggested-by: Miklos Szeredi <miklos@szeredi.hu> Signed-off-by: Bhavik Sachdev <b.sachdev1904@gmail.com> Link: https://patch.msgid.link/20251129091455.757724-2-b.sachdev1904@gmail.com Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 8f0b4cc commit fccbe38

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fs/namespace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5780,7 +5780,7 @@ SYSCALL_DEFINE4(statmount, const struct mnt_id_req __user *, req,
57805780

57815781
if (kreq.mnt_ns_id && (ns != current->nsproxy->mnt_ns) &&
57825782
!ns_capable_noaudit(ns->user_ns, CAP_SYS_ADMIN))
5783-
return -ENOENT;
5783+
return -EPERM;
57845784

57855785
ks = kmalloc(sizeof(*ks), GFP_KERNEL_ACCOUNT);
57865786
if (!ks)

0 commit comments

Comments
 (0)