Skip to content

Commit

Permalink
tipc: eliminate potential memory leak
Browse files Browse the repository at this point in the history
In the function tipc_sk_mcast_rcv() we call refcount_dec(&skb->users)
on received sk_buffers. Since the reference counter might hit zero at
this point, we have a potential memory leak.

We fix this by replacing refcount_dec() with kfree_skb().

Signed-off-by: Jon Maloy <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Jon Maloy authored and davem330 committed Dec 13, 2017
1 parent 8359301 commit c545a94
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/tipc/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -1140,7 +1140,7 @@ void tipc_sk_mcast_rcv(struct net *net, struct sk_buff_head *arrvq,
__skb_dequeue(arrvq);
__skb_queue_tail(inputq, skb);
}
refcount_dec(&skb->users);
kfree_skb(skb);
spin_unlock_bh(&inputq->lock);
continue;
}
Expand Down

0 comments on commit c545a94

Please sign in to comment.