From: Ben Pfaff Date: Wed, 23 Apr 2008 19:24:32 +0000 (-0700) Subject: Handle memory allocation failure in dp_output_control(). X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=800a8d91cb0d755a4c52ae1c74e37937ad2d77e0;p=openvswitch Handle memory allocation failure in dp_output_control(). Possible fix for bug observed on OF6k. --- diff --git a/datapath/datapath.c b/datapath/datapath.c index 054c47e5..8a399fbe 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -594,6 +594,10 @@ dp_output_control(struct datapath *dp, struct sk_buff *skb, opi_len = offsetof(struct ofp_packet_in, data) + fwd_len; opi = alloc_openflow_skb(dp, opi_len, OFPT_PACKET_IN, NULL, &f_skb); + if (!opi) { + err = -ENOMEM; + goto out; + } opi->buffer_id = htonl(buffer_id); opi->total_len = htons(skb->len); opi->in_port = htons(skb->dev->br_port->port_no); @@ -602,8 +606,8 @@ dp_output_control(struct datapath *dp, struct sk_buff *skb, memcpy(opi->data, skb_mac_header(skb), fwd_len); err = send_openflow_skb(f_skb, NULL); +out: kfree_skb(skb); - return err; }