mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
packet: fix possible dev refcnt leak when bind fail
If bind is fail when bind is called after set PACKET_FANOUT sock option, the dev refcnt will leak. Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
c43c5f3958
commit
aef950b4ba
1 changed files with 5 additions and 1 deletions
|
|
@ -2448,8 +2448,12 @@ static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 protoc
|
|||
{
|
||||
struct packet_sock *po = pkt_sk(sk);
|
||||
|
||||
if (po->fanout)
|
||||
if (po->fanout) {
|
||||
if (dev)
|
||||
dev_put(dev);
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
lock_sock(sk);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue