]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit
tun: call dev_get_valid_name() before register_netdevice()
authorCong Wang <xiyou.wangcong@gmail.com>
Fri, 13 Oct 2017 18:58:53 +0000 (11:58 -0700)
committerKhalid Elmously <khalid.elmously@canonical.com>
Fri, 16 Feb 2018 17:42:33 +0000 (12:42 -0500)
commit2048f3a5ced75f1117117151ae90d4519f9a6d89
treeea673af79afdff4ed4dc45d12771ff41d22f9c4e
parent0fa601cefecdb006b29d5620e89b92301d2f708d
tun: call dev_get_valid_name() before register_netdevice()

BugLink: https://launchpad.net/bugs/1748846
register_netdevice() could fail early when we have an invalid
dev name, in which case ->ndo_uninit() is not called. For tun
device, this is a problem because a timer etc. are already
initialized and it expects ->ndo_uninit() to clean them up.

We could move these initializations into a ->ndo_init() so
that register_netdevice() knows better, however this is still
complicated due to the logic in tun_detach().

Therefore, I choose to just call dev_get_valid_name() before
register_netdevice(), which is quicker and much easier to audit.
And for this specific case, it is already enough.

Fixes: 96442e42429e ("tuntap: choose the txq based on rxq")
Reported-by: Dmitry Alexeev <avekceeb@gmail.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 0ad646c81b2182f7fa67ec0c8c825e0ee165696d)
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Acked-by: Brad Figg <brad.figg@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/net/tun.c
include/linux/netdevice.h
net/core/dev.c