cxlflash: Verify problem state area is mapped before notifying shutdown
authorUma Krishnan <ukrishn@linux.vnet.ibm.com>
Thu, 21 Jul 2016 20:44:04 +0000 (15:44 -0500)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 27 Jul 2016 04:32:06 +0000 (00:32 -0400)
commit1bd2b2823e5aa219b2442fd4568a075efe81de5f
treecd317775cafac8e05d03da704b24d9db5d4bbe91
parent05a05872c8d4b4357c9d913e6d73ae64882bddf5
cxlflash: Verify problem state area is mapped before notifying shutdown

If an EEH or some other hard error occurs while the adapter instance was
being initialized, on the subsequent shutdown of the device, the system
could crash with:

[c000000f1da03b60c0000000005eccfc pci_device_shutdown+0x6c/0x100
[c000000f1da03ba0c0000000006d67d4 device_shutdown+0x1b4/0x2c0
[c000000f1da03c40c0000000000ea30c kernel_restart_prepare+0x5c/0x80
[c000000f1da03c70c0000000000ea48c kernel_restart+0x2c/0xc0
[c000000f1da03ce0c0000000000ea970 SyS_reboot+0x1c0/0x2d0
[c000000f1da03e30c000000000009204 system_call+0x38/0xb4

This crash is due to the AFU not being mapped when the shutdown
notification routine is called and is a regression that was inserted
recently with Commit 704c4b0ddc03 ("cxlflash: Shutdown notify support
for CXL Flash cards").

As a fix, shutdown notification should only occur when the AFU is
mapped.

Fixes: 704c4b0ddc03 ("cxlflash: Shutdown notify support for CXL Flash cards")
Signed-off-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Acked-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/cxlflash/main.c