diff mbox series

[net-next] net: hsr: init prune_proxy_timer sooner

Message ID 20240426163355.2613767-1-edumazet@google.com (mailing list archive)
State Accepted
Commit 3c668cef61adde9ddfb1b79708c9a08d9ac01bae
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: hsr: init prune_proxy_timer sooner | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 926 this patch: 926
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 1 maintainers not CCed: m-karicheri2@ti.com
netdev/build_clang success Errors and warnings before: 937 this patch: 937
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 937 this patch: 937
netdev/checkpatch warning WARNING: Possible repeated word: 'Google'
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-04-29--15-00 (tests: 994)

Commit Message

Eric Dumazet April 26, 2024, 4:33 p.m. UTC
We must initialize prune_proxy_timer before we attempt
a del_timer_sync() on it.

syzbot reported the following splat:

INFO: trying to register non-static key.
The code is fine but needs lockdep annotation, or maybe
you didn't initialize this object before use?
turning off the locking correctness validator.
CPU: 1 PID: 11 Comm: kworker/u8:1 Not tainted 6.9.0-rc5-syzkaller-01199-gfc48de77d69d #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Workqueue: netns cleanup_net
Call Trace:
 <TASK>
  __dump_stack lib/dump_stack.c:88 [inline]
  dump_stack_lvl+0x241/0x360 lib/dump_stack.c:114
  assign_lock_key+0x238/0x270 kernel/locking/lockdep.c:976
  register_lock_class+0x1cf/0x980 kernel/locking/lockdep.c:1289
  __lock_acquire+0xda/0x1fd0 kernel/locking/lockdep.c:5014
  lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754
  __timer_delete_sync+0x148/0x310 kernel/time/timer.c:1648
  del_timer_sync include/linux/timer.h:185 [inline]
  hsr_dellink+0x33/0x80 net/hsr/hsr_netlink.c:132
  default_device_exit_batch+0x956/0xa90 net/core/dev.c:11737
  ops_exit_list net/core/net_namespace.c:175 [inline]
  cleanup_net+0x89d/0xcc0 net/core/net_namespace.c:637
  process_one_work kernel/workqueue.c:3254 [inline]
  process_scheduled_works+0xa10/0x17c0 kernel/workqueue.c:3335
  worker_thread+0x86d/0xd70 kernel/workqueue.c:3416
  kthread+0x2f0/0x390 kernel/kthread.c:388
  ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
  ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
 </TASK>
ODEBUG: assert_init not available (active state 0) object: ffff88806d3fcd88 object type: timer_list hint: 0x0
 WARNING: CPU: 1 PID: 11 at lib/debugobjects.c:517 debug_print_object+0x17a/0x1f0 lib/debugobjects.c:514

Fixes: 5055cccfc2d1 ("net: hsr: Provide RedBox support (HSR-SAN)")
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Lukasz Majewski <lukma@denx.de>
---
 net/hsr/hsr_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Simon Horman April 27, 2024, 1:16 p.m. UTC | #1
On Fri, Apr 26, 2024 at 04:33:55PM +0000, Eric Dumazet wrote:
> We must initialize prune_proxy_timer before we attempt
> a del_timer_sync() on it.
> 
> syzbot reported the following splat:
> 
> INFO: trying to register non-static key.
> The code is fine but needs lockdep annotation, or maybe
> you didn't initialize this object before use?
> turning off the locking correctness validator.
> CPU: 1 PID: 11 Comm: kworker/u8:1 Not tainted 6.9.0-rc5-syzkaller-01199-gfc48de77d69d #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
> Workqueue: netns cleanup_net
> Call Trace:
>  <TASK>
>   __dump_stack lib/dump_stack.c:88 [inline]
>   dump_stack_lvl+0x241/0x360 lib/dump_stack.c:114
>   assign_lock_key+0x238/0x270 kernel/locking/lockdep.c:976
>   register_lock_class+0x1cf/0x980 kernel/locking/lockdep.c:1289
>   __lock_acquire+0xda/0x1fd0 kernel/locking/lockdep.c:5014
>   lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754
>   __timer_delete_sync+0x148/0x310 kernel/time/timer.c:1648
>   del_timer_sync include/linux/timer.h:185 [inline]
>   hsr_dellink+0x33/0x80 net/hsr/hsr_netlink.c:132
>   default_device_exit_batch+0x956/0xa90 net/core/dev.c:11737
>   ops_exit_list net/core/net_namespace.c:175 [inline]
>   cleanup_net+0x89d/0xcc0 net/core/net_namespace.c:637
>   process_one_work kernel/workqueue.c:3254 [inline]
>   process_scheduled_works+0xa10/0x17c0 kernel/workqueue.c:3335
>   worker_thread+0x86d/0xd70 kernel/workqueue.c:3416
>   kthread+0x2f0/0x390 kernel/kthread.c:388
>   ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
>   ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
>  </TASK>
> ODEBUG: assert_init not available (active state 0) object: ffff88806d3fcd88 object type: timer_list hint: 0x0
>  WARNING: CPU: 1 PID: 11 at lib/debugobjects.c:517 debug_print_object+0x17a/0x1f0 lib/debugobjects.c:514
> 
> Fixes: 5055cccfc2d1 ("net: hsr: Provide RedBox support (HSR-SAN)")
> Reported-by: syzbot <syzkaller@googlegroups.com>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Lukasz Majewski <lukma@denx.de>

Reviewed-by: Simon Horman <horms@kernel.org>
Lukasz Majewski April 29, 2024, 8:54 a.m. UTC | #2
Hi Eric,

> We must initialize prune_proxy_timer before we attempt
> a del_timer_sync() on it.
> 
> syzbot reported the following splat:
> 
> INFO: trying to register non-static key.
> The code is fine but needs lockdep annotation, or maybe
> you didn't initialize this object before use?
> turning off the locking correctness validator.
> CPU: 1 PID: 11 Comm: kworker/u8:1 Not tainted
> 6.9.0-rc5-syzkaller-01199-gfc48de77d69d #0 Hardware name: Google
> Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
> Workqueue: netns cleanup_net Call Trace:
>  <TASK>
>   __dump_stack lib/dump_stack.c:88 [inline]
>   dump_stack_lvl+0x241/0x360 lib/dump_stack.c:114
>   assign_lock_key+0x238/0x270 kernel/locking/lockdep.c:976
>   register_lock_class+0x1cf/0x980 kernel/locking/lockdep.c:1289
>   __lock_acquire+0xda/0x1fd0 kernel/locking/lockdep.c:5014
>   lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754
>   __timer_delete_sync+0x148/0x310 kernel/time/timer.c:1648
>   del_timer_sync include/linux/timer.h:185 [inline]
>   hsr_dellink+0x33/0x80 net/hsr/hsr_netlink.c:132
>   default_device_exit_batch+0x956/0xa90 net/core/dev.c:11737
>   ops_exit_list net/core/net_namespace.c:175 [inline]
>   cleanup_net+0x89d/0xcc0 net/core/net_namespace.c:637
>   process_one_work kernel/workqueue.c:3254 [inline]
>   process_scheduled_works+0xa10/0x17c0 kernel/workqueue.c:3335
>   worker_thread+0x86d/0xd70 kernel/workqueue.c:3416
>   kthread+0x2f0/0x390 kernel/kthread.c:388
>   ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
>   ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
>  </TASK>
> ODEBUG: assert_init not available (active state 0) object:
> ffff88806d3fcd88 object type: timer_list hint: 0x0 WARNING: CPU: 1
> PID: 11 at lib/debugobjects.c:517 debug_print_object+0x17a/0x1f0
> lib/debugobjects.c:514
> 
> Fixes: 5055cccfc2d1 ("net: hsr: Provide RedBox support (HSR-SAN)")

Thanks for spotting it.

> Reported-by: syzbot <syzkaller@googlegroups.com>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Lukasz Majewski <lukma@denx.de>
> ---
>  net/hsr/hsr_device.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c
> index
> cd1e7c6d2fc03af0498dc2ce302069699a75cca7..86127300b102fe06eaced32a979e1c8da99339a7
> 100644 --- a/net/hsr/hsr_device.c +++ b/net/hsr/hsr_device.c
> @@ -592,6 +592,7 @@ int hsr_dev_finalize(struct net_device *hsr_dev,
> struct net_device *slave[2], 
>  	timer_setup(&hsr->announce_timer, hsr_announce, 0);
>  	timer_setup(&hsr->prune_timer, hsr_prune_nodes, 0);
> +	timer_setup(&hsr->prune_proxy_timer, hsr_prune_proxy_nodes,
> 0); 
>  	ether_addr_copy(hsr->sup_multicast_addr, def_multicast_addr);
>  	hsr->sup_multicast_addr[ETH_ALEN - 1] = multicast_spec;
> @@ -631,7 +632,6 @@ int hsr_dev_finalize(struct net_device *hsr_dev,
> struct net_device *slave[2], 
>  		hsr->redbox = true;
>  		ether_addr_copy(hsr->macaddress_redbox,
> interlink->dev_addr);
> -		timer_setup(&hsr->prune_proxy_timer,
> hsr_prune_proxy_nodes, 0); mod_timer(&hsr->prune_proxy_timer,
>  			  jiffies +
> msecs_to_jiffies(PRUNE_PROXY_PERIOD)); }




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
patchwork-bot+netdevbpf@kernel.org April 30, 2024, 2:20 a.m. UTC | #3
Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Fri, 26 Apr 2024 16:33:55 +0000 you wrote:
> We must initialize prune_proxy_timer before we attempt
> a del_timer_sync() on it.
> 
> syzbot reported the following splat:
> 
> INFO: trying to register non-static key.
> The code is fine but needs lockdep annotation, or maybe
> you didn't initialize this object before use?
> turning off the locking correctness validator.
> CPU: 1 PID: 11 Comm: kworker/u8:1 Not tainted 6.9.0-rc5-syzkaller-01199-gfc48de77d69d #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
> Workqueue: netns cleanup_net
> Call Trace:
>  <TASK>
>   __dump_stack lib/dump_stack.c:88 [inline]
>   dump_stack_lvl+0x241/0x360 lib/dump_stack.c:114
>   assign_lock_key+0x238/0x270 kernel/locking/lockdep.c:976
>   register_lock_class+0x1cf/0x980 kernel/locking/lockdep.c:1289
>   __lock_acquire+0xda/0x1fd0 kernel/locking/lockdep.c:5014
>   lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754
>   __timer_delete_sync+0x148/0x310 kernel/time/timer.c:1648
>   del_timer_sync include/linux/timer.h:185 [inline]
>   hsr_dellink+0x33/0x80 net/hsr/hsr_netlink.c:132
>   default_device_exit_batch+0x956/0xa90 net/core/dev.c:11737
>   ops_exit_list net/core/net_namespace.c:175 [inline]
>   cleanup_net+0x89d/0xcc0 net/core/net_namespace.c:637
>   process_one_work kernel/workqueue.c:3254 [inline]
>   process_scheduled_works+0xa10/0x17c0 kernel/workqueue.c:3335
>   worker_thread+0x86d/0xd70 kernel/workqueue.c:3416
>   kthread+0x2f0/0x390 kernel/kthread.c:388
>   ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
>   ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
>  </TASK>
> ODEBUG: assert_init not available (active state 0) object: ffff88806d3fcd88 object type: timer_list hint: 0x0
>  WARNING: CPU: 1 PID: 11 at lib/debugobjects.c:517 debug_print_object+0x17a/0x1f0 lib/debugobjects.c:514
> 
> [...]

Here is the summary with links:
  - [net-next] net: hsr: init prune_proxy_timer sooner
    https://git.kernel.org/netdev/net-next/c/3c668cef61ad

You are awesome, thank you!
diff mbox series

Patch

diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c
index cd1e7c6d2fc03af0498dc2ce302069699a75cca7..86127300b102fe06eaced32a979e1c8da99339a7 100644
--- a/net/hsr/hsr_device.c
+++ b/net/hsr/hsr_device.c
@@ -592,6 +592,7 @@  int hsr_dev_finalize(struct net_device *hsr_dev, struct net_device *slave[2],
 
 	timer_setup(&hsr->announce_timer, hsr_announce, 0);
 	timer_setup(&hsr->prune_timer, hsr_prune_nodes, 0);
+	timer_setup(&hsr->prune_proxy_timer, hsr_prune_proxy_nodes, 0);
 
 	ether_addr_copy(hsr->sup_multicast_addr, def_multicast_addr);
 	hsr->sup_multicast_addr[ETH_ALEN - 1] = multicast_spec;
@@ -631,7 +632,6 @@  int hsr_dev_finalize(struct net_device *hsr_dev, struct net_device *slave[2],
 
 		hsr->redbox = true;
 		ether_addr_copy(hsr->macaddress_redbox, interlink->dev_addr);
-		timer_setup(&hsr->prune_proxy_timer, hsr_prune_proxy_nodes, 0);
 		mod_timer(&hsr->prune_proxy_timer,
 			  jiffies + msecs_to_jiffies(PRUNE_PROXY_PERIOD));
 	}