From: Jesse Gross Date: Mon, 13 May 2013 15:27:21 +0000 (-0700) Subject: datapath: Check for positive packet length in vport_send(). X-Git-Tag: sliver-openvswitch-1.10.90-3~6^2~255 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=6f7b24e3240178fa6916ef534f127fd252ffdd9b;p=sliver-openvswitch.git datapath: Check for positive packet length in vport_send(). When sending a packet, a positive length indicates success and a negative length indicates failure. However, the check for success looked for non-zero values which catches both of these cases. This can result in incorrect stats and leak memory on failure. Introduced by commit be7cd27e44258bdb3c4e7dd8fd7389b5db56d55a (datapath: Unify vport error stats handling.). CC: Pravin B Shelar Signed-off-by: Jesse Gross Acked-by: Kyle Mestery --- diff --git a/datapath/vport.c b/datapath/vport.c index 93ab2b5f7..745ffe446 100644 --- a/datapath/vport.c +++ b/datapath/vport.c @@ -382,7 +382,7 @@ int ovs_vport_send(struct vport *vport, struct sk_buff *skb) { int sent = vport->ops->send(vport, skb); - if (likely(sent)) { + if (likely(sent > 0)) { struct pcpu_tstats *stats; stats = this_cpu_ptr(vport->percpu_stats);