]> git.baikalelectronics.ru Git - kernel.git/commit
net:tipc: Fix a double free in tipc_sk_mcast_rcv
authorLv Yunlong <lyl2019@mail.ustc.edu.cn>
Sun, 28 Mar 2021 07:30:29 +0000 (00:30 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 29 Mar 2021 23:21:37 +0000 (16:21 -0700)
commit664389e107ebf06b6b02e0422496b0b61c46bde8
tree2487000b43508a8da3d163c7f5165104749eb246
parentf3b5f18d4eb1c2ff8503f5a8e2b49088e2f14ce0
net:tipc: Fix a double free in tipc_sk_mcast_rcv

In the if(skb_peek(arrvq) == skb) branch, it calls __skb_dequeue(arrvq) to get
the skb by skb = skb_peek(arrvq). Then __skb_dequeue() unlinks the skb from arrvq
and returns the skb which equals to skb_peek(arrvq). After __skb_dequeue(arrvq)
finished, the skb is freed by kfree_skb(__skb_dequeue(arrvq)) in the first time.

Unfortunately, the same skb is freed in the second time by kfree_skb(skb) after
the branch completed.

My patch removes kfree_skb() in the if(skb_peek(arrvq) == skb) branch, because
this skb will be freed by kfree_skb(skb) finally.

Fixes: ee9c411306469 ("tipc: eliminate race condition at multicast reception")
Signed-off-by: Lv Yunlong <lyl2019@mail.ustc.edu.cn>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tipc/socket.c