The mbuf pool passed when setting up queue must have space
in the mbuf to hold the requested packet size; otherwise the
code in eth_null_copy_rx() would generate invalid mbuf.
Fixes: c743e50c475f ("null: new poll mode driver")
Cc: [email protected]
Signed-off-by: Stephen Hemminger <[email protected]>
---
drivers/net/null/rte_eth_null.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index 4496c093a7..4b4d996686 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -241,6 +241,9 @@ eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t
rx_queue_id,
packet_size = internals->packet_size;
+ if (rte_pktmbuf_data_room_size(mb_pool) < packet_size)
+ return -ENOSPC;
+
internals->rx_null_queues[rx_queue_id].mb_pool = mb_pool;
dev->data->rx_queues[rx_queue_id] =
&internals->rx_null_queues[rx_queue_id];
--
2.51.0