Skip to content

Commit 3920967

Browse files
edumazetdavem330
authored andcommitted
ipv6: tcp: fix potential NULL deref in tcp_v6_send_reset()
syzbot found a crash in tcp_v6_send_reset() caused by my latest change. Problem is that if an skb has been queued to socket prequeue, skb_dst(skb)->dev can not anymore point to the device. Fortunately in this case the socket pointer is not NULL. A similar issue has been fixed in commit 0f85fea ("tcp: fix more NULL deref after prequeue changes"), I should have known better. Fixes: 323a53c ("ipv6: tcp: enable flowlabel reflection in some RST packets") Signed-off-by: Eric Dumazet <edumazet@google.com> Reported-by: syzbot <syzkaller@googlegroups.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent e8a492c commit 3920967

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎net/ipv6/tcp_ipv6.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,7 @@ static void tcp_v6_send_reset(const struct sock *sk, struct sk_buff *skb)
934934
if (!sk && !ipv6_unicast_destination(skb))
935935
return;
936936

937-
net = dev_net(skb_dst(skb)->dev);
937+
net = sk ? sock_net(sk) : dev_net(skb_dst(skb)->dev);
938938
#ifdef CONFIG_TCP_MD5SIG
939939
rcu_read_lock();
940940
hash_location = tcp_parse_md5sig_option(th);

0 commit comments

Comments
 (0)