From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from www2881.sakura.ne.jp (www2881.sakura.ne.jp [49.212.198.91]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 331E22777FC for ; Sat, 4 Apr 2026 11:40:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=49.212.198.91 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775302810; cv=none; b=VXVjKiX7CqhEgqrQ/4Z5cPFs2vwZWukY7SgCOR/yuDgtbZw7COqAG2JniycJaSBMS/85C3YbeTEEYdrvlIkrBzQDhB5ZNFag2wnpmkCdB/wdtxGkwhnTcmkNBJl8/xJzskr82+C16nttE44roc9j3Qvxe60SX08uOhCBkRHYlpA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775302810; c=relaxed/simple; bh=B93AwwnUvwpazkIH6zs1/m82X0nNZfK/6xzJBQOyX9I=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=aYRmRmIpQI7Hs5sPy+1lpCqSPci3e/u93jiqcVK6jZLaWoxeDNQkCFhoeoO4ZlQTHrEWC052YrPdwkLr2NrTFotXFksOcSA0wz1Vy/TI4khWkVOvU6FYumdxlC01EstMRrWg16j3UHT8+9WrFdfB8U7wfR3WA6/dy2Ck0tnFu7s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=enjuk.jp; spf=pass smtp.mailfrom=enjuk.jp; dkim=pass (2048-bit key) header.d=enjuk.jp header.i=@enjuk.jp header.b=wXtFIZZb; arc=none smtp.client-ip=49.212.198.91 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=enjuk.jp Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=enjuk.jp Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=enjuk.jp header.i=@enjuk.jp header.b="wXtFIZZb" Received: from x1 (13.3.31.150.dy.iij4u.or.jp [150.31.3.13]) (authenticated bits=0) by www2881.sakura.ne.jp (8.16.1/8.16.1) with ESMTPSA id 634Be5DL006352 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 4 Apr 2026 20:40:07 +0900 (JST) (envelope-from kohei@enjuk.jp) DKIM-Signature: a=rsa-sha256; bh=MPq1pUu+fEtcun1am5TUsNjkCUb+pzJqigWwnFIwT9k=; c=relaxed/relaxed; d=enjuk.jp; h=From:Message-ID:To:Subject:Date; s=rs20251215; t=1775302807; v=1; b=wXtFIZZbgl4ot7WXuTlRU3TXuzrvI3TCoP1fqHCYSb9boNphY3YAKwyTHL0FCQfu rUuAOc1utxk3FEnoucXkJSXpB2HImHIQQ15ZX5v+e1GfGT1iZg2oQ5A3Dq/gJr/+ R2LYHQ143M+G+gr6M/W7csN1uUCUu5/NeMYSFownviPJf5v2ZaH7TRCjiLjrAiN6 /2w4gTk/NWCyLWG6QRe97RIXA5HtIz7uRkS/jX2f0ny+QZBLBmBaWfW7AuTrdicx aYR2emSgoZKdR/80vMn5haM2tlmk/xn2MZzvTVybpx+ljTc1mrOTBaIBSv9MhRZ+ oixu0m9JlRv7EPJ4AM5RTg== Date: Sat, 4 Apr 2026 20:40:05 +0900 From: Kohei Enju To: Simon Horman Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, Tony Nguyen , Przemek Kitszel , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Faizal Rahim Subject: Re: [PATCH iwl-net v1] igc: fix potential skb leak in igc_fpe_xmit_smd_frame() Message-ID: References: <20260329145122.126040-1-kohei@enjuk.jp> <20260403140555.GH113102@horms.kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20260403140555.GH113102@horms.kernel.org> On 04/03 15:05, Simon Horman wrote: > On Sun, Mar 29, 2026 at 02:50:49PM +0000, Kohei Enju wrote: > > 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 > > I am wondering if we can achieve this while sticking to the idiom > that the main thread of execution is for the non-error flow, > while conditions handle errors. Hi Simon-san, thank you for the suggestion. I agree. It seems cleaner for me. I'll work on v2. > Something like this (completely untested!): > > diff --git a/drivers/net/ethernet/intel/igc/igc_tsn.c b/drivers/net/ethernet/intel/igc/igc_tsn.c > index 8a110145bfee..02dd9f0290a3 100644 > --- a/drivers/net/ethernet/intel/igc/igc_tsn.c > +++ b/drivers/net/ethernet/intel/igc/igc_tsn.c > @@ -109,10 +109,16 @@ 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) > + goto err_free_skb_any; > > + igc_flush_tx_descriptors(ring); > __netif_tx_unlock(nq); > + return 0; > > +err_free_skb_any: > + __netif_tx_unlock(nq); > + dev_kfree_skb_any(skb); > return err; > } >