Commit 4b27fe3
tun: call dev_get_valid_name() before register_netdevice()
[ Upstream commit 0ad646c81b2182f7fa67ec0c8c825e0ee165696d ]
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: 96442e4 ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent 196f475 commit 4b27fe3
3 files changed
Lines changed: 9 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1684 | 1684 | | |
1685 | 1685 | | |
1686 | 1686 | | |
| 1687 | + | |
| 1688 | + | |
| 1689 | + | |
1687 | 1690 | | |
1688 | 1691 | | |
1689 | 1692 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3469 | 3469 | | |
3470 | 3470 | | |
3471 | 3471 | | |
| 3472 | + | |
| 3473 | + | |
| 3474 | + | |
3472 | 3475 | | |
3473 | 3476 | | |
3474 | 3477 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1111 | 1111 | | |
1112 | 1112 | | |
1113 | 1113 | | |
1114 | | - | |
1115 | | - | |
1116 | | - | |
| 1114 | + | |
| 1115 | + | |
1117 | 1116 | | |
1118 | 1117 | | |
1119 | 1118 | | |
| |||
1129 | 1128 | | |
1130 | 1129 | | |
1131 | 1130 | | |
| 1131 | + | |
1132 | 1132 | | |
1133 | 1133 | | |
1134 | 1134 | | |
| |||
0 commit comments