net: fix sk_forward_alloc corruptions
As David found out, sock_queue_err_skb() should be called with socket lock hold, or we risk sk_forward_alloc corruption, since we use non atomic operations to update this field. This patch adds bh_lock_sock()/bh_unlock_sock() pair to three spots. (BH already disabled) 1) skb_tstamp_tx() 2) Before calling ip_icmp_error(), in __udp4_lib_err() 3) Before calling ipv6_icmp_error(), in __udp6_lib_err() Reported-by: Anton Blanchard <anton@samba.org> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
7dfde179c3
commit
2903037400
@ -2992,7 +2992,11 @@ void skb_tstamp_tx(struct sk_buff *orig_skb,
|
||||
memset(serr, 0, sizeof(*serr));
|
||||
serr->ee.ee_errno = ENOMSG;
|
||||
serr->ee.ee_origin = SO_EE_ORIGIN_TIMESTAMPING;
|
||||
|
||||
bh_lock_sock(sk);
|
||||
err = sock_queue_err_skb(sk, skb);
|
||||
bh_unlock_sock(sk);
|
||||
|
||||
if (err)
|
||||
kfree_skb(skb);
|
||||
}
|
||||
|
Reference in New Issue
Block a user