Skip to content

Commit d2324a9

Browse files
committed
nsfs: tighten permission checks for handle opening
Even privileged services should not necessarily be able to see other privileged service's namespaces so they can't leak information to each other. Use may_see_all_namespaces() helper that centralizes this policy until the nstree adapts. Link: https://patch.msgid.link/[email protected] Fixes: 5222470 ("nsfs: support file handles") Reviewed-by: Jeff Layton <[email protected]> Cc: [email protected] # v6.18+ Signed-off-by: Christian Brauner <[email protected]>
1 parent e6b899f commit d2324a9

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fs/nsfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ static struct dentry *nsfs_fh_to_dentry(struct super_block *sb, struct fid *fh,
627627
return ERR_PTR(-EOPNOTSUPP);
628628
}
629629

630-
if (owning_ns && !ns_capable(owning_ns, CAP_SYS_ADMIN)) {
630+
if (owning_ns && !may_see_all_namespaces()) {
631631
ns->ops->put(ns);
632632
return ERR_PTR(-EPERM);
633633
}

0 commit comments

Comments
 (0)