Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

netfilter: nf_reject_ipv4: Fix use-after-free in send_reset

niph is not updated after pskb_expand_head changes the skb head. It
still points to the freed data, which is then used to update tot_len and
checksum. This could cause use-after-free poison crash.

Update niph, if ip_route_me_harder does not fail.

This only affects the interaction with REJECT targets and br_netfilter.

Signed-off-by: Tejaswi Tanikella <tejaswit@codeaurora.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

authored by

Tejaswi Tanikella and committed by
Pablo Neira Ayuso
7400bb4b 0414c78f

+2
+2
net/ipv4/netfilter/nf_reject_ipv4.c
··· 132 132 if (ip_route_me_harder(net, nskb, RTN_UNSPEC)) 133 133 goto free_nskb; 134 134 135 + niph = ip_hdr(nskb); 136 + 135 137 /* "Never happens" */ 136 138 if (nskb->len > dst_mtu(skb_dst(nskb))) 137 139 goto free_nskb;