函数源码

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source File:block\scsi_ioctl.c Create Date:2022-07-27 19:11:37
首页 Copyright©Brick

197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
int blk_verify_command(unsigned char *cmd, fmode_t mode)
{
    struct blk_cmd_filter *filter = &blk_default_cmd_filter;
 
    /* root can do any command. */
    if (capable(CAP_SYS_RAWIO))
        return 0;
 
    /* Anybody who can open the device can do a read-safe command */
    if (test_bit(cmd[0], filter->read_ok))
        return 0;
 
    /* Write-safe commands require a writable open */
    if (test_bit(cmd[0], filter->write_ok) && (mode & FMODE_WRITE))
        return 0;
 
    return -EPERM;
}