From: Vincenzo Maffione Date: Sat, 12 Apr 2014 09:55:40 +0000 (+0200) Subject: drivers: net: xen-netfront: fix array initialization bug X-Git-Tag: v3.15-rc1~8^2~1 X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=810d8cedcc880dca8b64e05fe1331ab5d4f8d992;p=pandora-kernel.git drivers: net: xen-netfront: fix array initialization bug This patch fixes the initialization of an array used in the TX datapath that was mistakenly initialized together with the RX datapath arrays. An out of range array access could happen when RX and TX rings had different sizes. Signed-off-by: Vincenzo Maffione Signed-off-by: David S. Miller --- diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index 057b05700f8b..158b5e639fc7 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c @@ -1291,13 +1291,13 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev) for (i = 0; i < NET_TX_RING_SIZE; i++) { skb_entry_set_link(&np->tx_skbs[i], i+1); np->grant_tx_ref[i] = GRANT_INVALID_REF; + np->grant_tx_page[i] = NULL; } /* Clear out rx_skbs */ for (i = 0; i < NET_RX_RING_SIZE; i++) { np->rx_skbs[i] = NULL; np->grant_rx_ref[i] = GRANT_INVALID_REF; - np->grant_tx_page[i] = NULL; } /* A grant for every tx ring slot */