Taehee Yoo
ad9bd8daf2
bonding: fix using uninitialized mode_lock
...
When a bonding interface is being created, it setups its mode and options.
At that moment, it uses mode_lock so mode_lock should be initialized
before that moment.
rtnl_newlink()
rtnl_create_link()
alloc_netdev_mqs()
->setup() //bond_setup()
->newlink //bond_newlink
bond_changelink()
register_netdevice()
->ndo_init() //bond_init()
After commit 089bca2caed0 ("bonding: use dynamic lockdep key instead of
subclass"), mode_lock is initialized in bond_init().
So in the bond_changelink(), un-initialized mode_lock can be used.
mode_lock should be initialized in bond_setup().
This patch partially reverts commit 089bca2caed0 ("bonding: use dynamic
lockdep key instead of subclass")
Test command:
ip link add bond0 type bond mode 802.3ad lacp_rate 0
Splat looks like:
[ 60.615127] INFO: trying to register non-static key.
[ 60.615900] the code is fine but needs lockdep annotation.
[ 60.616697] turning off the locking correctness validator.
[ 60.617490] CPU: 1 PID: 957 Comm: ip Not tainted 5.4.0-rc3+ #109
[ 60.618350] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
[ 60.619481] Call Trace:
[ 60.619918] dump_stack+0x7c/0xbb
[ 60.620453] register_lock_class+0x1215/0x14d0
[ 60.621131] ? alloc_netdev_mqs+0x7b3/0xcc0
[ 60.621771] ? is_bpf_text_address+0x86/0xf0
[ 60.622416] ? is_dynamic_key+0x230/0x230
[ 60.623032] ? unwind_get_return_address+0x5f/0xa0
[ 60.623757] ? create_prof_cpu_mask+0x20/0x20
[ 60.624408] ? arch_stack_walk+0x83/0xb0
[ 60.625023] __lock_acquire+0xd8/0x3de0
[ 60.625616] ? stack_trace_save+0x82/0xb0
[ 60.626225] ? stack_trace_consume_entry+0x160/0x160
[ 60.626957] ? deactivate_slab.isra.80+0x2c5/0x800
[ 60.627668] ? register_lock_class+0x14d0/0x14d0
[ 60.628380] ? alloc_netdev_mqs+0x7b3/0xcc0
[ 60.629020] ? save_stack+0x69/0x80
[ 60.629574] ? save_stack+0x19/0x80
[ 60.630121] ? __kasan_kmalloc.constprop.4+0xa0/0xd0
[ 60.630859] ? __kmalloc_node+0x16f/0x480
[ 60.631472] ? alloc_netdev_mqs+0x7b3/0xcc0
[ 60.632121] ? rtnl_create_link+0x2ed/0xad0
[ 60.634388] ? __rtnl_newlink+0xad4/0x11b0
[ 60.635024] lock_acquire+0x164/0x3b0
[ 60.635608] ? bond_3ad_update_lacp_rate+0x91/0x200 [bonding]
[ 60.636463] _raw_spin_lock_bh+0x38/0x70
[ 60.637084] ? bond_3ad_update_lacp_rate+0x91/0x200 [bonding]
[ 60.637930] bond_3ad_update_lacp_rate+0x91/0x200 [bonding]
[ 60.638753] ? bond_3ad_lacpdu_recv+0xb30/0xb30 [bonding]
[ 60.639552] ? bond_opt_get_val+0x180/0x180 [bonding]
[ 60.640307] ? ___slab_alloc+0x5aa/0x610
[ 60.640925] bond_option_lacp_rate_set+0x71/0x140 [bonding]
[ 60.641751] __bond_opt_set+0x1ff/0xbb0 [bonding]
[ 60.643217] ? kasan_unpoison_shadow+0x30/0x40
[ 60.643924] bond_changelink+0x9a4/0x1700 [bonding]
[ 60.644653] ? memset+0x1f/0x40
[ 60.742941] ? bond_slave_changelink+0x1a0/0x1a0 [bonding]
[ 60.752694] ? alloc_netdev_mqs+0x8ea/0xcc0
[ 60.753330] ? rtnl_create_link+0x2ed/0xad0
[ 60.753964] bond_newlink+0x1e/0x60 [bonding]
[ 60.754612] __rtnl_newlink+0xb9f/0x11b0
[ ... ]
Reported-by: syzbot+8da67f407bcba2c72e6e@syzkaller.appspotmail.com
Reported-by: syzbot+0d083911ab18b710da71@syzkaller.appspotmail.com
Fixes: 089bca2caed0 ("bonding: use dynamic lockdep key instead of subclass")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-10-29 18:03:36 -07:00
..
2019-10-18 08:38:26 -07:00
2019-09-22 09:39:09 -07:00
2019-10-10 14:39:23 +02:00
2019-10-15 14:10:19 -06:00
2019-09-25 13:54:45 +02:00
2019-09-17 16:22:26 -07:00
2019-10-19 06:32:31 -04:00
2019-09-13 16:44:49 +03:00
2019-10-19 06:32:32 -04:00
2019-09-15 14:17:27 +02:00
2019-09-30 10:04:28 -07:00
2019-10-02 13:49:43 -07:00
2019-10-03 09:15:19 -07:00
2019-10-02 16:16:07 -07:00
2019-10-10 11:11:17 +02:00
2019-09-17 19:15:14 -07:00
2019-10-28 13:33:41 -07:00
2019-09-22 09:30:30 -07:00
2019-10-10 17:05:20 +02:00
2019-09-22 09:39:09 -07:00
2019-09-19 14:14:28 -07:00
2019-10-15 09:20:07 -07:00
2019-09-18 11:14:31 -07:00
2019-10-15 01:19:05 +02:00
2019-10-18 06:40:28 +10:00
2019-10-01 14:49:41 -04:00
2019-09-22 12:02:21 -07:00
2019-10-01 14:49:45 -04:00
2019-10-02 06:42:48 -07:00
2019-09-18 11:14:31 -07:00
2019-09-28 20:44:12 +02:00
2019-10-10 11:18:37 +02:00
2019-10-04 15:54:22 -03:00
2019-10-17 11:18:44 -07:00
2019-10-18 16:52:37 +02:00
2019-09-22 09:30:30 -07:00
2019-10-28 13:33:41 -07:00
2019-09-12 20:45:52 +02:00
2019-09-05 13:17:01 -06:00
2019-09-17 00:54:29 -05:00
2019-10-18 22:29:36 -04:00
2019-10-04 14:38:46 +02:00
2019-08-30 15:57:27 +02:00
2019-10-09 11:08:03 +02:00
2019-09-29 10:24:23 -07:00
2019-10-04 18:22:14 +02:00
2019-10-09 11:05:50 +02:00
2019-10-07 09:56:36 +02:00
2019-10-29 18:03:36 -07:00
2019-10-08 16:52:26 -07:00
2019-09-23 17:20:40 -04:00
2019-09-29 10:33:41 -07:00
2019-10-28 13:33:41 -07:00
2019-09-18 11:14:31 -07:00
2019-09-28 17:47:33 -07:00
2019-10-14 21:44:26 +02:00
2019-09-18 11:14:31 -07:00
2019-10-15 23:51:36 +02:00
2019-09-28 08:14:15 -07:00
2019-08-30 12:46:12 +01:00
2019-09-23 19:16:01 -07:00
2019-09-19 14:19:33 -07:00
2019-10-14 15:31:50 +03:00
2019-09-22 12:04:59 -07:00
2019-09-17 19:15:14 -07:00
2019-10-07 14:55:46 -04:00
2019-09-27 12:19:47 -07:00
2019-09-17 18:40:42 -07:00
2019-09-22 10:55:08 -07:00
2019-09-30 10:04:28 -07:00
2019-09-17 15:33:31 -07:00
2019-09-22 11:05:43 -07:00
2019-10-19 17:09:11 -04:00
2019-10-18 08:08:53 -07:00
2019-09-16 15:52:38 -07:00
2019-09-22 10:52:23 -07:00
2019-09-17 18:40:42 -07:00
2019-09-13 17:23:18 +03:00
2019-10-12 15:44:46 -07:00
2019-09-24 15:54:08 -07:00
2019-09-25 17:51:41 -07:00
2019-09-29 10:24:23 -07:00
2019-10-10 13:12:28 +02:00
2019-09-18 11:14:31 -07:00
2019-10-10 14:24:06 +02:00
2019-09-25 17:51:41 -07:00
2019-10-13 09:38:27 -04:00
2019-10-05 15:29:49 +09:00
2019-10-10 14:50:32 +02:00
2019-09-09 10:43:15 -04:00
2019-10-10 15:35:41 +02:00
2019-09-27 11:17:38 -07:00
2019-10-19 17:09:11 -04:00
2019-09-18 11:05:34 -07:00
2019-09-18 11:05:34 -07:00