* [PATCH net-next] net: zero hw address entries on allocation
@ 2026-11-22 0:26 Yuyang Huang
2026-11-22 0:32 ` netdev-bot+sinfo
0 siblings, 1 reply; 3+ messages in thread
From: Yuyang Huang @ 2026-11-22 0:26 UTC (permalink / raw)
To: Yuyang Huang
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Nicolas Dichtel,
Paolo Abeni, Simon Horman, Stanislav Fomichev, netdev
__hw_addr_create() allocates struct netdev_hw_addr with kmalloc() and
copies only addr_len bytes into ha->addr[MAX_ADDR_LEN], leaving the
rest uninitialized.
If dev->addr_len later grows while entries remain (e.g., adding a
multicast address to a down TAP device with SIOCADDMULTI and then
switching it to ARPHRD_TUNNEL6 via TUNSETLINK), readers using
dev->addr_len such as /proc/net/dev_mcast and AF_PACKET
RTM_GETMULTICAST expose the uninitialized trailing slab bytes, and
__hw_addr_add_ex() reads them in memcmp().
Switch __hw_addr_create() to kzalloc() so the unused tail of ha->addr
is always zero.
Link: https://lore.kernel.org/netdev/179012275175.2160803.16091441325063775173@kernel.org/
Signed-off-by: Yuyang Huang <yuyanghuang@google.com>
---
net/core/dev_addr_lists.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/core/dev_addr_lists.c b/net/core/dev_addr_lists.c
index b6f25e487984..ff0815d8f6a8 100644
--- a/net/core/dev_addr_lists.c
+++ b/net/core/dev_addr_lists.c
@@ -100,7 +100,7 @@ __hw_addr_create(const unsigned char *addr, int addr_len,
alloc_size = sizeof(*ha);
if (alloc_size < L1_CACHE_BYTES)
alloc_size = L1_CACHE_BYTES;
- ha = kmalloc(alloc_size, GFP_ATOMIC);
+ ha = kzalloc(alloc_size, GFP_ATOMIC);
if (!ha)
return NULL;
memcpy(ha->addr, addr, addr_len);
--
2.56.1.750.gf70dc682cf-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net: zero hw address entries on allocation
2026-11-22 0:26 [PATCH net-next] net: zero hw address entries on allocation Yuyang Huang
@ 2026-11-22 0:32 ` netdev-bot+sinfo
2026-11-22 0:38 ` Yuyang Huang
0 siblings, 1 reply; 3+ messages in thread
From: netdev-bot+sinfo @ 2026-11-22 0:32 UTC (permalink / raw)
To: Yuyang Huang
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Nicolas Dichtel,
Paolo Abeni, Simon Horman, Stanislav Fomichev, netdev
Hi!
This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:
- How the issue was discovered, e.g. hit in production, hit during
development, syzbot report, manual code inspection, LLM or static
analysis tool scan.
- Whether the issue was actually triggered, or is only theoretical
(e.g. found by LLM and not proven at runtime). If it was triggered
please include the symptoms, like the stack trace or kernel messages.
Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account.
*IMPORTANT*: If you do repost (for other reasons) - please include
the relevant info in the cover letter or commit messages.
--
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net: zero hw address entries on allocation
2026-11-22 0:32 ` netdev-bot+sinfo
@ 2026-11-22 0:38 ` Yuyang Huang
0 siblings, 0 replies; 3+ messages in thread
From: Yuyang Huang @ 2026-11-22 0:38 UTC (permalink / raw)
To: netdev-bot+sinfo, Yuyang Huang
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Nicolas Dichtel,
Paolo Abeni, Simon Horman, Stanislav Fomichev, netdev
On Sun, 22 Nov 2026 00:32:38 +0000, netdev-bot+sinfo@kernel.org wrote:
> This is an automated message. This series looks like a fix, but its
> commit messages seem to be missing some information:
>
> - How the issue was discovered, e.g. hit in production, hit during
> development, syzbot report, manual code inspection, LLM or static
> analysis tool scan.
This was flagged by Sashiko AI review on the AF_PACKET multicast dump
series (see the Link: tag).
> - Whether the issue was actually triggered, or is only theoretical
> (e.g. found by LLM and not proven at runtime). If it was triggered
> please include the symptoms, like the stack trace or kernel messages.
It was reproduced at runtime in a virtme-ng VM booted with slub_debug=P
(CONFIG_TUN=y, CONFIG_SLUB_DEBUG=y, CONFIG_INIT_ON_ALLOC_DEFAULT_ON=n):
1. Create a down TAP device (ARPHRD_ETHER, addr_len 6).
2. Add 01:00:5e:11:22:33 via SIOCADDMULTI.
3. Switch link type to ARPHRD_TUNNEL6 (addr_len 16) via TUNSETLINK.
4. Read /proc/net/dev_mcast and dump AF_PACKET RTM_GETMULTICAST.
Before the patch, both exposed 10 bytes of 0x6b SLUB poison:
/proc/net/dev_mcast:
8 taprepro0 1 1 01005e1122336b6b6b6b6b6b6b6b6b6b
AF_PACKET RTM_GETMULTICAST:
01005e1122336b6b6b6b6b6b6b6b6b6b
With this patch, all 10 trailing bytes are zero:
/proc/net/dev_mcast:
8 taprepro0 1 1 01005e11223300000000000000000000
AF_PACKET RTM_GETMULTICAST:
01005e11223300000000000000000000
> *IMPORTANT*: If you do repost (for other reasons) - please include
> the relevant info in the cover letter or commit messages.
Will include these details in the commit message if a v2 is needed.
Thanks,
Yuyang
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-22 0:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-22 0:26 [PATCH net-next] net: zero hw address entries on allocation Yuyang Huang
2026-11-22 0:32 ` netdev-bot+sinfo
2026-11-22 0:38 ` Yuyang Huang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox