Message ID | c93a253b24701513dbeeb307cb2b9e3afd4c74b5.1737271118.git.leon@kernel.org (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [v4] PCI/sysfs: Change read permissions for VPD attributes | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Not a local patch |
diff --git a/drivers/pci/vpd.c b/drivers/pci/vpd.c index a469bcbc0da7..c873ab47526b 100644 --- a/drivers/pci/vpd.c +++ b/drivers/pci/vpd.c @@ -332,6 +332,13 @@ static umode_t vpd_attr_is_visible(struct kobject *kobj, if (!pdev->vpd.cap) return 0; + /* + * On Mellanox devices reading VPD is safe for unprivileged users, + * so just add needed bits to allow read. + */ + if (unlikely(pdev->vendor == PCI_VENDOR_ID_MELLANOX)) + return a->attr.mode | 0044; + return a->attr.mode; }