netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: hsr: remove WARN_ONCE() in send_hsr_supervision_frame()
@ 2024-01-24 10:21 Nikita Zhandarovich
  2024-01-29 11:30 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Nikita Zhandarovich @ 2024-01-24 10:21 UTC (permalink / raw)
  To: David S. Miller
  Cc: Nikita Zhandarovich, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Ravi Gunasekaran, Simon Horman, Wojciech Drewek, Murali Karicheri,
	netdev, linux-kernel, lvc-project, syzbot+3ae0a3f42c84074b7c8e

Syzkaller reported [1] hitting a warning after failing to allocate
resources for skb in hsr_init_skb(). Since a WARN_ONCE() call will
not help much in this case, it might be prudent to switch to
netdev_warn_once(). At the very least it will suppress syzkaller
reports such as [1].

Just in case, use netdev_warn_once() in send_prp_supervision_frame()
for similar reasons.

[1]
HSR: Could not send supervision frame
WARNING: CPU: 1 PID: 85 at net/hsr/hsr_device.c:294 send_hsr_supervision_frame+0x60a/0x810 net/hsr/hsr_device.c:294
RIP: 0010:send_hsr_supervision_frame+0x60a/0x810 net/hsr/hsr_device.c:294
...
Call Trace:
 <IRQ>
 hsr_announce+0x114/0x370 net/hsr/hsr_device.c:382
 call_timer_fn+0x193/0x590 kernel/time/timer.c:1700
 expire_timers kernel/time/timer.c:1751 [inline]
 __run_timers+0x764/0xb20 kernel/time/timer.c:2022
 run_timer_softirq+0x58/0xd0 kernel/time/timer.c:2035
 __do_softirq+0x21a/0x8de kernel/softirq.c:553
 invoke_softirq kernel/softirq.c:427 [inline]
 __irq_exit_rcu kernel/softirq.c:632 [inline]
 irq_exit_rcu+0xb7/0x120 kernel/softirq.c:644
 sysvec_apic_timer_interrupt+0x95/0xb0 arch/x86/kernel/apic/apic.c:1076
 </IRQ>
 <TASK>
 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:649
...

This issue is also found in older kernels (at least up to 5.10).

Cc: stable@vger.kernel.org
Reported-by: syzbot+3ae0a3f42c84074b7c8e@syzkaller.appspotmail.com
Fixes: 121c33b07b31 ("net: hsr: introduce common code for skb initialization")
Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
---
 net/hsr/hsr_device.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c
index 7ceb9ac6e730..9d71b66183da 100644
--- a/net/hsr/hsr_device.c
+++ b/net/hsr/hsr_device.c
@@ -308,7 +308,7 @@ static void send_hsr_supervision_frame(struct hsr_port *master,
 
 	skb = hsr_init_skb(master);
 	if (!skb) {
-		WARN_ONCE(1, "HSR: Could not send supervision frame\n");
+		netdev_warn_once(master->dev, "HSR: Could not send supervision frame\n");
 		return;
 	}
 
@@ -355,7 +355,7 @@ static void send_prp_supervision_frame(struct hsr_port *master,
 
 	skb = hsr_init_skb(master);
 	if (!skb) {
-		WARN_ONCE(1, "PRP: Could not send supervision frame\n");
+		netdev_warn_once(master->dev, "PRP: Could not send supervision frame\n");
 		return;
 	}
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] net: hsr: remove WARN_ONCE() in send_hsr_supervision_frame()
  2024-01-24 10:21 [PATCH net] net: hsr: remove WARN_ONCE() in send_hsr_supervision_frame() Nikita Zhandarovich
@ 2024-01-29 11:30 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-01-29 11:30 UTC (permalink / raw)
  To: Nikita Zhandarovich
  Cc: davem, edumazet, kuba, pabeni, r-gunasekaran, horms,
	wojciech.drewek, m-karicheri2, netdev, linux-kernel, lvc-project,
	syzbot+3ae0a3f42c84074b7c8e

Hello:

This patch was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:

On Wed, 24 Jan 2024 02:21:47 -0800 you wrote:
> Syzkaller reported [1] hitting a warning after failing to allocate
> resources for skb in hsr_init_skb(). Since a WARN_ONCE() call will
> not help much in this case, it might be prudent to switch to
> netdev_warn_once(). At the very least it will suppress syzkaller
> reports such as [1].
> 
> Just in case, use netdev_warn_once() in send_prp_supervision_frame()
> for similar reasons.
> 
> [...]

Here is the summary with links:
  - [net] net: hsr: remove WARN_ONCE() in send_hsr_supervision_frame()
    https://git.kernel.org/netdev/net/c/37e8c97e5390

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-01-29 11:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-24 10:21 [PATCH net] net: hsr: remove WARN_ONCE() in send_hsr_supervision_frame() Nikita Zhandarovich
2024-01-29 11:30 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).