aboutsummaryrefslogtreecommitdiffstats
path: root/net/packet
diff options
context:
space:
mode:
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>2011-12-27 22:32:41 -0500
committerDavid S. Miller <davem@davemloft.net>2011-12-27 22:32:41 -0500
commitaef950b4ba3196622a5bd5e21ab1d63f30658285 (patch)
treef4cb91f4517a041ef95c28ad50039b0b2ae6b137 /net/packet
parentc43c5f39584c0f388a7e5372312c2c48221a4415 (diff)
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 <yongjun_wei@trendmicro.com.cn> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/packet')
-rw-r--r--net/packet/af_packet.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 3891702b81df..d9d4970b9b07 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -2448,8 +2448,12 @@ static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 protoc
2448{ 2448{
2449 struct packet_sock *po = pkt_sk(sk); 2449 struct packet_sock *po = pkt_sk(sk);
2450 2450
2451 if (po->fanout) 2451 if (po->fanout) {
2452 if (dev)
2453 dev_put(dev);
2454
2452 return -EINVAL; 2455 return -EINVAL;
2456 }
2453 2457
2454 lock_sock(sk); 2458 lock_sock(sk);
2455 2459