Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm...
[cascardo/linux.git] / net / dsa / tag_edsa.c
index 2288c80..6c1720e 100644 (file)
@@ -120,10 +120,14 @@ static int edsa_rcv(struct sk_buff *skb, struct net_device *dev,
         * Check that the source device exists and that the source
         * port is a registered DSA port.
         */
-       if (source_device >= dst->pd->nr_chips)
+       if (source_device >= DSA_MAX_SWITCHES)
                goto out_drop;
+
        ds = dst->ds[source_device];
-       if (source_port >= DSA_MAX_PORTS || ds->ports[source_port] == NULL)
+       if (!ds)
+               goto out_drop;
+
+       if (source_port >= DSA_MAX_PORTS || !ds->ports[source_port].netdev)
                goto out_drop;
 
        /*
@@ -178,7 +182,7 @@ static int edsa_rcv(struct sk_buff *skb, struct net_device *dev,
                        2 * ETH_ALEN);
        }
 
-       skb->dev = ds->ports[source_port];
+       skb->dev = ds->ports[source_port].netdev;
        skb_push(skb, ETH_HLEN);
        skb->pkt_type = PACKET_HOST;
        skb->protocol = eth_type_trans(skb, skb->dev);