]> git.baikalelectronics.ru Git - kernel.git/commit
packet: missing dev_put() in packet_do_bind()
authorLars Westerhoff <lars.westerhoff@newtec.eu>
Mon, 27 Jul 2015 22:32:21 +0000 (01:32 +0300)
committerDavid S. Miller <davem@davemloft.net>
Mon, 27 Jul 2015 22:38:58 +0000 (15:38 -0700)
commit17e3571e2a42b492119e2fd2f7bc6f83ba6d3a29
tree6bccf1b8da44cf06707413aed948e81032987c81
parent226ec056c9038c6b6ce3d2f2380e93d17b8cd245
packet: missing dev_put() in packet_do_bind()

When binding a PF_PACKET socket, the use count of the bound interface is
always increased with dev_hold in dev_get_by_{index,name}.  However,
when rebound with the same protocol and device as in the previous bind
the use count of the interface was not decreased.  Ultimately, this
caused the deletion of the interface to fail with the following message:

unregister_netdevice: waiting for dummy0 to become free. Usage count = 1

This patch moves the dev_put out of the conditional part that was only
executed when either the protocol or device changed on a bind.

Fixes: 7a5d1bb74b2d ('packet: improve socket create/bind latency in some cases')
Signed-off-by: Lars Westerhoff <lars.westerhoff@newtec.eu>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/packet/af_packet.c