mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
fs: Reorder inode_owner_or_capable() to avoid needless
Checking for capabilities should be the last operation when performing access control tests so that PF_SUPERPRIV is set only when it was required for success (implying that the capability was needed for the operation). Reported-by: Solar Designer <[email protected]> Signed-off-by: Kees Cook <[email protected]> Acked-by: Serge Hallyn <[email protected]> Reviewed-by: Andy Lutomirski <[email protected]> Signed-off-by: Al Viro <[email protected]>
This commit is contained in:
parent
41124db869
commit
cc658db47d
2 changed files with 2 additions and 2 deletions
|
|
@ -1008,7 +1008,7 @@ static int may_linkat(struct path *link)
|
|||
/* Source inode owner (or CAP_FOWNER) can hardlink all they like,
|
||||
* otherwise, it must be a safe source.
|
||||
*/
|
||||
if (inode_owner_or_capable(inode) || safe_hardlink_source(inode))
|
||||
if (safe_hardlink_source(inode) || inode_owner_or_capable(inode))
|
||||
return 0;
|
||||
|
||||
audit_log_link_denied("linkat", link);
|
||||
|
|
|
|||
Loading…
Reference in a new issue