diff options
author | Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com> | 2014-11-25 17:21:11 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-11-25 21:18:45 +0100 |
commit | a620a6bc1c94c22d6c312892be1e0ae171523125 (patch) | |
tree | 31093d51e496a0cc052c73a4f57e3141bd233d96 /drivers/net/ethernet/broadcom/tg3.c | |
parent | tcp: fix possible NULL dereference in tcp_vX_send_reset() (diff) | |
download | linux-a620a6bc1c94c22d6c312892be1e0ae171523125.tar.xz linux-a620a6bc1c94c22d6c312892be1e0ae171523125.zip |
tg3: fix ring init when there are more TX than RX channels
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: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/broadcom/tg3.c')
-rw-r--r-- | drivers/net/ethernet/broadcom/tg3.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index dbb41c1923e6..77f8f836cbbe 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c @@ -8563,7 +8563,8 @@ static int tg3_init_rings(struct tg3 *tp) if (tnapi->rx_rcb) 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); return -ENOMEM; } |