From: Ben Pfaff Date: Tue, 11 Nov 2008 02:26:25 +0000 (-0800) Subject: Don't oops in dp_output_control() for skbs with null ->dev. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=42841a1a873741d90db9892d7cf94147465081ef;p=openvswitch Don't oops in dp_output_control() for skbs with null ->dev. 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.) --- diff --git a/datapath/datapath.c b/datapath/datapath.c index e9d51a8d..d4f332ee 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -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);