mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ruinskiy, Dima" <dima.ruinskiy@intel.com>
To: Dawei Feng <dawei.feng@seu.edu.cn>,
	Tony Nguyen <anthony.l.nguyen@intel.com>
Cc: 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>,
	Dirk Brandewie <dirk.j.brandewie@intel.com>,
	<intel-wired-lan@lists.osuosl.org>, <netdev@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <jianhao.xu@seu.edu.cn>,
	<stable@vger.kernel.org>, Zilin Guan <zilin@seu.edu.cn>
Subject: Re: [Intel-wired-lan] [PATCH net] e1000: fix memory leak in e1000_probe()
Date: Wed, 10 Jun 2026 11:29:09 +0300	[thread overview]
Message-ID: <3b1b2455-76a6-4e0d-be0c-83aadfe18a55@intel.com> (raw)
In-Reply-To: <20260607145706.2933860-1-dawei.feng@seu.edu.cn>

On 07/06/2026 17:57, Dawei Feng wrote:
> In the e1000_probe() path, e1000_sw_init() allocates adapter->tx_ring and
> adapter->rx_ring. If the subsequent CE4100-specific MDIO BAR mapping
> fails, the error handling jumps past the ring cleanup code, leaking both
> allocations.
> 
> Fix this leak by moving the err_mdio_ioremap label above the ring
> deallocation logic. This guarantees the proper release of these resources
> and prevents the memory leak.
> 
> The bug was first flagged by an experimental analysis tool we are
> developing for kernel memory-management bugs while analyzing
> v6.13-rc1. The tool is still under development and is not yet publicly
> available. Manual inspection confirms that the bug is still
> present in v7.1-rc6.
> 
> An x86_64 allyesconfig build showed no new warnings. As we do not have a
> CE4100 reference platform to test with, no runtime testing was able to
> be performed.
> 
> Fixes: 5377a4160bb65 ("e1000: Add support for the CE4100 reference platform")
> Cc: stable@vger.kernel.org
> Signed-off-by: Zilin Guan <zilin@seu.edu.cn>
> Signed-off-by: Dawei Feng <dawei.feng@seu.edu.cn>
> ---
>   drivers/net/ethernet/intel/e1000/e1000_main.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c
> index 9b09eb144b81..d7f5c6f16142 100644
> --- a/drivers/net/ethernet/intel/e1000/e1000_main.c
> +++ b/drivers/net/ethernet/intel/e1000/e1000_main.c
> @@ -1222,11 +1222,11 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>   
>   	if (hw->flash_address)
>   		iounmap(hw->flash_address);
> +err_mdio_ioremap:
>   	kfree(adapter->tx_ring);
>   	kfree(adapter->rx_ring);
>   err_dma:
>   err_sw_init:
> -err_mdio_ioremap:
>   	iounmap(hw->ce4100_gbe_mdio_base_virt);
>   	iounmap(hw->hw_addr);
>   err_ioremap:
Reviewed-by: Dima Ruinskiy <dima.ruinskiy@intel.com>

      reply	other threads:[~2026-06-10  8:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-07 14:57 Dawei Feng
2026-06-10  8:29 ` Ruinskiy, Dima [this message]

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=3b1b2455-76a6-4e0d-be0c-83aadfe18a55@intel.com \
    --to=dima.ruinskiy@intel.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=dawei.feng@seu.edu.cn \
    --cc=dirk.j.brandewie@intel.com \
    --cc=edumazet@google.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jianhao.xu@seu.edu.cn \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=stable@vger.kernel.org \
    --cc=zilin@seu.edu.cn \
    /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®