From: Dan Carpenter <dan.carpenter@oracle.com>
To: James Smart <james.smart@broadcom.com>, linux-nvme@lists.infradead.org
Cc: Dick Kennedy <dick.kennedy@broadcom.com>,
"James E.J. Bottomley" <jejb@linux.ibm.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Jens Axboe <axboe@kernel.dk>, Hannes Reinecke <hare@suse.de>,
Paul Ely <paul.ely@broadcom.com>,
linux-scsi@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH resend] scsi: lpfc: Fix a use after free in lpfc_nvme_unsol_ls_handler()
Date: Fri, 15 May 2020 13:19:03 +0300 [thread overview]
Message-ID: <20200515101903.GJ3041@kadam> (raw)
In-Reply-To: <yq1y2purqt1.fsf@oracle.com>
The "axchg" pointer is dereferenced when we call the
lpfc_nvme_unsol_ls_issue_abort() function. It can't be either freed or
NULL.
Fixes: 3a8070c567aa ("lpfc: Refactor NVME LS receive handling")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: James Smart <james.smart@broadcom.com>
---
Resending to the NVMe list. Added James' R-b.
Is there a way we could update MAINTAINERS so that ./get_maintainer.pl
send these to the correct list?
drivers/scsi/lpfc/lpfc_sli.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 38889cb6e1996..fcf51b4192d66 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -2895,14 +2895,14 @@ lpfc_nvme_unsol_ls_handler(struct lpfc_hba *phba, struct lpfc_iocbq *piocb)
(phba->nvmet_support) ? "T" : "I", ret);
out_fail:
- kfree(axchg);
-
/* recycle receive buffer */
lpfc_in_buf_free(phba, &nvmebuf->dbuf);
/* If start of new exchange, abort it */
- if (fctl & FC_FC_FIRST_SEQ && !(fctl & FC_FC_EX_CTX))
+ if (axchg && (fctl & FC_FC_FIRST_SEQ) && !(fctl & FC_FC_EX_CTX))
lpfc_nvme_unsol_ls_issue_abort(phba, axchg, sid, oxid);
+
+ kfree(axchg);
}
/**
--
2.26.2
next prev parent reply other threads:[~2020-05-15 10:19 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-12 18:19 [PATCH] scsi: lpfc: Fix a use after free in lpfc_nvme_unsol_ls_handler() Dan Carpenter
2020-05-14 17:03 ` James Smart
2020-05-15 0:21 ` Martin K. Petersen
2020-05-15 10:19 ` Dan Carpenter [this message]
2020-05-20 16:55 ` [PATCH resend] " Christoph Hellwig
2020-05-20 17:24 ` Dan Carpenter
2020-05-20 17:28 ` Christoph Hellwig
2020-05-20 17:33 ` Martin K. Petersen
2020-05-20 17:37 ` Christoph Hellwig
2020-05-20 17:39 ` Martin K. Petersen
2020-05-20 17:48 ` Christoph Hellwig
2020-05-20 17:51 ` James Smart
2020-05-20 17:57 ` Christoph Hellwig
2020-05-20 18:01 ` Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200515101903.GJ3041@kadam \
--to=dan.carpenter@oracle.com \
--cc=axboe@kernel.dk \
--cc=dick.kennedy@broadcom.com \
--cc=hare@suse.de \
--cc=james.smart@broadcom.com \
--cc=jejb@linux.ibm.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=paul.ely@broadcom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).