Don't oops in dp_output_control() for skbs with null ->dev.
authorBen Pfaff <blp@nicira.com>
Tue, 11 Nov 2008 02:26:25 +0000 (18:26 -0800)
committerBen Pfaff <blp@nicira.com>
Thu, 13 Nov 2008 20:44:04 +0000 (12:44 -0800)
This shouldn't ordinarily happen, since normal packets are received from
a real device, but some packets can be spontaneously generated within
the switch and thus have null ->dev.  (Possibly that is itself a bug
that we should track down; not sure.)

datapath/datapath.c

index e9d51a8d5b907aecea0d64729b4f76c2bb96b005..d4f332ee981511fb595d3ef6e623078987827ad6 100644 (file)
@@ -670,7 +670,6 @@ dp_output_control(struct datapath *dp, struct sk_buff *skb,
         * forward the whole packet? */
        struct sk_buff *f_skb;
        struct ofp_packet_in *opi;
-       struct net_bridge_port *p;
        size_t fwd_len, opi_len;
        int err;
 
@@ -686,8 +685,9 @@ dp_output_control(struct datapath *dp, struct sk_buff *skb,
        }
        opi->buffer_id      = htonl(buffer_id);
        opi->total_len      = htons(skb->len);
-       p = skb->dev->br_port;
-       opi->in_port        = htons(p ? p->port_no : OFPP_LOCAL);
+       opi->in_port        = htons(skb->dev && skb->dev->br_port
+                                   ? skb->dev->br_port->port_no
+                                   : OFPP_LOCAL);
        opi->reason         = reason;
        opi->pad            = 0;
        memcpy(opi->data, skb_mac_header(skb), fwd_len);