Gao Feng
08058c258a
net: 8021q: Fix one possible panic caused by BUG_ON in free_netdev
...
[ Upstream commit 9745e362add89432d2c951272a99b0a5fe4348a9 ]
The register_vlan_device would invoke free_netdev directly, when
register_vlan_dev failed. It would trigger the BUG_ON in free_netdev
if the dev was already registered. In this case, the netdev would be
freed in netdev_run_todo later.
So add one condition check now. Only when dev is not registered, then
free it directly.
The following is the part coredump when netdev_upper_dev_link failed
in register_vlan_dev. I removed the lines which are too long.
[ 411.237457] ------------[ cut here ]------------
[ 411.237458] kernel BUG at net/core/dev.c:7998!
[ 411.237484] invalid opcode: 0000 [#1 ] SMP
[ 411.237705] [last unloaded: 8021q]
[ 411.237718] CPU: 1 PID: 12845 Comm: vconfig Tainted: G E 4.12.0-rc5+ #6
[ 411.237737] Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 07/02/2015
[ 411.237764] task: ffff9cbeb6685580 task.stack: ffffa7d2807d8000
[ 411.237782] RIP: 0010:free_netdev+0x116/0x120
[ 411.237794] RSP: 0018:ffffa7d2807dbdb0 EFLAGS: 00010297
[ 411.237808] RAX: 0000000000000002 RBX: ffff9cbeb6ba8fd8 RCX: 0000000000001878
[ 411.237826] RDX: 0000000000000001 RSI: 0000000000000282 RDI: 0000000000000000
[ 411.237844] RBP: ffffa7d2807dbdc8 R08: 0002986100029841 R09: 0002982100029801
[ 411.237861] R10: 0004000100029980 R11: 0004000100029980 R12: ffff9cbeb6ba9000
[ 411.238761] R13: ffff9cbeb6ba9060 R14: ffff9cbe60f1a000 R15: ffff9cbeb6ba9000
[ 411.239518] FS: 00007fb690d81700(0000) GS:ffff9cbebb640000(0000) knlGS:0000000000000000
[ 411.239949] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 411.240454] CR2: 00007f7115624000 CR3: 0000000077cdf000 CR4: 00000000003406e0
[ 411.240936] Call Trace:
[ 411.241462] vlan_ioctl_handler+0x3f1/0x400 [8021q]
[ 411.241910] sock_ioctl+0x18b/0x2c0
[ 411.242394] do_vfs_ioctl+0xa1/0x5d0
[ 411.242853] ? sock_alloc_file+0xa6/0x130
[ 411.243465] SyS_ioctl+0x79/0x90
[ 411.243900] entry_SYSCALL_64_fastpath+0x1e/0xa9
[ 411.244425] RIP: 0033:0x7fb69089a357
[ 411.244863] RSP: 002b:00007ffcd04e0fc8 EFLAGS: 00000202 ORIG_RAX: 0000000000000010
[ 411.245445] RAX: ffffffffffffffda RBX: 00007ffcd04e2884 RCX: 00007fb69089a357
[ 411.245903] RDX: 00007ffcd04e0fd0 RSI: 0000000000008983 RDI: 0000000000000003
[ 411.246527] RBP: 00007ffcd04e0fd0 R08: 0000000000000000 R09: 1999999999999999
[ 411.246976] R10: 000000000000053f R11: 0000000000000202 R12: 0000000000000004
[ 411.247414] R13: 00007ffcd04e1128 R14: 00007ffcd04e2888 R15: 0000000000000001
[ 411.249129] RIP: free_netdev+0x116/0x120 RSP: ffffa7d2807dbdb0
Signed-off-by: Gao Feng <gfree.wind@vip.163.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-05 14:40:16 +02:00
..
2016-09-19 20:19:34 +02:00
2017-05-03 08:36:38 -07:00
2017-07-05 14:40:16 +02:00
2016-09-10 21:19:10 -07:00
2016-09-10 21:19:10 -07:00
2017-02-04 09:47:09 +01:00
2016-12-02 10:46:59 +01:00
2017-05-20 14:28:41 +02:00
2017-06-14 15:05:52 +02:00
2017-07-05 14:40:14 +02:00
2017-02-18 15:11:40 +01:00
2017-04-08 09:30:30 +02:00
2017-07-05 14:40:14 +02:00
2016-12-03 23:54:25 -05:00
2017-06-07 12:07:42 +02:00
2017-07-05 14:40:16 +02:00
2017-02-18 15:11:43 +01:00
2017-02-18 15:11:43 +01:00
2016-10-18 10:28:18 -04:00
2016-07-08 13:23:12 +02:00
2017-07-05 14:40:15 +02:00
2017-07-05 14:40:15 +02:00
2017-05-25 15:44:41 +02:00
2017-02-26 11:10:51 +01:00
2017-01-19 20:18:04 +01:00
2017-05-03 08:36:34 -07:00
2017-05-03 08:36:35 -07:00
2016-09-10 23:12:53 -07:00
2016-05-29 22:33:25 -07:00
2017-02-26 11:10:50 +01:00
2017-06-24 07:11:14 +02:00
2016-09-19 20:19:34 +02:00
2017-03-22 12:43:34 +01:00
2016-10-20 11:23:08 -04:00
2017-06-17 06:41:58 +02:00
2016-06-27 15:06:18 -04:00
2016-12-05 19:43:42 -05:00
2016-07-11 02:02:03 +02:00
2017-03-30 09:41:21 +02:00
2017-06-07 12:07:43 +02:00
2016-05-17 14:11:19 -04:00
2016-12-02 13:29:26 -05:00
2016-07-13 11:53:40 -07:00
2017-06-29 13:00:31 +02:00
2017-03-22 12:43:34 +01:00
2017-07-05 14:40:15 +02:00
2017-03-22 12:43:33 +01:00
2017-04-12 12:41:17 +02:00
2016-10-19 10:58:04 -04:00
2017-07-05 14:40:14 +02:00
2017-07-05 14:40:14 +02:00
2017-01-09 08:32:23 +01:00
2017-06-24 07:11:13 +02:00
2016-09-09 18:13:30 -07:00
2017-03-31 10:31:45 +02:00
2016-06-09 23:41:03 -07:00
2016-08-17 19:36:23 -04:00
2016-08-17 19:36:23 -04:00
2017-02-26 11:10:51 +01:00
2016-10-06 09:52:23 -07:00