]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - net/bridge/br_stp_bpdu.c
bridge: fix RCU races with bridge port
[net-next-2.6.git] / net / bridge / br_stp_bpdu.c
index 35cf27087b561d6e9955fd75b4b03213a6e9e8d8..3d9a55d3822f0605eb333b22101833723cdd61d7 100644 (file)
@@ -141,10 +141,6 @@ void br_stp_rcv(const struct stp_proto *proto, struct sk_buff *skb,
        struct net_bridge *br;
        const unsigned char *buf;
 
-       if (!br_port_exists(dev))
-               goto err;
-       p = br_port_get_rcu(dev);
-
        if (!pskb_may_pull(skb, 4))
                goto err;
 
@@ -153,6 +149,10 @@ void br_stp_rcv(const struct stp_proto *proto, struct sk_buff *skb,
        if (buf[0] != 0 || buf[1] != 0 || buf[2] != 0)
                goto err;
 
+       p = br_port_get_rcu(dev);
+       if (!p)
+               goto err;
+
        br = p->br;
        spin_lock(&br->lock);