Skip to content

Commit ab0fa82

Browse files
committed
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>
1 parent 34dbbcd commit ab0fa82

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/pci/pci-sysfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ static ssize_t pci_read_config(struct file *filp, struct kobject *kobj,
636636
u8 *data = (u8 *) buf;
637637

638638
/* Several chips lock up trying to read undefined config space */
639-
if (security_capable(filp->f_cred, &init_user_ns, CAP_SYS_ADMIN) == 0)
639+
if (file_ns_capable(filp, &init_user_ns, CAP_SYS_ADMIN))
640640
size = dev->cfg_size;
641641
else if (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)
642642
size = 128;

0 commit comments

Comments
 (0)