tipc: add NULL pointer check
authorHoang Le <hoang.h.le@dektech.com.au>
Wed, 3 Apr 2019 06:05:04 +0000 (13:05 +0700)
committerDavid S. Miller <davem@davemloft.net>
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 <tuong.t.lien@dektech.com.au>
Acked-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: Hoang Le <hoang.h.le@dektech.com.au>
Acked-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
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)))