[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [linux-2.6.18-xen] netback: fix netbk_count_requests()


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-linux-2.6.18-xen <patchbot@xxxxxxx>
  • Date: Fri, 15 Feb 2013 08:55:04 +0000
  • Delivery-date: Fri, 15 Feb 2013 08:55:15 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Wei Liu <wei.liu2@xxxxxxxxxx>
# Date 1360918293 -3600
# Node ID a56b12b91c25fc922ce7eee18fb4576b23e5fdb6
# Parent  d732224ce60e45cc43337be0061a20f8ed65e03e
netback: fix netbk_count_requests()

There are two paths in the original code, a) test against work_to_do, b) test
against first->size, could return 0 even when error happens.

Simply return -1 in error paths should work. Modify all error paths to return
-1 to be consistent.

Reported-by: Christopher S. Aker <caker@xxxxxxxxxxxx>
Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>

Use distinct -E... values instead.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Committed-by: Jan Beulich <jbeulich@xxxxxxxx>
---


diff -r d732224ce60e -r a56b12b91c25 drivers/xen/netback/netback.c
--- a/drivers/xen/netback/netback.c     Tue Feb 05 10:26:53 2013 +0100
+++ b/drivers/xen/netback/netback.c     Fri Feb 15 09:51:33 2013 +0100
@@ -1042,14 +1042,14 @@ static int netbk_count_requests(netif_t 
                        printk(KERN_ERR "%s: Need more frags\n",
                               netif->dev->name);
                        netbk_fatal_tx_err(netif);
-                       return -frags;
+                       return -ENODATA;
                }
 
                if (unlikely(frags >= MAX_SKB_FRAGS)) {
                        printk(KERN_ERR "%s: Too many frags\n",
                               netif->dev->name);
                        netbk_fatal_tx_err(netif);
-                       return -frags;
+                       return -E2BIG;
                }
 
                memcpy(txp, RING_GET_REQUEST(&netif->tx, cons + frags),
@@ -1058,7 +1058,7 @@ static int netbk_count_requests(netif_t 
                        printk(KERN_ERR "%s: Frag is bigger than frame.\n",
                               netif->dev->name);
                        netbk_fatal_tx_err(netif);
-                       return -frags;
+                       return -EIO;
                }
 
                first->size -= txp->size;
@@ -1068,7 +1068,7 @@ static int netbk_count_requests(netif_t 
                        printk(KERN_ERR "%s: txp->offset: %x, size: %u\n",
                               netif->dev->name, txp->offset, txp->size);
                        netbk_fatal_tx_err(netif);
-                       return -frags;
+                       return -EINVAL;
                }
        } while ((txp++)->flags & NETTXF_more_data);
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.