.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
---|
1 | 2 | /* |
---|
2 | 3 | * fs/ioprio.c |
---|
3 | 4 | * |
---|
.. | .. |
---|
16 | 17 | * |
---|
17 | 18 | * ioprio_set(PRIO_PROCESS, pid, prio); |
---|
18 | 19 | * |
---|
19 | | - * See also Documentation/block/ioprio.txt |
---|
| 20 | + * See also Documentation/block/ioprio.rst |
---|
20 | 21 | * |
---|
21 | 22 | */ |
---|
22 | 23 | #include <linux/gfp.h> |
---|
.. | .. |
---|
68 | 69 | |
---|
69 | 70 | switch (class) { |
---|
70 | 71 | case IOPRIO_CLASS_RT: |
---|
71 | | - if (!capable(CAP_SYS_ADMIN)) |
---|
| 72 | + /* |
---|
| 73 | + * Originally this only checked for CAP_SYS_ADMIN, |
---|
| 74 | + * which was implicitly allowed for pid 0 by security |
---|
| 75 | + * modules such as SELinux. Make sure we check |
---|
| 76 | + * CAP_SYS_ADMIN first to avoid a denial/avc for |
---|
| 77 | + * possibly missing CAP_SYS_NICE permission. |
---|
| 78 | + */ |
---|
| 79 | + if (!capable(CAP_SYS_ADMIN) && !capable(CAP_SYS_NICE)) |
---|
72 | 80 | return -EPERM; |
---|
73 | | - /* fall through */ |
---|
| 81 | + fallthrough; |
---|
74 | 82 | /* rt has prio field too */ |
---|
75 | 83 | case IOPRIO_CLASS_BE: |
---|
76 | 84 | if (data >= IOPRIO_BE_NR || data < 0) |
---|