]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: lpfc: nvmet: avoid hang / use-after-free when destroying targetport
authorEwan D. Milne <emilne@redhat.com>
Thu, 17 Jan 2019 16:14:45 +0000 (11:14 -0500)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 23 Jan 2019 01:40:59 +0000 (20:40 -0500)
commit777b4e202542946a7289fac3e951ee3f355f2bfe
treef438ad4606805b8987231877def62d5d15ed5a50
parentccaee56734142df7f5104dfbb7f82d0986f9b27b
scsi: lpfc: nvmet: avoid hang / use-after-free when destroying targetport

We cannot wait on a completion object in the lpfc_nvme_targetport structure
in the _destroy_targetport() code path because the NVMe/fc transport will
free that structure immediately after the .targetport_delete() callback.
This results in a use-after-free, and a hang if slub_debug=FZPU is enabled.

Fix this by putting the completion on the stack.

Signed-off-by: Ewan D. Milne <emilne@redhat.com>
Acked-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/lpfc/lpfc_nvmet.c
drivers/scsi/lpfc/lpfc_nvmet.h