* [dpdk-dev] [PATCH] enic: prevent segfaults when allocating too many TX or RX queues
@ 2016-03-17 22:49 John Daley
2016-03-22 16:46 ` Bruce Richardson
0 siblings, 1 reply; 3+ messages in thread
From: John Daley @ 2016-03-17 22:49 UTC (permalink / raw)
To: dev; +Cc: Nelson Escobar
From: Nelson Escobar <neescoba@cisco.com>
Add checks to make sure we don't try to allocate more tx or rx queues
than we support.
Signed-off-by: Nelson Escobar <neescoba@cisco.com>
Reviewed-by: John Daley <johndale@cisco.com>
---
drivers/net/enic/enic_ethdev.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 6f2ada5..6c3c734 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -174,6 +174,13 @@ static int enicpmd_dev_tx_queue_setup(struct rte_eth_dev *eth_dev,
struct enic *enic = pmd_priv(eth_dev);
ENICPMD_FUNC_TRACE();
+ if (queue_idx >= ENIC_WQ_MAX) {
+ dev_err(enic,
+ "Max number of TX queues exceeded. Max is %d\n",
+ ENIC_WQ_MAX);
+ return -EINVAL;
+ }
+
eth_dev->data->tx_queues[queue_idx] = (void *)&enic->wq[queue_idx];
ret = enic_alloc_wq(enic, queue_idx, socket_id, nb_desc);
@@ -262,6 +269,13 @@ static int enicpmd_dev_rx_queue_setup(struct rte_eth_dev *eth_dev,
struct enic *enic = pmd_priv(eth_dev);
ENICPMD_FUNC_TRACE();
+ if (queue_idx >= ENIC_RQ_MAX) {
+ dev_err(enic,
+ "Max number of RX queues exceeded. Max is %d\n",
+ ENIC_RQ_MAX);
+ return -EINVAL;
+ }
+
eth_dev->data->rx_queues[queue_idx] = (void *)&enic->rq[queue_idx];
ret = enic_alloc_rq(enic, queue_idx, socket_id, mp, nb_desc);
--
2.7.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH] enic: prevent segfaults when allocating too many TX or RX queues
2016-03-17 22:49 [dpdk-dev] [PATCH] enic: prevent segfaults when allocating too many TX or RX queues John Daley
@ 2016-03-22 16:46 ` Bruce Richardson
2016-03-22 16:47 ` Bruce Richardson
0 siblings, 1 reply; 3+ messages in thread
From: Bruce Richardson @ 2016-03-22 16:46 UTC (permalink / raw)
To: John Daley; +Cc: dev, Nelson Escobar
On Thu, Mar 17, 2016 at 03:49:58PM -0700, John Daley wrote:
> From: Nelson Escobar <neescoba@cisco.com>
>
> Add checks to make sure we don't try to allocate more tx or rx queues
> than we support.
>
> Signed-off-by: Nelson Escobar <neescoba@cisco.com>
> Reviewed-by: John Daley <johndale@cisco.com>
Better to use the word fix in the title to indicate this is a bug-fix. Also missing
a fixes line of:
Fixes: fefed3d1e62c ("enic: new driver")
Will fix this up on apply.
/Bruce
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH] enic: prevent segfaults when allocating too many TX or RX queues
2016-03-22 16:46 ` Bruce Richardson
@ 2016-03-22 16:47 ` Bruce Richardson
0 siblings, 0 replies; 3+ messages in thread
From: Bruce Richardson @ 2016-03-22 16:47 UTC (permalink / raw)
To: John Daley; +Cc: dev, Nelson Escobar
On Tue, Mar 22, 2016 at 04:46:30PM +0000, Bruce Richardson wrote:
> On Thu, Mar 17, 2016 at 03:49:58PM -0700, John Daley wrote:
> > From: Nelson Escobar <neescoba@cisco.com>
> >
> > Add checks to make sure we don't try to allocate more tx or rx queues
> > than we support.
> >
> > Signed-off-by: Nelson Escobar <neescoba@cisco.com>
> > Reviewed-by: John Daley <johndale@cisco.com>
>
> Better to use the word fix in the title to indicate this is a bug-fix. Also missing
> a fixes line of:
>
> Fixes: fefed3d1e62c ("enic: new driver")
>
> Will fix this up on apply.
>
> /Bruce
Applied to dpdk-next-net/rel_16_04
/Bruce
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-03-22 16:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-17 22:49 [dpdk-dev] [PATCH] enic: prevent segfaults when allocating too many TX or RX queues John Daley
2016-03-22 16:46 ` Bruce Richardson
2016-03-22 16:47 ` Bruce Richardson
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).