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]>
---
 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 
74ec42ba1e7d086cbfde608c93f5fa24d6b4ed7b..21d092f5acbb81f1d0ccd80200cebdbda722f4bf
 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.56.0.rc1.310.g51773c2048-goog


Reply via email to