* [dpdk-dev] [PATCH] net/mlx5: fix segfault due to array overflow
@ 2017-11-02 13:30 Nelio Laranjeiro
2017-11-02 19:04 ` Ferruh Yigit
0 siblings, 1 reply; 2+ messages in thread
From: Nelio Laranjeiro @ 2017-11-02 13:30 UTC (permalink / raw)
To: dev; +Cc: Yongseok Koh, Adrien Mazarguil
VLAN id is limited to MLX5_MAX_VLAN_IDS which is not verified by the code
before trying to add a new VLAN filter.
Fixes: 272733b5ebfd ("net/mlx5: use flow to enable unicast traffic")
Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
---
drivers/net/mlx5/mlx5_vlan.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/net/mlx5/mlx5_vlan.c b/drivers/net/mlx5/mlx5_vlan.c
index 89874aabd..6fc315ef3 100644
--- a/drivers/net/mlx5/mlx5_vlan.c
+++ b/drivers/net/mlx5/mlx5_vlan.c
@@ -61,6 +61,7 @@ mlx5_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
{
struct priv *priv = dev->data->dev_private;
unsigned int i;
+ int ret = 0;
priv_lock(priv);
DEBUG("%p: %s VLAN filter ID %" PRIu16,
@@ -69,6 +70,11 @@ mlx5_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
for (i = 0; (i != priv->vlan_filter_n); ++i)
if (priv->vlan_filter[i] == vlan_id)
break;
+ /* Check if there's room for another VLAN filter. */
+ if (i == RTE_DIM(priv->vlan_filter)) {
+ ret = -ENOMEM;
+ goto out;
+ }
if (i < priv->vlan_filter_n) {
assert(priv->vlan_filter_n != 0);
/* Enabling an existing VLAN filter has no effect. */
@@ -94,7 +100,7 @@ mlx5_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
priv_dev_traffic_restart(priv, dev);
out:
priv_unlock(priv);
- return 0;
+ return ret;
}
/**
--
2.11.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [dpdk-dev] [PATCH] net/mlx5: fix segfault due to array overflow
2017-11-02 13:30 [dpdk-dev] [PATCH] net/mlx5: fix segfault due to array overflow Nelio Laranjeiro
@ 2017-11-02 19:04 ` Ferruh Yigit
0 siblings, 0 replies; 2+ messages in thread
From: Ferruh Yigit @ 2017-11-02 19:04 UTC (permalink / raw)
To: Nelio Laranjeiro, dev; +Cc: Yongseok Koh, Adrien Mazarguil
On 11/2/2017 6:30 AM, Nelio Laranjeiro wrote:
> VLAN id is limited to MLX5_MAX_VLAN_IDS which is not verified by the code
> before trying to add a new VLAN filter.
>
> Fixes: 272733b5ebfd ("net/mlx5: use flow to enable unicast traffic")
>
> Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Applied to dpdk-next-net/master, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-11-02 19:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-02 13:30 [dpdk-dev] [PATCH] net/mlx5: fix segfault due to array overflow Nelio Laranjeiro
2017-11-02 19:04 ` 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).