Skip to content

Commit c2c44ec

Browse files
author
Al Viro
committed
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 <[email protected]> Reported-by: Christian Brauner <[email protected]> Tested-by: Christian Brauner <[email protected]> Reviewed-by: David Howells <[email protected]> Signed-off-by: Al Viro <[email protected]>
1 parent 19a1c40 commit c2c44ec

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

fs/super.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -478,13 +478,10 @@ EXPORT_SYMBOL(generic_shutdown_super);
478478

479479
bool mount_capable(struct fs_context *fc)
480480
{
481-
struct user_namespace *user_ns = fc->global ? &init_user_ns
482-
: fc->user_ns;
483-
484481
if (!(fc->fs_type->fs_flags & FS_USERNS_MOUNT))
485482
return capable(CAP_SYS_ADMIN);
486483
else
487-
return ns_capable(user_ns, CAP_SYS_ADMIN);
484+
return ns_capable(fc->user_ns, CAP_SYS_ADMIN);
488485
}
489486

490487
/**

0 commit comments

Comments
 (0)