mirror of https://gitee.com/openkylin/linux.git
pci-sysfs: use proper file capability helper function
The PCI config access checked the file capabilities correctly, but used the itnernal security capability check rather than the helper function that is actually meant for that. The security_capable() has unusual return values and is not meant to be used elsewhere (the only other use is in the capability checking functions that we actually intend people to use, and this odd PCI usage really stood out when looking around the capability code. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
34dbbcdbf6
commit
ab0fa82b2d
|
@ -636,7 +636,7 @@ static ssize_t pci_read_config(struct file *filp, struct kobject *kobj,
|
|||
u8 *data = (u8 *) buf;
|
||||
|
||||
/* Several chips lock up trying to read undefined config space */
|
||||
if (security_capable(filp->f_cred, &init_user_ns, CAP_SYS_ADMIN) == 0)
|
||||
if (file_ns_capable(filp, &init_user_ns, CAP_SYS_ADMIN))
|
||||
size = dev->cfg_size;
|
||||
else if (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)
|
||||
size = 128;
|
||||
|
|
Loading…
Reference in New Issue