我想实现linux安全钩子security_inode_mknod
。有一个参数dev
,我想用它来获取设备结构并将该结构放入usb_deauthorize_device(struct usb_device *usb_dev)
和{ {3}}阻止USB设备和SATA设备,
这种方法可行吗?如果没有,我可以使用其他参数来获取它吗?
* Check permissions when creating a special file (or a socket or a fifo
* file created via the mknod system call). Note that if mknod operation
* is being done for a regular file, then the create hook will be called
* and not this hook.
* @dir contains the inode structure of parent of the new file.
* @dentry contains the dentry structure of the new file.
* @mode contains the mode of the new file.
* @dev contains the device number.
* Return 0 if permission is granted.
static inline int security_inode_mknod(struct inode *dir,
struct dentry *dentry,
int mode, dev_t dev)