Skip to content

Commit 430d67b

Browse files
Sebastian Andrzej Siewiorkuba-moo
authored andcommitted
net: hsr: Use the seqnr lock for frames received via interlink port.
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. 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: [email protected] Closes: https://groups.google.com/g/syzkaller-bugs/c/KppVvGviGg4/m/EItSdCZdBAAJ Fixes: 5055ccc ("net: hsr: Provide RedBox support (HSR-SAN)") Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Reviewed-by: Lukasz Majewski <[email protected]> Tested-by: Lukasz Majewski <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent a18c097 commit 430d67b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

net/hsr/hsr_slave.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,16 @@ static rx_handler_result_t hsr_handle_frame(struct sk_buff **pskb)
6767
skb_set_network_header(skb, ETH_HLEN + HSR_HLEN);
6868
skb_reset_mac_len(skb);
6969

70-
hsr_forward_skb(skb, port);
70+
/* Only the frames received over the interlink port will assign a
71+
* sequence number and require synchronisation vs other sender.
72+
*/
73+
if (port->type == HSR_PT_INTERLINK) {
74+
spin_lock_bh(&hsr->seqnr_lock);
75+
hsr_forward_skb(skb, port);
76+
spin_unlock_bh(&hsr->seqnr_lock);
77+
} else {
78+
hsr_forward_skb(skb, port);
79+
}
7180

7281
finish_consume:
7382
return RX_HANDLER_CONSUMED;

0 commit comments

Comments
 (0)