]> git.baikalelectronics.ru Git - kernel.git/commit
PCI/sysfs: Check CAP_SYS_ADMIN before parsing user input
authorKrzysztof Wilczyński <kw@linux.com>
Wed, 15 Sep 2021 23:01:25 +0000 (23:01 +0000)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 28 Sep 2021 22:46:28 +0000 (17:46 -0500)
commitb8d1ff97f9a6ae4a987e9e9216a7d40db2a114ce
treeab28ddc3c9af930a20cad1cb9c8222594b12a8c5
parentfa5d4460cfe6a4ab811a36d49fe44ccb61944b70
PCI/sysfs: Check CAP_SYS_ADMIN before parsing user input

Check if the "CAP_SYS_ADMIN" capability flag is set before parsing user
input as it makes more sense to first check whether the current user
actually has the right permissions before accepting any input from such
user.

This will also make order in which enable_store() and msi_bus_store()
perform the "CAP_SYS_ADMIN" capability check consistent with other
PCI-related sysfs objects that first verify whether user has this
capability set.

Link: https://lore.kernel.org/r/20210915230127.2495723-1-kw@linux.com
Signed-off-by: Krzysztof Wilczyński <kw@linux.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/pci-sysfs.c