]> git.itanic.dy.fi Git - linux-stable/commitdiff
netxen: Correct off-by-one errors in bounds checks
authorDavid Gibson <david@gibson.dropbear.id.au>
Fri, 20 Dec 2013 04:10:44 +0000 (15:10 +1100)
committerJiri Slaby <jslaby@suse.cz>
Tue, 26 Aug 2014 12:12:19 +0000 (14:12 +0200)
commit 4710b2ba873692194c636811ceda398f95e02db2 upstream.

netxen_process_lro() contains two bounds checks.  One for the ring number
against the number of rings, and one for the Rx buffer ID against the
array of receive buffers.

Both of these have off-by-one errors, using > instead of >=. The correct
versions are used in netxen_process_rcv(), they're just wrong in
netxen_process_lro().

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c

index 7692dfd4f262db9045f285aadc194c1713fb724a..cc68657f05368d5642b62091bc6dbec1bc00bd1c 100644 (file)
@@ -1604,13 +1604,13 @@ netxen_process_lro(struct netxen_adapter *adapter,
        u32 seq_number;
        u8 vhdr_len = 0;
 
-       if (unlikely(ring > adapter->max_rds_rings))
+       if (unlikely(ring >= adapter->max_rds_rings))
                return NULL;
 
        rds_ring = &recv_ctx->rds_rings[ring];
 
        index = netxen_get_lro_sts_refhandle(sts_data0);
-       if (unlikely(index > rds_ring->num_desc))
+       if (unlikely(index >= rds_ring->num_desc))
                return NULL;
 
        buffer = &rds_ring->rx_buf_arr[index];