Message ID | 20250302160657.127253-8-cgoettsche@seltendoof.de (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [v2,01/11] coccinelle: Add script to reorder capable() calls | expand |
diff --git a/fs/fhandle.c b/fs/fhandle.c index 3e092ae6d142..5b77b38f0510 100644 --- a/fs/fhandle.c +++ b/fs/fhandle.c @@ -303,9 +303,9 @@ static inline int may_decode_fh(struct handle_to_path_ctx *ctx, if (ns_capable(root->mnt->mnt_sb->s_user_ns, CAP_SYS_ADMIN)) ctx->flags = HANDLE_CHECK_PERMS; else if (is_mounted(root->mnt) && + !has_locked_children(real_mount(root->mnt), root->dentry) && ns_capable(real_mount(root->mnt)->mnt_ns->user_ns, - CAP_SYS_ADMIN) && - !has_locked_children(real_mount(root->mnt), root->dentry)) + CAP_SYS_ADMIN)) ctx->flags = HANDLE_CHECK_PERMS | HANDLE_CHECK_SUBTREE; else return -EPERM;