* [dpdk-dev] [PATCH] ethdev: add a check on mempool during rxq setup
@ 2019-05-17 8:15 David Marchand
2019-05-17 11:11 ` Jens Freimann
2019-06-05 16:46 ` Andrew Rybchenko
0 siblings, 2 replies; 4+ messages in thread
From: David Marchand @ 2019-05-17 8:15 UTC (permalink / raw)
To: dev; +Cc: jfreimann, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko
We currently have no check on the mempool pointer passed to
rte_eth_rx_queue_setup.
Let's avoid a plain crash when dereferencing it.
Suggested-by: Jens Freimann <jfreimann@redhat.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
lib/librte_ethdev/rte_ethdev.c | 5 +++++
lib/librte_ethdev/rte_ethdev.h | 6 +++---
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index d7cfa3d..76453fe 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -1579,6 +1579,11 @@ struct rte_eth_dev *
return -EINVAL;
}
+ if (mp == NULL) {
+ RTE_ETHDEV_LOG(ERR, "Invalid null mempool pointer\n");
+ return -EINVAL;
+ }
+
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_setup, -ENOTSUP);
diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index 80e371b..d7b2657 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -1745,9 +1745,9 @@ int rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_queue,
* @return
* - 0: Success, receive queue correctly set up.
* - -EIO: if device is removed.
- * - -EINVAL: The size of network buffers which can be allocated from the
- * memory pool does not fit the various buffer sizes allowed by the
- * device controller.
+ * - -EINVAL: The memory pool pointer is null or the size of network buffers
+ * which can be allocated from this memory pool does not fit the various
+ * buffer sizes allowed by the device controller.
* - -ENOMEM: Unable to allocate the receive ring descriptors or to
* allocate network memory buffers from the memory pool when
* initializing receive descriptors.
--
1.8.3.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] ethdev: add a check on mempool during rxq setup
2019-05-17 8:15 [dpdk-dev] [PATCH] ethdev: add a check on mempool during rxq setup David Marchand
@ 2019-05-17 11:11 ` Jens Freimann
2019-06-05 16:46 ` Andrew Rybchenko
1 sibling, 0 replies; 4+ messages in thread
From: Jens Freimann @ 2019-05-17 11:11 UTC (permalink / raw)
To: David Marchand; +Cc: dev, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko
On Fri, May 17, 2019 at 10:15:08AM +0200, David Marchand wrote:
>We currently have no check on the mempool pointer passed to
>rte_eth_rx_queue_setup.
>Let's avoid a plain crash when dereferencing it.
>
>Suggested-by: Jens Freimann <jfreimann@redhat.com>
>Signed-off-by: David Marchand <david.marchand@redhat.com>
>---
> lib/librte_ethdev/rte_ethdev.c | 5 +++++
> lib/librte_ethdev/rte_ethdev.h | 6 +++---
> 2 files changed, 8 insertions(+), 3 deletions(-)
>
Thanks David!
Reviewed-by: Jens Freimann <jfreimann@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] ethdev: add a check on mempool during rxq setup
2019-05-17 8:15 [dpdk-dev] [PATCH] ethdev: add a check on mempool during rxq setup David Marchand
2019-05-17 11:11 ` Jens Freimann
@ 2019-06-05 16:46 ` Andrew Rybchenko
2019-06-06 15:06 ` Ferruh Yigit
1 sibling, 1 reply; 4+ messages in thread
From: Andrew Rybchenko @ 2019-06-05 16:46 UTC (permalink / raw)
To: David Marchand, dev; +Cc: jfreimann, Thomas Monjalon, Ferruh Yigit
On 5/17/19 11:15 AM, David Marchand wrote:
> We currently have no check on the mempool pointer passed to
> rte_eth_rx_queue_setup.
> Let's avoid a plain crash when dereferencing it.
>
> Suggested-by: Jens Freimann <jfreimann@redhat.com>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] ethdev: add a check on mempool during rxq setup
2019-06-05 16:46 ` Andrew Rybchenko
@ 2019-06-06 15:06 ` Ferruh Yigit
0 siblings, 0 replies; 4+ messages in thread
From: Ferruh Yigit @ 2019-06-06 15:06 UTC (permalink / raw)
To: Andrew Rybchenko, David Marchand, dev; +Cc: jfreimann, Thomas Monjalon
On 6/5/2019 5:46 PM, Andrew Rybchenko wrote:
> On 5/17/19 11:15 AM, David Marchand wrote:
>> We currently have no check on the mempool pointer passed to
>> rte_eth_rx_queue_setup.
>> Let's avoid a plain crash when dereferencing it.
>>
>> Suggested-by: Jens Freimann <jfreimann@redhat.com>
>> Signed-off-by: David Marchand <david.marchand@redhat.com>
>
> Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
>
Applied to dpdk-next-net/master, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-06-06 15:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-17 8:15 [dpdk-dev] [PATCH] ethdev: add a check on mempool during rxq setup David Marchand
2019-05-17 11:11 ` Jens Freimann
2019-06-05 16:46 ` Andrew Rybchenko
2019-06-06 15:06 ` Ferruh Yigit
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).