The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: syzbot <syzbot+3d602af7549af539274e@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [syzbot] Re: [syzbot] [net?] WARNING in hsr_fill_frame_info
Date: Thu, 29 Aug 2024 20:12:20 -0700	[thread overview]
Message-ID: <00000000000091e02f0620ddf5cf@google.com> (raw)
In-Reply-To: <000000000000be46510620da5362@google.com>

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: Re: [syzbot] [net?] WARNING in hsr_fill_frame_info
Author: lizhi.xu@windriver.com

missing lock before call hsr_forward_skb

#syz test

diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c
index e4cc6b78dcfc..32b43bd9f542 100644
--- a/net/hsr/hsr_device.c
+++ b/net/hsr/hsr_device.c
@@ -405,11 +405,15 @@ static void hsr_announce(struct timer_list *t)
 
 	rcu_read_lock();
 	master = hsr_port_get_hsr(hsr, HSR_PT_MASTER);
+	if (!master)
+		goto out;
+
 	hsr->proto_ops->send_sv_frame(master, &interval, master->dev->dev_addr);
 
 	if (is_admin_up(master->dev))
 		mod_timer(&hsr->announce_timer, jiffies + interval);
 
+out:
 	rcu_read_unlock();
 }
 
@@ -427,6 +431,9 @@ static void hsr_proxy_announce(struct timer_list *t)
 	 * of SAN nodes stored in ProxyNodeTable.
 	 */
 	interlink = hsr_port_get_hsr(hsr, HSR_PT_INTERLINK);
+	if (!interlink)
+		goto out;
+
 	list_for_each_entry_rcu(node, &hsr->proxy_node_db, mac_list) {
 		if (hsr_addr_is_redbox(hsr, node->macaddress_A))
 			continue;
@@ -440,6 +447,7 @@ static void hsr_proxy_announce(struct timer_list *t)
 
 		mod_timer(&hsr->announce_proxy_timer, jiffies + interval);
 	}
+out:
 
 	rcu_read_unlock();
 }
diff --git a/net/hsr/hsr_slave.c b/net/hsr/hsr_slave.c
index af6cf64a00e0..3971dbc0644a 100644
--- a/net/hsr/hsr_slave.c
+++ b/net/hsr/hsr_slave.c
@@ -67,7 +67,9 @@ static rx_handler_result_t hsr_handle_frame(struct sk_buff **pskb)
 		skb_set_network_header(skb, ETH_HLEN + HSR_HLEN);
 	skb_reset_mac_len(skb);
 
+	spin_lock_bh(&hsr->seqnr_lock);
 	hsr_forward_skb(skb, port);
+	spin_unlock_bh(&hsr->seqnr_lock);
 
 finish_consume:
 	return RX_HANDLER_CONSUMED;

      parent reply	other threads:[~2024-08-30  3:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-29 22:52 [syzbot] [net?] WARNING in hsr_fill_frame_info syzbot
2024-08-30  1:51 ` [syzbot] " syzbot
2024-08-30  3:12 ` syzbot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=00000000000091e02f0620ddf5cf@google.com \
    --to=syzbot+3d602af7549af539274e@syzkaller.appspotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox