Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Emil Tantilov <emil.s.tantilov@intel.com>
To: intel-wired-lan@lists.osuosl.org
Cc: netdev@vger.kernel.org, Aleksandr.Loktionov@intel.com,
	przemyslaw.kitszel@intel.com, anthony.l.nguyen@intel.com,
	andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, decot@google.com,
	willemb@google.com, joshua.a.hay@intel.com,
	madhu.chittim@intel.com, aleksander.lobakin@intel.com,
	larysa.zaremba@intel.com, iamvivekkumar@google.com
Subject: [Intel-wired-lan] [PATCH iwl-net v2 4/5] idpf: fix memory leak in idpf_vc_core_deinit()
Date: Thu, 20 Nov 2025 16:12:17 -0800	[thread overview]
Message-ID: <20251121001218.4565-5-emil.s.tantilov@intel.com> (raw)
In-Reply-To: <20251121001218.4565-1-emil.s.tantilov@intel.com>

Make sure to free hw->lan_regs. Reported by kmemleak during reset:

unreferenced object 0xff1b913d02a936c0 (size 96):
  comm "kworker/u258:14", pid 2174, jiffies 4294958305
  hex dump (first 32 bytes):
    00 00 00 c0 a8 ba 2d ff 00 00 00 00 00 00 00 00  ......-.........
    00 00 40 08 00 00 00 00 00 00 25 b3 a8 ba 2d ff  ..@.......%...-.
  backtrace (crc 36063c4f):
    __kmalloc_noprof+0x48f/0x890
    idpf_vc_core_init+0x6ce/0x9b0 [idpf]
    idpf_vc_event_task+0x1fb/0x350 [idpf]
    process_one_work+0x226/0x6d0
    worker_thread+0x19e/0x340
    kthread+0x10f/0x250
    ret_from_fork+0x251/0x2b0
    ret_from_fork_asm+0x1a/0x30

Fixes: 6aa53e861c1a ("idpf: implement get LAN MMIO memory regions")
Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Joshua Hay <joshua.a.hay@intel.com>
---
 drivers/net/ethernet/intel/idpf/idpf_virtchnl.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
index fc03d55bc9b9..ca302df9ff40 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
@@ -3570,6 +3570,7 @@ int idpf_vc_core_init(struct idpf_adapter *adapter)
  */
 void idpf_vc_core_deinit(struct idpf_adapter *adapter)
 {
+	struct idpf_hw *hw = &adapter->hw;
 	bool remove_in_prog;
 
 	if (!test_bit(IDPF_VC_CORE_INIT, adapter->flags))
@@ -3593,6 +3594,9 @@ void idpf_vc_core_deinit(struct idpf_adapter *adapter)
 
 	idpf_vport_params_buf_rel(adapter);
 
+	kfree(hw->lan_regs);
+	hw->lan_regs = NULL;
+
 	kfree(adapter->vports);
 	adapter->vports = NULL;
 
-- 
2.37.3


  parent reply	other threads:[~2025-11-21  0:19 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-21  0:12 [Intel-wired-lan] [PATCH iwl-net v2 0/5] idpf: fix issues in the reset handling path Emil Tantilov
2025-11-21  0:12 ` [Intel-wired-lan] [PATCH iwl-net v2 1/5] idpf: keep the netdev when a reset fails Emil Tantilov
2025-12-10 22:28   ` Salin, Samuel
2025-11-21  0:12 ` [Intel-wired-lan] [PATCH iwl-net v2 2/5] idpf: detach and close netdevs while handling a reset Emil Tantilov
2025-11-25 13:42   ` Simon Horman
2025-11-25 14:58     ` Tantilov, Emil S
2025-11-26 17:10       ` Simon Horman
2025-12-10 22:28         ` Salin, Samuel
2025-12-01 21:34   ` Chittim, Madhu
2025-11-21  0:12 ` [Intel-wired-lan] [PATCH iwl-net v2 3/5] idpf: fix memory leak in idpf_vport_rel() Emil Tantilov
2025-12-10 22:28   ` Salin, Samuel
2025-11-21  0:12 ` Emil Tantilov [this message]
2025-12-10 22:28   ` [Intel-wired-lan] [PATCH iwl-net v2 4/5] idpf: fix memory leak in idpf_vc_core_deinit() Salin, Samuel
2025-11-21  0:12 ` [Intel-wired-lan] [PATCH iwl-net v2 5/5] idpf: fix error handling in the init_task on load Emil Tantilov
2025-12-01 21:44   ` Chittim, Madhu
2025-12-10 22:29     ` Salin, Samuel

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=20251121001218.4565-5-emil.s.tantilov@intel.com \
    --to=emil.s.tantilov@intel.com \
    --cc=Aleksandr.Loktionov@intel.com \
    --cc=aleksander.lobakin@intel.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=decot@google.com \
    --cc=edumazet@google.com \
    --cc=iamvivekkumar@google.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=joshua.a.hay@intel.com \
    --cc=kuba@kernel.org \
    --cc=larysa.zaremba@intel.com \
    --cc=madhu.chittim@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=willemb@google.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