netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: core: sk_buff: zero-fill skb->data in __alloc_skb function
@ 2021-04-10  9:51 Phillip Potter
  2021-04-10 10:12 ` Eric Dumazet
  0 siblings, 1 reply; 4+ messages in thread
From: Phillip Potter @ 2021-04-10  9:51 UTC (permalink / raw)
  To: davem
  Cc: kuba, willemb, linmiaohe, edumazet, linyunsheng, alobakin, elver,
	gnault, dseok.yi, viro, vladimir.oltean, netdev, linux-kernel

Zero-fill skb->data in __alloc_skb function of net/core/skbuff.c,
up to start of struct skb_shared_info bytes. Fixes a KMSAN-found
uninit-value bug reported by syzbot at:
https://syzkaller.appspot.com/bug?id=abe95dc3e3e9667fc23b8d81f29ecad95c6f106f

Reported-by: syzbot+2e406a9ac75bb71d4b7a@syzkaller.appspotmail.com
Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
---
 net/core/skbuff.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 785daff48030..9ac26cdb5417 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -215,6 +215,7 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask,
 	 * to allow max possible filling before reallocation.
 	 */
 	size = SKB_WITH_OVERHEAD(ksize(data));
+	memset(data, 0, size);
 	prefetchw(data + size);
 
 	/*
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-04-10 23:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-10  9:51 [PATCH] net: core: sk_buff: zero-fill skb->data in __alloc_skb function Phillip Potter
2021-04-10 10:12 ` Eric Dumazet
2021-04-10 11:00   ` Eric Dumazet
2021-04-10 23:33     ` Phillip Potter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).