Redundant check for CAP_SYS_NICE in block/ioprio.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, I found that there are checks for CAP_SYS_NICE both in
ioprio_check_cap and set_task_ioprio. In the syscall ioprio_set, it
first calls ioprio_check_cap() to check ioprio, then in each case
inside the switch block, it will call set_task_ioprio() to set
priority for the process. (just like below)
-------------------------------------
SYSCALL_DEFINE3(ioprio_set, int, which, int, who, int, ioprio)
{
    ...
    ret = ioprio_check_cap(ioprio);  // check CAP_SYS_NICE
    ...
    switch (which) {
        case IOPRIO_WHO_PROCESS:
            ...
                ret = set_task_ioprio(p, ioprio);   // check CAP_SYS_NICE
        case IOPRIO_WHO_PGRP:
            ...
                ret = set_task_ioprio(p, ioprio);   // check CAP_SYS_NICE
        case IOPRIO_WHO_USER:
            ...
                ret = set_task_ioprio(p, ioprio);   // check CAP_SYS_NICE
        ...
    }
    ...
}
-------------------------------------
Is it possible to remove the check for CAP_SYS_NICE inside
ioprio_check_cap? (for set_task_ioprio will check it later) Or, it's
better to keep these two checks for some special reason?

Thanks!

Best regards,
Tianyu



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux