]> git.baikalelectronics.ru Git - kernel.git/commit
cxl: Prevent read/write to AFU config space while AFU not configured
authorAndrew Donnellan <andrew.donnellan@au1.ibm.com>
Fri, 9 Dec 2016 06:18:50 +0000 (17:18 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 25 Jan 2017 02:34:24 +0000 (13:34 +1100)
commit0d3e33f0337f3d9737512ab42c73958e0c378677
tree398be4ce65d15bb67d66e5ef12a58e42a3668537
parent5eed298cc41a8e2e68642ce09d2e6ba6e4db5676
cxl: Prevent read/write to AFU config space while AFU not configured

During EEH recovery, we deconfigure all AFUs whilst leaving the
corresponding vPHB and virtual PCI device in place.

If something attempts to interact with the AFU's PCI config space (e.g.
running lspci) after the AFU has been deconfigured and before it's
reconfigured, cxl_pcie_{read,write}_config() will read invalid values from
the deconfigured struct cxl_afu and proceed to Oops when they try to
dereference pointers that have been set to NULL during deconfiguration.

Add a rwsem to struct cxl_afu so we can prevent interaction with config
space while the AFU is deconfigured.

Reported-by: Pradipta Ghosh <pradghos@in.ibm.com>
Suggested-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
Cc: stable@vger.kernel.org # v4.9+
Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: Vaibhav Jain <vaibhav@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
drivers/misc/cxl/cxl.h
drivers/misc/cxl/main.c
drivers/misc/cxl/pci.c
drivers/misc/cxl/vphb.c