lpfc: Fix memory corruption of the lpfc_ncmd->list pointers
authorJames Smart <jsmart2021@gmail.com>
Sat, 22 Apr 2017 00:49:08 +0000 (17:49 -0700)
committerChristoph Hellwig <hch@lst.de>
Tue, 25 Apr 2017 18:00:58 +0000 (20:00 +0200)
commitbbe3012b73b592dfe5f4340a14373840f51887b6
treebcc1fa183ac7c391c3a002c3bfd6bb6446a99fe8
parent51f397642c890e6c54e2532110c84519f1d12e4c
lpfc: Fix memory corruption of the lpfc_ncmd->list pointers

lpfc was changing the private pointer that is set/maintained by
the nvme_fc transport. This caused two issues: a) the transport, on
teardown may erroneous attempt to free whatever address was set;
and b) lfpc uses any value set in lpfc_nvme_fcp_abort() and
assumes its a valid io request.

Correct issue by properly defining a context structure for lpfc.
Lpfc also updated to clear the private context structure on io
completion.

Since this bug caused scrutiny of the way lpfc moves local request
structures between lists, also cleaned up list_del()'s to
list_del_inits()'s.

This is a nvme-specific bug. The patch was cut against the
linux-block tree, for-4.12/block tree. It should be pulled in through
that tree.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/scsi/lpfc/lpfc_nvme.c
drivers/scsi/lpfc/lpfc_nvme.h