Skip to content

Commit 087892d

Browse files
Mintz, Yuvaldavem330
authored andcommitted
qede: Fix out-of-bound fastpath memory access
Driver allocates a shadow array for transmitted SKBs with X entries; That means valid indices are {0,...,X - 1}. [X == 8191] Problem is the driver also uses X as a mask for a producer/consumer in order to choose the right entry in the array which allows access to entry X which is out of bounds. To fix this, simply allocate X + 1 entries in the shadow array. Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 3034783 commit 087892d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/net/ethernet/qlogic/qede/qede_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2940,7 +2940,7 @@ static int qede_alloc_mem_txq(struct qede_dev *edev, struct qede_tx_queue *txq)
29402940
txq->num_tx_buffers = edev->q_num_tx_buffers;
29412941

29422942
/* Allocate the parallel driver ring for Tx buffers */
2943-
size = sizeof(*txq->sw_tx_ring) * NUM_TX_BDS_MAX;
2943+
size = sizeof(*txq->sw_tx_ring) * TX_RING_SIZE;
29442944
txq->sw_tx_ring = kzalloc(size, GFP_KERNEL);
29452945
if (!txq->sw_tx_ring) {
29462946
DP_NOTICE(edev, "Tx buffers ring allocation failed\n");
@@ -2951,7 +2951,7 @@ static int qede_alloc_mem_txq(struct qede_dev *edev, struct qede_tx_queue *txq)
29512951
QED_CHAIN_USE_TO_CONSUME_PRODUCE,
29522952
QED_CHAIN_MODE_PBL,
29532953
QED_CHAIN_CNT_TYPE_U16,
2954-
NUM_TX_BDS_MAX,
2954+
TX_RING_SIZE,
29552955
sizeof(*p_virt), &txq->tx_pbl);
29562956
if (rc)
29572957
goto err;

0 commit comments

Comments
 (0)