Skip to content

Commit

Permalink
net/memif: fix segfault with Tx burst larger than 255
Browse files Browse the repository at this point in the history
There will be a segfault when tx burst size is larger than 256.
This is because eth_memif_tx uses an index i which is uint8_t to count
transmitted nb_pkts.
Extend i to uint16_t, the same size as nb_pkts.

Fixes: b5613c8 ("net/memif: add a Tx fast path")
Cc: [email protected]

Reported-by: Liangxing Wang <[email protected]>
Signed-off-by: Joyce Kong <[email protected]>
Reviewed-by: Ruifeng Wang <[email protected]>
Reviewed-by: Stephen Hemminger <[email protected]>
Acked-by: Ferruh Yigit <[email protected]>
  • Loading branch information
JoyceKong-Arm authored and ferruhy committed Dec 6, 2023
1 parent e92bb0c commit fefa309
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,7 @@ Lewei Yang <[email protected]>
Leyi Rong <[email protected]>
Liang Ma <[email protected]> <[email protected]> <[email protected]>
Liang-Min Larry Wang <[email protected]>
Liangxing Wang <[email protected]>
Liang Xu <[email protected]>
Liang Zhang <[email protected]>
Li Feng <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/memif/rte_eth_memif.c
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ eth_memif_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
n_free = __atomic_load_n(&ring->head, __ATOMIC_ACQUIRE) - slot;
}

uint8_t i;
uint16_t i;
struct rte_mbuf **buf_tmp = bufs;
mbuf_head = *buf_tmp++;
struct rte_mempool *mp = mbuf_head->pool;
Expand Down

0 comments on commit fefa309

Please sign in to comment.