scsi: lpfc: Fix a use after free in lpfc_nvme_unsol_ls_handler()
Subsystems (4)
PATCH 1/1 scsi: lpfc: Fix a use after free in lpfc_nvme_unsol_ls_handler()
The "axchg" pointer is dereferenced when we call the lpfc_nvme_unsol_ls_issue_abort() function. It can't be either freed or NULL.
--- drivers/scsi/lpfc/lpfc_sli.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/lpfc/lpfc_sli.c +3 -3
@@ -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); }/**
Signature · 1 line
2.26.2
Quoted 22 lines · Dan Carpenter
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 <[email protected]>--- drivers/scsi/lpfc/lpfc_sli.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/scsi/lpfc/lpfc_sli.c +0
-2@@ -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);
drivers/scsi/lpfc/lpfc_sli.c lpfc_nvme_unsol_ls_handler(struct lpfc_hba *phba, struct lpfc_iocbq *piocb) · line 2908
Quoted 10 lines
drivers/scsi/lpfc/lpfc_sli.c +3
-1/* 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); }/**
Thank You
-- james
Dan,
Quoted 5 lines
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")
This fix needs to go through the NVMe tree.
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
PATCH RESEND 1/1 scsi: lpfc: Fix a use after free in lpfc_nvme_unsol_ls_handler()
The "axchg" pointer is dereferenced when we call the lpfc_nvme_unsol_ls_issue_abort() function. It can't be either freed or NULL.
---
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(-)
drivers/scsi/lpfc/lpfc_sli.c +3 -3
@@ -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); }/**
Signature · 1 line
2.26.2
James, can you review this patch?
Quoted 1 line · Christoph Hellwig
James, can you review this patch?
He already reviewed it in a different thread. I copied his R-b tag.
regards,
dan carpenter
Quoted 4 lines · Dan Carpenter
Quoted 1 line · Christoph Hellwig
James, can you review this patch?
He already reviewed it in a different thread. I copied his R-b tag.
James, should this go into the nvme or scsi tree?
Christoph,
Quoted 7 lines · Dan Carpenter
Quoted 4 lines · Christoph Hellwig
Quoted 1 line
James, can you review this patch?
He already reviewed it in a different thread. I copied his R-b tag.
James, should this go into the nvme or scsi tree?
The offending patch is in the nvme tree so I think you should take it. Otherwise I'll pick it up in 5.8/scsi-fixes.
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Quoted 5 lines · Martin K. Petersen
Christoph,
Quoted 2 lines · Dan Carpenter
Quoted 1 line · Christoph Hellwig
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
James, can you review this patch?
He already reviewed it in a different thread. I copied his R-b tag.
James, should this go into the nvme or scsi tree?
The offending patch is in the nvme tree so I think you should take it. Otherwise I'll pick it up in 5.8/scsi-fixes.
I'll pick it up. Can you give me an ACK for it to show Jens you are ok with that?
Martin K. Petersen
Acked-byChristoph,
Quoted 2 lines
I'll pick it up. Can you give me an ACK for it to show Jens you are ok with that?
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Christoph Hellwig
AppliedQuoted 7 lines · Martin K. Petersen
Christoph,
Quoted 2 lines
I'll pick it up. Can you give me an ACK for it to show Jens you are ok with that?
Thanks,
applied to nvme-5.8.
Quoted 9 lines · Christoph Hellwig
Quoted 5 lines · Martin K. Petersen
Christoph,
Quoted 2 lines
I'll pick it up. Can you give me an ACK for it to show Jens you are ok with that?
Thanks,
applied to nvme-5.8.
Guess you didn't see Dan's response - we had replied, and Dick rejected it. Dick has created a new patch that I'll be posting shortly.
-- james
Quoted 6 lines · James Smart
Quoted 5 lines · Christoph Hellwig
Quoted 4 lines · Martin K. Petersen
Christoph,
Quoted 2 lines
I'll pick it up. Can you give me an ACK for it to show Jens you are ok with that?
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Thanks,
applied to nvme-5.8.
Guess you didn't see Dan's response - we had replied, and Dick rejected it. Dick has created a new patch that I'll be posting shortly.
Oh well, I'll pull it again then.
Quoted 6 lines · James Smart
Quoted 5 lines · Christoph Hellwig
Quoted 4 lines · Martin K. Petersen
Christoph,
Quoted 2 lines
I'll pick it up. Can you give me an ACK for it to show Jens you are ok with that?
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Thanks,
applied to nvme-5.8.
Guess you didn't see Dan's response - we had replied, and Dick rejected it. Dick has created a new patch that I'll be posting shortly.
Gar.... I'm sorry I have two mail boxes, one for kernel-janitors and one for my own email address. I guess his email never made it to the lists. I did get it on my other email box though.
regards,
dan carpenter