]> git.baikalelectronics.ru Git - kernel.git/commit
tuntap: fix possible deadlock when fail to register netdev
authorJason Wang <jasowang@redhat.com>
Fri, 8 Dec 2017 04:02:30 +0000 (12:02 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 8 Dec 2017 15:44:27 +0000 (10:44 -0500)
commitb810341394f0dfb104e99a5332612b64f1364cfd
tree283a91e5edd6c77ff244976cb1d3d479b664cc26
parent46e1bd40fc0976def3ce40a351070e390048d77d
tuntap: fix possible deadlock when fail to register netdev

Private destructor could be called when register_netdev() fail with
rtnl lock held. This will lead deadlock in tun_free_netdev() who tries
to hold rtnl_lock. Fixing this by switching to use spinlock to
synchronize.

Fixes: 5c57ce49c853 ("tun: add eBPF based queue selection method")
Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Willem de Bruijn <willemb@google.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/tun.c