Commit aa9ab97
tun: call dev_get_valid_name() before register_netdevice()
[ Upstream commit 0ad646c ]
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 4531b5b commit aa9ab97
3 files changed
+9
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1813 | 1813 | | |
1814 | 1814 | | |
1815 | 1815 | | |
| 1816 | + | |
| 1817 | + | |
| 1818 | + | |
1816 | 1819 | | |
1817 | 1820 | | |
1818 | 1821 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3702 | 3702 | | |
3703 | 3703 | | |
3704 | 3704 | | |
| 3705 | + | |
| 3706 | + | |
| 3707 | + | |
3705 | 3708 | | |
3706 | 3709 | | |
3707 | 3710 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1146 | 1146 | | |
1147 | 1147 | | |
1148 | 1148 | | |
1149 | | - | |
1150 | | - | |
1151 | | - | |
| 1149 | + | |
| 1150 | + | |
1152 | 1151 | | |
1153 | 1152 | | |
1154 | 1153 | | |
| |||
1164 | 1163 | | |
1165 | 1164 | | |
1166 | 1165 | | |
| 1166 | + | |
1167 | 1167 | | |
1168 | 1168 | | |
1169 | 1169 | | |
| |||
0 commit comments