From: Al Viro Date: Sat, 27 Jul 2019 12:29:57 +0000 (-0400) Subject: Unbreak mount_capable() X-Git-Tag: v5.15~5795^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c2c44ec20a8496f7a3b3401c092afe96908eced1;p=platform%2Fkernel%2Flinux-starfive.git Unbreak mount_capable() In "consolidate the capability checks in sget_{fc,userns}())" the wrong argument had been passed to mount_capable() by sget_fc(). That mistake had been further obscured later, when switching mount_capable() to fs_context has moved the calculation of bogus argument from sget_fc() to mount_capable() itself. It should've been fc->user_ns all along. Screwed-up-by: Al Viro Reported-by: Christian Brauner Tested-by: Christian Brauner Reviewed-by: David Howells Signed-off-by: Al Viro --- diff --git a/fs/super.c b/fs/super.c index 113c58f..5960578 100644 --- a/fs/super.c +++ b/fs/super.c @@ -478,13 +478,10 @@ EXPORT_SYMBOL(generic_shutdown_super); bool mount_capable(struct fs_context *fc) { - struct user_namespace *user_ns = fc->global ? &init_user_ns - : fc->user_ns; - if (!(fc->fs_type->fs_flags & FS_USERNS_MOUNT)) return capable(CAP_SYS_ADMIN); else - return ns_capable(user_ns, CAP_SYS_ADMIN); + return ns_capable(fc->user_ns, CAP_SYS_ADMIN); } /**