public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Kohei Enju <kohei@enjuk.jp>
To: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org
Cc: Tony Nguyen <anthony.l.nguyen@intel.com>,
	Przemek Kitszel <przemyslaw.kitszel@intel.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Faizal Rahim <faizal.abdul.rahim@linux.intel.com>,
	Kohei Enju <kohei@enjuk.jp>
Subject: [PATCH iwl-net v1] igc: fix potential skb leak in igc_fpe_xmit_smd_frame()
Date: Sun, 29 Mar 2026 14:50:49 +0000	[thread overview]
Message-ID: <20260329145122.126040-1-kohei@enjuk.jp> (raw)

When igc_fpe_init_tx_descriptor() fails, no one takes care of an
allocated skb, leaking it. [1]

Use dev_kfree_skb_any() on failure.
Also call igc_flush_tx_descriptors() only on success.

[1]
unreferenced object 0xffff88813aee1b40 (size 224):
  comm "softirq", pid 0, jiffies 4294709256
[...]
  backtrace (crc dee31384):
    kmem_cache_alloc_node_noprof+0x54f/0x640
    __alloc_skb+0xd9/0x5b0
    igc_fpe_xmit_smd_frame.isra.0+0xad/0x510
    igc_fpe_send_mpacket+0x32/0x80
[...]

Fixes: 5422570c0010 ("igc: add support for frame preemption verification")
Signed-off-by: Kohei Enju <kohei@enjuk.jp>
---
 drivers/net/ethernet/intel/igc/igc_tsn.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/igc/igc_tsn.c b/drivers/net/ethernet/intel/igc/igc_tsn.c
index 8a110145bfee..eaa274248d54 100644
--- a/drivers/net/ethernet/intel/igc/igc_tsn.c
+++ b/drivers/net/ethernet/intel/igc/igc_tsn.c
@@ -109,10 +109,14 @@ static int igc_fpe_xmit_smd_frame(struct igc_adapter *adapter,
 	__netif_tx_lock(nq, cpu);
 
 	err = igc_fpe_init_tx_descriptor(ring, skb, type);
-	igc_flush_tx_descriptors(ring);
+	if (!err)
+		igc_flush_tx_descriptors(ring);
 
 	__netif_tx_unlock(nq);
 
+	if (err)
+		dev_kfree_skb_any(skb);
+
 	return err;
 }
 
-- 
2.51.0


             reply	other threads:[~2026-03-29 14:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-29 14:50 Kohei Enju [this message]
2026-03-30  6:32 ` [Intel-wired-lan] [PATCH iwl-net v1] igc: fix potential skb leak in igc_fpe_xmit_smd_frame() Loktionov, Aleksandr
2026-04-03 14:05 ` Simon Horman
2026-04-04 11:40   ` Kohei Enju

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=20260329145122.126040-1-kohei@enjuk.jp \
    --to=kohei@enjuk.jp \
    --cc=andrew+netdev@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=faizal.abdul.rahim@linux.intel.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=przemyslaw.kitszel@intel.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