net: bridge: stp: don’t cache eth dest pointer before skb pull [Linux 4.4.187]

This Linux kernel change "net: bridge: stp: don’t cache eth dest pointer before skb pull" is included in the Linux 4.4.187 release. This change is authored by Nikolay Aleksandrov <nikolay [at] cumulusnetworks.com> on Tue Jul 2 15:00:21 2019 +0300. The commit for this change in Linux stable tree is 3941d33 (patch) which is from upstream commit 2446a68. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream 2446a68.

net: bridge: stp: don't cache eth dest pointer before skb pull

[ Upstream commit 2446a68ae6a8cee6d480e2f5b52f5007c7c41312 ]

Don't cache eth dest pointer before calling pskb_may_pull.

Fixes: cf0f02d04a83 ("[BRIDGE]: use llc for receiving STP packets")
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

There are 3 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 net/bridge/br_stp_bpdu.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/bridge/br_stp_bpdu.c b/net/bridge/br_stp_bpdu.c
index 5881fbc..36282eb 100644
--- a/net/bridge/br_stp_bpdu.c
+++ b/net/bridge/br_stp_bpdu.c
@@ -147,7 +147,6 @@ void br_send_tcn_bpdu(struct net_bridge_port *p)
 void br_stp_rcv(const struct stp_proto *proto, struct sk_buff *skb,
        struct net_device *dev)
 {
-   const unsigned char *dest = eth_hdr(skb)->h_dest;
    struct net_bridge_port *p;
    struct net_bridge *br;
    const unsigned char *buf;
@@ -176,7 +175,7 @@ void br_stp_rcv(const struct stp_proto *proto, struct sk_buff *skb,
    if (p->state == BR_STATE_DISABLED)
        goto out;

-   if (!ether_addr_equal(dest, br->group_addr))
+   if (!ether_addr_equal(eth_hdr(skb)->h_dest, br->group_addr))
        goto out;

    if (p->flags & BR_BPDU_GUARD) {

Leave a Reply

Your email address will not be published. Required fields are marked *