Re: [syzbot] [net?] KASAN: use-after-free Read in __skb_flow_dissect (3)

From: Hillf Danton
Date: Wed Jan 17 2024 - 21:34:59 EST


On Mon, 01 Jan 2024 09:18:16 -0800
> syzbot found the following issue on:
>
> HEAD commit: f5837722ffec Merge tag 'mm-hotfixes-stable-2023-12-27-15-0..
> git tree: upstream
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=122dfc65e80000

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

--- x/net/core/filter.c
+++ y/net/core/filter.c
@@ -2147,6 +2147,10 @@ static int __bpf_redirect_no_mac(struct
kfree_skb(skb);
return -ERANGE;
}
+ if (skb_headlen(skb) <= mlen + sizeof(struct iphdr)) {
+ kfree_skb(skb);
+ return -ERANGE;
+ }

if (mlen) {
__skb_pull(skb, mlen);
--