netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lukasz Majewski <lukma@denx.de>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: netdev@vger.kernel.org, Thomas Gleixner <tglx@linutronix.de>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	syzbot+3d602af7549af539274e@syzkaller.appspotmail.com
Subject: Re: [PATCH net 1/2] net: hsr: Use the seqnr lock for frames received via interlink port.
Date: Mon, 9 Sep 2024 11:49:48 +0200	[thread overview]
Message-ID: <20240909114948.129735b9@wsk> (raw)
In-Reply-To: <20240906132816.657485-2-bigeasy@linutronix.de>

[-- Attachment #1: Type: text/plain, Size: 2350 bytes --]

Hi Sebastian,

> syzbot reported that the seqnr_lock is not acquire for frames received
> over the interlink port. In the interlink case a new seqnr is
> generated and assigned to the frame.

Yes, correct.

The seq number for frames incomming from HSR ring are extracted from
the HSR header.

For frames going from interlink (SAN) network to RedBox, the start seq
number is assigned when node is created (and the creation node code is
reused).

> Frames, which are received over the slave port have already a sequence
> number assigned so the lock is not required.
> 
> Acquire the hsr_priv::seqnr_lock during in the invocation of
> hsr_forward_skb() if a packet has been received from the interlink
> port.
> 
> Reported-by: syzbot+3d602af7549af539274e@syzkaller.appspotmail.com
> Closes:
> https://groups.google.com/g/syzkaller-bugs/c/KppVvGviGg4/m/EItSdCZdBAAJ
> Fixes: 5055cccfc2d1c ("net: hsr: Provide RedBox support (HSR-SAN)")
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> ---
>  net/hsr/hsr_slave.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/net/hsr/hsr_slave.c b/net/hsr/hsr_slave.c
> index af6cf64a00e08..464f683e016db 100644
> --- a/net/hsr/hsr_slave.c
> +++ b/net/hsr/hsr_slave.c
> @@ -67,7 +67,16 @@ 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);
>  
> -	hsr_forward_skb(skb, port);
> +	/* Only the frames received over the interlink port will
> assign a
> +	 * sequence number and require synchronisation vs other
> sender.
> +	 */
> +	if (port->type == HSR_PT_INTERLINK) {
> +		spin_lock_bh(&hsr->seqnr_lock);

I'm just wondering if this could have impact on offloaded HSR operation.

I will try to run hsr_redbox.sh test on this patch (with QEMU) and
share results.

> +		hsr_forward_skb(skb, port);
> +		spin_unlock_bh(&hsr->seqnr_lock);
> +	} else {
> +		hsr_forward_skb(skb, port);
> +	}
>  
>  finish_consume:
>  	return RX_HANDLER_CONSUMED;




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

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2024-09-09  9:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-06 13:25 [PATCH net 0/2] net: hsr: Use the seqnr lock for frames received via interlink port Sebastian Andrzej Siewior
2024-09-06 13:25 ` [PATCH net 1/2] " Sebastian Andrzej Siewior
2024-09-09  9:49   ` Lukasz Majewski [this message]
2024-09-10 23:25     ` Jakub Kicinski
2024-09-11  7:54       ` Lukasz Majewski
2024-09-11 15:46   ` Lukasz Majewski
2024-09-06 13:25 ` [PATCH net-next 2/2] net: hsr: Remove interlink_sequence_nr Sebastian Andrzej Siewior
2024-09-09  9:43   ` Lukasz Majewski
2024-09-11 22:53 ` [PATCH net 0/2] net: hsr: Use the seqnr lock for frames received via interlink port Jakub Kicinski
2024-09-12  6:51   ` Sebastian Andrzej Siewior
2024-09-13  0:14     ` Jakub Kicinski
2024-09-13  6:43       ` Sebastian Andrzej Siewior
2024-09-11 23:20 ` patchwork-bot+netdevbpf

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=20240909114948.129735b9@wsk \
    --to=lukma@denx.de \
    --cc=bigeasy@linutronix.de \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=syzbot+3d602af7549af539274e@syzkaller.appspotmail.com \
    --cc=tglx@linutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).