6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Eric Dumazet <[email protected]>

[ Upstream commit ac704ff08e511c87643799c385f55ecd69b85e03 ]

If llc_mac_hdr_init() fails (for instance if the port device type does
not support LLC or dev_hard_header() fails), br_send_bpdu() should drop
the skb instead of resetting the mac header to the LLC payload and
transmitting a malformed frame.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Closes: 
https://lore.kernel.org/netdev/[email protected]/
Cc: Nikolay Aleksandrov <[email protected]>
Cc: Ido Schimmel <[email protected]>
Cc: [email protected]
Signed-off-by: Eric Dumazet <[email protected]>
Acked-by: Nikolay Aleksandrov <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
---
 net/bridge/br_stp_bpdu.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/bridge/br_stp_bpdu.c b/net/bridge/br_stp_bpdu.c
index 7895489ac6fe7..e44e448b1157b 100644
--- a/net/bridge/br_stp_bpdu.c
+++ b/net/bridge/br_stp_bpdu.c
@@ -52,7 +52,10 @@ static void br_send_bpdu(struct net_bridge_port *p,
                            LLC_SAP_BSPAN, LLC_PDU_CMD);
        llc_pdu_init_as_ui_cmd(skb);
 
-       llc_mac_hdr_init(skb, p->dev->dev_addr, p->br->group_addr);
+       if (llc_mac_hdr_init(skb, p->dev->dev_addr, p->br->group_addr)) {
+               kfree_skb(skb);
+               return;
+       }
 
        skb_reset_mac_header(skb);
 
-- 
2.53.0




Reply via email to