Thread (2 messages) 2 messages, 2 authors, 2026-02-07

Re: [PATCH V2 net] net: hns3: fix double free issue for tx spare buffer

From: patchwork-bot+netdevbpf@kernel.org
Date: 2026-02-07 05:00:09
Also in: lkml

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski [off-list ref]:

On Thu, 5 Feb 2026 20:17:19 +0800 you wrote:
From: Jian Shen <shenjian15@huawei.com>

In hns3_set_ringparam(), a temporary copy (tmp_rings) of the ring structure
is created for rollback. However, the tx_spare pointer in the original
ring handle is incorrectly left pointing to the old backup memory.

Later, if memory allocation fails in hns3_init_all_ring() during the setup,
the error path attempts to free all newly allocated rings. Since tx_spare
contains a stale (non-NULL) pointer from the backup, it is mistaken for
a newly allocated buffer and is erroneously freed, leading to a double-free
of the backup memory.

[...]
Here is the summary with links:
  - [V2,net] net: hns3: fix double free issue for tx spare buffer
    https://git.kernel.org/netdev/net/c/6d2f142b1e4b

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help