]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
scsi: lpfc: Fix lpfc_force_rscn ndlp kref imbalance
authorJames Smart <jsmart2021@gmail.com>
Sat, 4 Dec 2021 00:26:38 +0000 (16:26 -0800)
committerPaolo Pisati <paolo.pisati@canonical.com>
Fri, 28 Jan 2022 10:03:10 +0000 (11:03 +0100)
BugLink: https://bugs.launchpad.net/bugs/1959376
commit 7576d48c64f36f6fea9df2882f710a474fa35f40 upstream.

Issuing lpfc_force_rscn twice results in an ndlp kref use-after-free call
trace.

A prior patch reworked the get/put handling by ensuring nlp_get was done
before WQE submission and a put was done in the completion path.
Unfortunately, the issue_els_rscn path had a piece of legacy code that did
a nlp_put, causing an imbalance on the ref counts.

Fixed by removing the unnecessary legacy code snippet.

Link: https://lore.kernel.org/r/20211204002644.116455-4-jsmart2021@gmail.com
Fixes: 4430f7fd09ec ("scsi: lpfc: Rework locations of ndlp reference taking")
Cc: <stable@vger.kernel.org> # v5.11+
Co-developed-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
drivers/scsi/lpfc/lpfc_els.c

index 5c10416c1c75a0a5ec90f5811d401e533200000f..78024f11b794a8a0c92584c4b0cec256beeb066b 100644 (file)
@@ -3538,11 +3538,6 @@ lpfc_issue_els_rscn(struct lpfc_vport *vport, uint8_t retry)
                return 1;
        }
 
-       /* This will cause the callback-function lpfc_cmpl_els_cmd to
-        * trigger the release of node.
-        */
-       if (!(vport->fc_flag & FC_PT2PT))
-               lpfc_nlp_put(ndlp);
        return 0;
 }