mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jesse Taube <jtaubepe@redhat.com>
To: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	"James E.J. Bottomley" <James.Bottomley@hansenpartnership.com>,
	Nimal Prabudoss I <nprabudo@redhat.com>,
	jmeneghi@redhat.com, Nilesh Javali <njavali@marvell.com>,
	Manish Rangankar <mrangankar@marvell.com>,
	GR-ETH-Storage-Upstream@marvell.com,
	Jesse Taube <jtaubepe@redhat.com>
Subject: [PATCH] qedf: Fix use-after-free in qedf_xmit error path
Date: Tue, 24 Nov 2026 10:01:03 -0500	[thread overview]
Message-ID: <20261124150103.166306-1-jtaubepe@redhat.com> (raw)

In one of the error paths in qedf_xmit, we were freeing the skb and then
accessing the Fibre Channel frame header destination ID field stored
in the skb. Save d_id from the skb before freeing it to avoid a
use-after-free.

Signed-off-by: Jesse Taube <jtaubepe@redhat.com>
---
 drivers/scsi/qedf/qedf_main.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c
index da429b3a4283..ff7d93fbc079 100644
--- a/drivers/scsi/qedf/qedf_main.c
+++ b/drivers/scsi/qedf/qedf_main.c
@@ -1113,11 +1113,12 @@ static int qedf_xmit(struct fc_lport *lport, struct fc_frame *fp)
 	}
 	if (vn_port && ntoh24(fh->fh_d_id) != FC_FID_FLOGI) {
 		struct fc_rport_priv *rdata = NULL;
+		u32 d_id = ntoh24(fh->fh_d_id);
 
 		QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_LL2,
-		    "Dropping FCoE frame to %06x.\n", ntoh24(fh->fh_d_id));
+			  "Dropping FCoE frame to %06x.\n", d_id);
 		kfree_skb(skb);
-		rdata = fc_rport_lookup(lport, ntoh24(fh->fh_d_id));
+		rdata = fc_rport_lookup(lport, d_id);
 		if (rdata) {
 			rdata->retries = lport->max_rport_retry_count;
 			kref_put(&rdata->kref, fc_rport_destroy);
-- 
2.56.0


                 reply	other threads:[~2026-11-24 15:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261124150103.166306-1-jtaubepe@redhat.com \
    --to=jtaubepe@redhat.com \
    --cc=GR-ETH-Storage-Upstream@marvell.com \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=jmeneghi@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=mrangankar@marvell.com \
    --cc=njavali@marvell.com \
    --cc=nprabudo@redhat.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

all inboxes | Powered by JetHome®