From: Jesse Gross Date: Mon, 19 Sep 2011 23:23:25 +0000 (-0700) Subject: datapath: Correctly set error code in queue_userspace_packets(). X-Git-Tag: v1.2.2~6 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=a09ee517a1239c96d357e2dd9facb3e71deadd9c;p=sliver-openvswitch.git datapath: Correctly set error code in queue_userspace_packets(). In a few places in queue_userspace_packets() when we encounter an error, we don't actually set the 'err' variable. Although we free the packets we don't correctly account for these packets as being lost. Signed-off-by: Jesse Gross Acked-by: Ben Pfaff --- diff --git a/datapath/datapath.c b/datapath/datapath.c index ccdcb754d..b5e90197b 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -458,8 +458,10 @@ static int queue_userspace_packets(struct datapath *dp, struct sk_buff *skb, if (unlikely(err)) goto err_kfree_skbs; - if (nla_attr_size(skb->len) > USHRT_MAX) + if (nla_attr_size(skb->len) > USHRT_MAX) { + err = -EFBIG; goto err_kfree_skbs; + } len = sizeof(struct odp_header); len += nla_total_size(skb->len); @@ -474,6 +476,7 @@ static int queue_userspace_packets(struct datapath *dp, struct sk_buff *skb, user_skb = genlmsg_new(len, GFP_ATOMIC); if (!user_skb) { netlink_set_err(INIT_NET_GENL_SOCK, 0, group, -ENOBUFS); + err = -ENOMEM; goto err_kfree_skbs; }