Skip to content

Commit 013a923

Browse files
committed
netfilter: tproxy: bail out if IP has been disabled on the device
jira LE-2157 cve CVE-2024-36270 Rebuild_History Non-Buildable kernel-5.14.0-503.14.1.el9_5 commit-author Florian Westphal <fw@strlen.de> commit 21a673b syzbot reports: general protection fault, probably for non-canonical address 0xdffffc0000000003: 0000 [#1] PREEMPT SMP KASAN PTI KASAN: null-ptr-deref in range [0x0000000000000018-0x000000000000001f] [..] RIP: 0010:nf_tproxy_laddr4+0xb7/0x340 net/ipv4/netfilter/nf_tproxy_ipv4.c:62 Call Trace: nft_tproxy_eval_v4 net/netfilter/nft_tproxy.c:56 [inline] nft_tproxy_eval+0xa9a/0x1a00 net/netfilter/nft_tproxy.c:168 __in_dev_get_rcu() can return NULL, so check for this. Reported-and-tested-by: syzbot+b94a6818504ea90d7661@syzkaller.appspotmail.com Fixes: cc6eb43 ("tproxy: use the interface primary IP address as a default value for --on-ip") Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> (cherry picked from commit 21a673b) Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent f390522 commit 013a923

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

net/ipv4/netfilter/nf_tproxy_ipv4.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ __be32 nf_tproxy_laddr4(struct sk_buff *skb, __be32 user_laddr, __be32 daddr)
5858

5959
laddr = 0;
6060
indev = __in_dev_get_rcu(skb->dev);
61+
if (!indev)
62+
return daddr;
6163

6264
in_dev_for_each_ifa_rcu(ifa, indev) {
6365
if (ifa->ifa_flags & IFA_F_SECONDARY)

0 commit comments

Comments
 (0)