Skip to content

Commit 810d8ce

Browse files
vmaffionedavem330
authored andcommitted
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 <v.maffione@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent dcfba94 commit 810d8ce

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/xen-netfront.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1291,13 +1291,13 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev)
12911291
for (i = 0; i < NET_TX_RING_SIZE; i++) {
12921292
skb_entry_set_link(&np->tx_skbs[i], i+1);
12931293
np->grant_tx_ref[i] = GRANT_INVALID_REF;
1294+
np->grant_tx_page[i] = NULL;
12941295
}
12951296

12961297
/* Clear out rx_skbs */
12971298
for (i = 0; i < NET_RX_RING_SIZE; i++) {
12981299
np->rx_skbs[i] = NULL;
12991300
np->grant_rx_ref[i] = GRANT_INVALID_REF;
1300-
np->grant_tx_page[i] = NULL;
13011301
}
13021302

13031303
/* A grant for every tx ring slot */

0 commit comments

Comments
 (0)