From: Wentao Liang <vulab@iscas.ac.cn>
To: Potnuri Bharat Teja <bharat@chelsio.com>,
Jason Gunthorpe <jgg@ziepe.ca>, Leon Romanovsky <leon@kernel.org>
Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
Wentao Liang <vulab@iscas.ac.cn>,
stable@vger.kernel.org
Subject: [PATCH 2/4] RDMA/cxgb4: Balance the extra skb reference on rx_pkt() error paths
Date: Tue, 3 Nov 2026 09:46:26 +0000 [thread overview]
Message-ID: <20261103094626.1289618-1-vulab@iscas.ac.cn> (raw)
rx_pkt() takes an extra reference on the skb with skb_get() so that the
pointer stored in req->cookie stays valid after the handler returns.
process_work() frees the skb once when the handler returns 0, and the
firmware completion path releases the extra reference through that
cookie.
If the route, neighbour or L2 table lookup fails, rx_pkt() returns
without calling send_fw_pass_open_req(), so the extra reference is never
released and the skb is leaked.
Move skb_get() down to just before send_fw_pass_open_req(), where the
reference is actually handed to the firmware. The early error paths now
leave only the reference owned by process_work(), which releases it when
the handler returns.
Fixes: 1cab775c3e75 ("RDMA/cxgb4: Fix LE hash collision bug for passive open connection")
Cc: stable@vger.kernel.org
Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
drivers/infiniband/hw/cxgb4/cm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
index a6f520f49d59..2cdc4744a24a 100644
--- a/drivers/infiniband/hw/cxgb4/cm.c
+++ b/drivers/infiniband/hw/cxgb4/cm.c
@@ -4134,7 +4134,6 @@ static int rx_pkt(struct c4iw_dev *dev, struct sk_buff *skb)
tcph = (struct tcphdr *)(iph + 1);
skb_set_network_header(skb, (void *)iph - (void *)rss);
skb_set_transport_header(skb, (void *)tcph - (void *)rss);
- skb_get(skb);
pr_debug("lip 0x%x lport %u pip 0x%x pport %u tos %d\n",
ntohl(iph->daddr), ntohs(tcph->dest), ntohl(iph->saddr),
@@ -4193,6 +4192,7 @@ static int rx_pkt(struct c4iw_dev *dev, struct sk_buff *skb)
* in cpl and pass it through the regular cpl_pass_accept_req path.
*/
build_cpl_pass_accept_req(skb, stid, iph->tos);
+ skb_get(skb);
send_fw_pass_open_req(dev, skb, iph->daddr, tcph->dest, iph->saddr,
tcph->source, ntohl(tcph->seq), filter, window,
rss_qid, pi->port_id);
--
2.34.1
reply other threads:[~2026-11-03 9:46 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=20261103094626.1289618-1-vulab@iscas.ac.cn \
--to=vulab@iscas.ac.cn \
--cc=bharat@chelsio.com \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=stable@vger.kernel.org \
/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®