Commit eb930c4a authored by Thadeu Lima de Souza Cascardo's avatar Thadeu Lima de Souza Cascardo Committed by Luis Henriques

tg3: fix ring init when there are more TX than RX channels

commit a620a6bc upstream.

If TX channels are set to 4 and RX channels are set to less than 4,
using ethtool -L, the driver will try to initialize more RX channels
than it has allocated, causing an oops.

This fix only initializes the RX ring if it has been allocated.
Signed-off-by: default avatarThadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent a5010b14
...@@ -8561,7 +8561,8 @@ static int tg3_init_rings(struct tg3 *tp) ...@@ -8561,7 +8561,8 @@ static int tg3_init_rings(struct tg3 *tp)
if (tnapi->rx_rcb) if (tnapi->rx_rcb)
memset(tnapi->rx_rcb, 0, TG3_RX_RCB_RING_BYTES(tp)); memset(tnapi->rx_rcb, 0, TG3_RX_RCB_RING_BYTES(tp));
if (tg3_rx_prodring_alloc(tp, &tnapi->prodring)) { if (tnapi->prodring.rx_std &&
tg3_rx_prodring_alloc(tp, &tnapi->prodring)) {
tg3_free_rings(tp); tg3_free_rings(tp);
return -ENOMEM; return -ENOMEM;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment