Files
Linux/include/linux
Cong Wang 0ad646c81b tun: call dev_get_valid_name() before register_netdevice()
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: 96442e4242 ("tuntap: choose the txq based on rxq")
Reported-by: Dmitry Alexeev <[email protected]>
Cc: Jason Wang <[email protected]>
Cc: "Michael S. Tsirkin" <[email protected]>
Signed-off-by: Cong Wang <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
2017-10-16 21:02:54 +01:00
..
…
…
…
2017-09-06 19:56:49 +02:00
…
…
…
…
2017-10-04 10:22:55 +02:00
…
…
…
…
…
…
…
…
…
…
…
…
2017-09-01 16:35:50 -05:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2017-09-08 18:26:49 -07:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2017-08-30 14:40:40 +02:00
…
…
2017-09-04 00:05:22 +02:00
2017-09-04 00:06:02 +02:00
…
…
…
…
…
…
…
…
…
…
…
…
2017-09-05 12:53:11 +02:00
…
…
…
2017-08-24 13:23:03 -07:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2017-09-08 18:26:46 -07:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2017-08-28 20:51:22 +02:00
…
…
2017-09-07 11:53:11 +02:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2017-08-20 13:04:12 -04:00
…
…
…
…
…
…
…
…
…
…
2017-09-25 08:56:05 -06:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2017-09-06 17:27:26 -07:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2017-08-21 12:47:31 -07:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2017-09-08 18:26:47 -07:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2017-08-24 16:34:51 +02:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2017-09-11 12:29:41 -04:00
…
…
…
…
…
2017-09-15 16:57:10 +02:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2017-08-28 16:15:42 +02:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2017-09-08 18:26:48 -07:00
…
…
…
…
2017-08-31 18:50:14 +02:00
…
…
…
2017-09-05 06:34:17 -07:00
…
…
…
…
…
…
…
…
…
…
…