Re: [PATCH] cxl: prevent read/write to AFU config space while AFU not configured

2016-12-06 Thread Frederic Barrat



Le 05/12/2016 à 14:22, Andrew Donnellan a écrit :

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 
Suggested-by: Frederic Barrat 
Cc: sta...@vger.kernel.org # 4.4+
Signed-off-by: Andrew Donnellan 



Thanks for adding the comments!

Acked-by: Frederic Barrat 



Re: [PATCH] cxl: prevent read/write to AFU config space while AFU not configured

2016-12-05 Thread Ian Munsie
Acked-by: Ian Munsie 

Looks like a reasonable solution

> Pradipta found this while doing testing for cxlflash. I've tested this 
> patch and I'm satisfied that it solves the issue, but I've asked Pradipta 
> to test it a bit further. 

:)