Commit 2d7f105
security: keys: perform capable check only on privileged operations
If the current task fails the check for the queried capability via
`capable(CAP_SYS_ADMIN)` LSMs like SELinux generate a denial message.
Issuing such denial messages unnecessarily can lead to a policy author
granting more privileges to a subject than needed to silence them.
Reorder CAP_SYS_ADMIN checks after the check whether the operation is
actually privileged.
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>1 parent 57012c5 commit 2d7f105
1 file changed
+8
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
980 | 980 | | |
981 | 981 | | |
982 | 982 | | |
983 | | - | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
984 | 986 | | |
985 | 987 | | |
986 | | - | |
| 988 | + | |
987 | 989 | | |
988 | 990 | | |
989 | 991 | | |
990 | 992 | | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
991 | 996 | | |
992 | 997 | | |
993 | 998 | | |
| |||
1088 | 1093 | | |
1089 | 1094 | | |
1090 | 1095 | | |
1091 | | - | |
| 1096 | + | |
1092 | 1097 | | |
1093 | 1098 | | |
1094 | 1099 | | |
| |||
0 commit comments