tipc: add NULL pointer check
authorHoang Le <[email protected]>
Wed, 3 Apr 2019 06:05:04 +0000 (13:05 +0700)
committerDavid S. Miller <[email protected]>
Fri, 5 Apr 2019 00:34:11 +0000 (17:34 -0700)
skb somehow dequeued out of inputq before processing, it causes to
NULL pointer and kernel crashed.

Add checking skb valid before using.

Fixes: c55c8edafa9 ("tipc: smooth change between replicast and broadcast")
Reported-by: Tuong Lien Tong <[email protected]>
Acked-by: Ying Xue <[email protected]>
Signed-off-by: Hoang Le <[email protected]>
Acked-by: Jon Maloy <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
net/tipc/bcast.c

index 76e14dc08bb9fc23dbb2358d4559b97966f35818..6c997d4a62189347650c43b9d2891a6883b0be6f 100644 (file)
@@ -769,6 +769,9 @@ void tipc_mcast_filter_msg(struct net *net, struct sk_buff_head *defq,
        u32 node, port;
 
        skb = skb_peek(inputq);
+       if (!skb)
+               return;
+
        hdr = buf_msg(skb);
 
        if (likely(!msg_is_syn(hdr) && skb_queue_empty(defq)))