Skip to content

Commit

Permalink
tg3: fix ring init when there are more TX than RX channels
Browse files Browse the repository at this point in the history
[ Upstream commit a620a6b ]

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 <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
Thadeu Lima de Souza Cascardo authored and gregkh committed Dec 16, 2014
1 parent 1ea1f33 commit dfe35fa
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/ethernet/broadcom/tg3.c
Original file line number Diff line number Diff line change
Expand Up @@ -8548,7 +8548,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;
}
Expand Down

0 comments on commit dfe35fa

Please sign in to comment.