[v2] net/mlx5: avoid crash when meter action conf is NULL
diff mbox series

Message ID 1576246894-31496-1-git-send-email-xiangxia.m.yue@gmail.com
State Accepted, archived
Delegated to: Raslan Darawsheh
Headers show
Series
  • [v2] net/mlx5: avoid crash when meter action conf is NULL
Related show

Checks

Context Check Description
ci/Intel-compilation fail apply issues
ci/travis-robot success Travis build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/checkpatch warning coding style issues

Commit Message

Tonghao Zhang Dec. 13, 2019, 2:21 p.m. UTC
From: Tonghao Zhang <xiangxia.m.yue@gmail.com>

When offloading the meter, should check the action
conf and make sure it is valid.

Fixes: f46bf7488705 ("net/mlx5: support meter flow action")
Cc: Suanming Mou <suanmingm@mellanox.com>

Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
---
v2: coding style issues: http://patches.dpdk.org/patch/63849/
---
 drivers/net/mlx5/mlx5_flow_dv.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Tonghao Zhang Dec. 16, 2019, 1:29 a.m. UTC | #1
On Fri, Dec 13, 2019 at 10:21 PM <xiangxia.m.yue@gmail.com> wrote:
>
> From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
>
> When offloading the meter, should check the action
> conf and make sure it is valid.
>
> Fixes: f46bf7488705 ("net/mlx5: support meter flow action")
> Cc: Suanming Mou <suanmingm@mellanox.com>
>
> Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> ---
> v2: coding style issues: http://patches.dpdk.org/patch/63849/
> ---
>  drivers/net/mlx5/mlx5_flow_dv.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
> index 73aaea4..7528556 100644
> --- a/drivers/net/mlx5/mlx5_flow_dv.c
> +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> @@ -3402,7 +3402,12 @@ struct field_modify_info modify_tcp[] = {
>  {
>         struct mlx5_priv *priv = dev->data->dev_private;
>         const struct rte_flow_action_meter *am = action->conf;
> -       struct mlx5_flow_meter *fm = mlx5_flow_meter_find(priv, am->mtr_id);
> +       struct mlx5_flow_meter *fm;
> +
> +       if (!am)
> +               return rte_flow_error_set(error, EINVAL,
> +                                         RTE_FLOW_ERROR_TYPE_ACTION, NULL,
> +                                         "meter action conf is NULL");
>
>         if (action_flags & MLX5_FLOW_ACTION_METER)
>                 return rte_flow_error_set(error, ENOTSUP,
> @@ -3417,6 +3422,8 @@ struct field_modify_info modify_tcp[] = {
>                                           RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
>                                           NULL,
>                                           "meter action not supported");
> +
> +       fm = mlx5_flow_meter_find(priv, am->mtr_id);
>         if (!fm)
>                 return rte_flow_error_set(error, EINVAL,
>                                           RTE_FLOW_ERROR_TYPE_ACTION, NULL,
> --
> 1.8.3.1
>
ping
Suanming Mou Dec. 16, 2019, 6:50 a.m. UTC | #2
> -----Original Message-----
> From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> Sent: Monday, December 16, 2019 9:29 AM
> To: Matan Azrad <matan@mellanox.com>; Shahaf Shuler
> <shahafs@mellanox.com>
> Cc: dev@dpdk.org; Suanming Mou <suanmingm@mellanox.com>
> Subject: Re: [PATCH v2] net/mlx5: avoid crash when meter action conf is
> NULL
> 
> On Fri, Dec 13, 2019 at 10:21 PM <xiangxia.m.yue@gmail.com> wrote:
> >
> > From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> >
> > When offloading the meter, should check the action conf and make sure
> > it is valid.
> >
> > Fixes: f46bf7488705 ("net/mlx5: support meter flow action")
> > Cc: Suanming Mou <suanmingm@mellanox.com>
> >
> > Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> > ---
> > v2: coding style issues:
> > https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatch
> >
> es.dpdk.org%2Fpatch%2F63849%2F&amp;data=02%7C01%7Csuanmingm%4
> 0mellanox
> > .com%7C65507f811a6c4e942c1d08d781c77b2a%7Ca652971c7d2e4d9ba6a4
> d149256f
> >
> 461b%7C0%7C0%7C637120566090170306&amp;sdata=0qTU8puaLH8IQkUm
> %2B4nIDG8G
> > 3dTi9ktvYKp%2BcxJ8dE4%3D&amp;reserved=0
> > ---
> >  drivers/net/mlx5/mlx5_flow_dv.c | 9 ++++++++-
> >  1 file changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/mlx5/mlx5_flow_dv.c
> > b/drivers/net/mlx5/mlx5_flow_dv.c index 73aaea4..7528556 100644
> > --- a/drivers/net/mlx5/mlx5_flow_dv.c
> > +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> > @@ -3402,7 +3402,12 @@ struct field_modify_info modify_tcp[] = {  {
> >         struct mlx5_priv *priv = dev->data->dev_private;
> >         const struct rte_flow_action_meter *am = action->conf;
> > -       struct mlx5_flow_meter *fm = mlx5_flow_meter_find(priv, am-
> >mtr_id);
> > +       struct mlx5_flow_meter *fm;
> > +
> > +       if (!am)
> > +               return rte_flow_error_set(error, EINVAL,
> > +                                         RTE_FLOW_ERROR_TYPE_ACTION, NULL,
> > +                                         "meter action conf is
> > + NULL");
> >
> >         if (action_flags & MLX5_FLOW_ACTION_METER)
> >                 return rte_flow_error_set(error, ENOTSUP, @@ -3417,6
> > +3422,8 @@ struct field_modify_info modify_tcp[] = {
> >                                           RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
> >                                           NULL,
> >                                           "meter action not
> > supported");
> > +

Redundant empty line.
Reviewed-by: Suanming Mou <suanmingm@mellanox.com>

> > +       fm = mlx5_flow_meter_find(priv, am->mtr_id);
> >         if (!fm)
> >                 return rte_flow_error_set(error, EINVAL,
> >                                           RTE_FLOW_ERROR_TYPE_ACTION,
> > NULL,
> > --
> > 1.8.3.1
> >
> ping
Tonghao Zhang Jan. 7, 2020, 6:39 a.m. UTC | #3
On Mon, Dec 16, 2019 at 2:50 PM Suanming Mou <suanmingm@mellanox.com> wrote:
>
>
> > -----Original Message-----
> > From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> > Sent: Monday, December 16, 2019 9:29 AM
> > To: Matan Azrad <matan@mellanox.com>; Shahaf Shuler
> > <shahafs@mellanox.com>
> > Cc: dev@dpdk.org; Suanming Mou <suanmingm@mellanox.com>
> > Subject: Re: [PATCH v2] net/mlx5: avoid crash when meter action conf is
> > NULL
> >
> > On Fri, Dec 13, 2019 at 10:21 PM <xiangxia.m.yue@gmail.com> wrote:
> > >
> > > From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> > >
> > > When offloading the meter, should check the action conf and make sure
> > > it is valid.
> > >
> > > Fixes: f46bf7488705 ("net/mlx5: support meter flow action")
> > > Cc: Suanming Mou <suanmingm@mellanox.com>
> > >
> > > Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> > > ---
> > > v2: coding style issues:
> > > https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatch
> > >
> > es.dpdk.org%2Fpatch%2F63849%2F&amp;data=02%7C01%7Csuanmingm%4
> > 0mellanox
> > > .com%7C65507f811a6c4e942c1d08d781c77b2a%7Ca652971c7d2e4d9ba6a4
> > d149256f
> > >
> > 461b%7C0%7C0%7C637120566090170306&amp;sdata=0qTU8puaLH8IQkUm
> > %2B4nIDG8G
> > > 3dTi9ktvYKp%2BcxJ8dE4%3D&amp;reserved=0
> > > ---
> > >  drivers/net/mlx5/mlx5_flow_dv.c | 9 ++++++++-
> > >  1 file changed, 8 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/net/mlx5/mlx5_flow_dv.c
> > > b/drivers/net/mlx5/mlx5_flow_dv.c index 73aaea4..7528556 100644
> > > --- a/drivers/net/mlx5/mlx5_flow_dv.c
> > > +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> > > @@ -3402,7 +3402,12 @@ struct field_modify_info modify_tcp[] = {  {
> > >         struct mlx5_priv *priv = dev->data->dev_private;
> > >         const struct rte_flow_action_meter *am = action->conf;
> > > -       struct mlx5_flow_meter *fm = mlx5_flow_meter_find(priv, am-
> > >mtr_id);
> > > +       struct mlx5_flow_meter *fm;
> > > +
> > > +       if (!am)
> > > +               return rte_flow_error_set(error, EINVAL,
> > > +                                         RTE_FLOW_ERROR_TYPE_ACTION, NULL,
> > > +                                         "meter action conf is
> > > + NULL");
> > >
> > >         if (action_flags & MLX5_FLOW_ACTION_METER)
> > >                 return rte_flow_error_set(error, ENOTSUP, @@ -3417,6
> > > +3422,8 @@ struct field_modify_info modify_tcp[] = {
> > >                                           RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
> > >                                           NULL,
> > >                                           "meter action not
> > > supported");
> > > +
>
> Redundant empty line.
> Reviewed-by: Suanming Mou <suanmingm@mellanox.com>
so this patch will be applied ?
> > > +       fm = mlx5_flow_meter_find(priv, am->mtr_id);
> > >         if (!fm)
> > >                 return rte_flow_error_set(error, EINVAL,
> > >                                           RTE_FLOW_ERROR_TYPE_ACTION,
> > > NULL,
> > > --
> > > 1.8.3.1
> > >
> > ping
Raslan Darawsheh Jan. 8, 2020, 9:17 a.m. UTC | #4
Hi,

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Tonghao Zhang
> Sent: Tuesday, January 7, 2020 8:39 AM
> To: Suanming Mou <suanmingm@mellanox.com>
> Cc: Matan Azrad <matan@mellanox.com>; Shahaf Shuler
> <shahafs@mellanox.com>; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v2] net/mlx5: avoid crash when meter action
> conf is NULL
> 
> On Mon, Dec 16, 2019 at 2:50 PM Suanming Mou
> <suanmingm@mellanox.com> wrote:
> >
> >
> > > -----Original Message-----
> > > From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> > > Sent: Monday, December 16, 2019 9:29 AM
> > > To: Matan Azrad <matan@mellanox.com>; Shahaf Shuler
> > > <shahafs@mellanox.com>
> > > Cc: dev@dpdk.org; Suanming Mou <suanmingm@mellanox.com>
> > > Subject: Re: [PATCH v2] net/mlx5: avoid crash when meter action conf is
> > > NULL
> > >
> > > On Fri, Dec 13, 2019 at 10:21 PM <xiangxia.m.yue@gmail.com> wrote:
> > > >
> > > > From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> > > >
> > > > When offloading the meter, should check the action conf and make
> sure
> > > > it is valid.
> > > >
> > > > Fixes: f46bf7488705 ("net/mlx5: support meter flow action")
> > > > Cc: Suanming Mou <suanmingm@mellanox.com>
> > > >
> > > > Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> > > > ---
> > > > v2: coding style issues:
> > > >
> https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatch
> > > >
> > >
> es.dpdk.org%2Fpatch%2F63849%2F&amp;data=02%7C01%7Csuanmingm%4
> > > 0mellanox
> > > >
> .com%7C65507f811a6c4e942c1d08d781c77b2a%7Ca652971c7d2e4d9ba6a4
> > > d149256f
> > > >
> > >
> 461b%7C0%7C0%7C637120566090170306&amp;sdata=0qTU8puaLH8IQkUm
> > > %2B4nIDG8G
> > > > 3dTi9ktvYKp%2BcxJ8dE4%3D&amp;reserved=0
> > > > ---
> > > >  drivers/net/mlx5/mlx5_flow_dv.c | 9 ++++++++-
> > > >  1 file changed, 8 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/net/mlx5/mlx5_flow_dv.c
> > > > b/drivers/net/mlx5/mlx5_flow_dv.c index 73aaea4..7528556 100644
> > > > --- a/drivers/net/mlx5/mlx5_flow_dv.c
> > > > +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> > > > @@ -3402,7 +3402,12 @@ struct field_modify_info modify_tcp[] = {  {
> > > >         struct mlx5_priv *priv = dev->data->dev_private;
> > > >         const struct rte_flow_action_meter *am = action->conf;
> > > > -       struct mlx5_flow_meter *fm = mlx5_flow_meter_find(priv, am-
> > > >mtr_id);
> > > > +       struct mlx5_flow_meter *fm;
> > > > +
> > > > +       if (!am)
> > > > +               return rte_flow_error_set(error, EINVAL,
> > > > +                                         RTE_FLOW_ERROR_TYPE_ACTION, NULL,
> > > > +                                         "meter action conf is
> > > > + NULL");
> > > >
> > > >         if (action_flags & MLX5_FLOW_ACTION_METER)
> > > >                 return rte_flow_error_set(error, ENOTSUP, @@ -3417,6
> > > > +3422,8 @@ struct field_modify_info modify_tcp[] = {
> > > >                                           RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
> > > >                                           NULL,
> > > >                                           "meter action not
> > > > supported");
> > > > +
> >
> > Redundant empty line.
> > Reviewed-by: Suanming Mou <suanmingm@mellanox.com>
> so this patch will be applied ?
> > > > +       fm = mlx5_flow_meter_find(priv, am->mtr_id);
> > > >         if (!fm)
> > > >                 return rte_flow_error_set(error, EINVAL,
> > > >                                           RTE_FLOW_ERROR_TYPE_ACTION,
> > > > NULL,
> > > > --
> > > > 1.8.3.1
> > > >
> > > ping


Removed redundant empty line and applied patch to next-net-mlx,

Kindest regards,
Raslan Darawsheh
Ferruh Yigit Jan. 8, 2020, 2:38 p.m. UTC | #5
On 1/8/2020 9:17 AM, Raslan Darawsheh wrote:
> Hi,
> 
>> -----Original Message-----
>> From: dev <dev-bounces@dpdk.org> On Behalf Of Tonghao Zhang
>> Sent: Tuesday, January 7, 2020 8:39 AM
>> To: Suanming Mou <suanmingm@mellanox.com>
>> Cc: Matan Azrad <matan@mellanox.com>; Shahaf Shuler
>> <shahafs@mellanox.com>; dev@dpdk.org
>> Subject: Re: [dpdk-dev] [PATCH v2] net/mlx5: avoid crash when meter action
>> conf is NULL
>>
>> On Mon, Dec 16, 2019 at 2:50 PM Suanming Mou
>> <suanmingm@mellanox.com> wrote:
>>>
>>>
>>>> -----Original Message-----
>>>> From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
>>>> Sent: Monday, December 16, 2019 9:29 AM
>>>> To: Matan Azrad <matan@mellanox.com>; Shahaf Shuler
>>>> <shahafs@mellanox.com>
>>>> Cc: dev@dpdk.org; Suanming Mou <suanmingm@mellanox.com>
>>>> Subject: Re: [PATCH v2] net/mlx5: avoid crash when meter action conf is
>>>> NULL
>>>>
>>>> On Fri, Dec 13, 2019 at 10:21 PM <xiangxia.m.yue@gmail.com> wrote:
>>>>>
>>>>> From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
>>>>>
>>>>> When offloading the meter, should check the action conf and make
>> sure
>>>>> it is valid.
>>>>>
>>>>> Fixes: f46bf7488705 ("net/mlx5: support meter flow action")
>>>>> Cc: Suanming Mou <suanmingm@mellanox.com>
>>>>>
>>>>> Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
>>>>> ---
>>>>> v2: coding style issues:
>>>>>
>> https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatch
>>>>>
>>>>
>> es.dpdk.org%2Fpatch%2F63849%2F&amp;data=02%7C01%7Csuanmingm%4
>>>> 0mellanox
>>>>>
>> .com%7C65507f811a6c4e942c1d08d781c77b2a%7Ca652971c7d2e4d9ba6a4
>>>> d149256f
>>>>>
>>>>
>> 461b%7C0%7C0%7C637120566090170306&amp;sdata=0qTU8puaLH8IQkUm
>>>> %2B4nIDG8G
>>>>> 3dTi9ktvYKp%2BcxJ8dE4%3D&amp;reserved=0
>>>>> ---
>>>>>  drivers/net/mlx5/mlx5_flow_dv.c | 9 ++++++++-
>>>>>  1 file changed, 8 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/drivers/net/mlx5/mlx5_flow_dv.c
>>>>> b/drivers/net/mlx5/mlx5_flow_dv.c index 73aaea4..7528556 100644
>>>>> --- a/drivers/net/mlx5/mlx5_flow_dv.c
>>>>> +++ b/drivers/net/mlx5/mlx5_flow_dv.c
>>>>> @@ -3402,7 +3402,12 @@ struct field_modify_info modify_tcp[] = {  {
>>>>>         struct mlx5_priv *priv = dev->data->dev_private;
>>>>>         const struct rte_flow_action_meter *am = action->conf;
>>>>> -       struct mlx5_flow_meter *fm = mlx5_flow_meter_find(priv, am-
>>>>> mtr_id);
>>>>> +       struct mlx5_flow_meter *fm;
>>>>> +
>>>>> +       if (!am)
>>>>> +               return rte_flow_error_set(error, EINVAL,
>>>>> +                                         RTE_FLOW_ERROR_TYPE_ACTION, NULL,
>>>>> +                                         "meter action conf is
>>>>> + NULL");
>>>>>
>>>>>         if (action_flags & MLX5_FLOW_ACTION_METER)
>>>>>                 return rte_flow_error_set(error, ENOTSUP, @@ -3417,6
>>>>> +3422,8 @@ struct field_modify_info modify_tcp[] = {
>>>>>                                           RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
>>>>>                                           NULL,
>>>>>                                           "meter action not
>>>>> supported");
>>>>> +
>>>
>>> Redundant empty line.
>>> Reviewed-by: Suanming Mou <suanmingm@mellanox.com>
>> so this patch will be applied ?
>>>>> +       fm = mlx5_flow_meter_find(priv, am->mtr_id);
>>>>>         if (!fm)
>>>>>                 return rte_flow_error_set(error, EINVAL,
>>>>>                                           RTE_FLOW_ERROR_TYPE_ACTION,
>>>>> NULL,
>>>>> --
>>>>> 1.8.3.1
>>>>>
>>>> ping
> 
> 
> Removed redundant empty line and applied patch to next-net-mlx,
> 

Hi Raslan,

The stable tag seems missing, can you please add it in your tree? Also can you
please drop the cc'ed names from commit log while merging?
Ferruh Yigit Jan. 8, 2020, 3:09 p.m. UTC | #6
On 1/8/2020 2:38 PM, Ferruh Yigit wrote:
> On 1/8/2020 9:17 AM, Raslan Darawsheh wrote:
>> Hi,
>>
>>> -----Original Message-----
>>> From: dev <dev-bounces@dpdk.org> On Behalf Of Tonghao Zhang
>>> Sent: Tuesday, January 7, 2020 8:39 AM
>>> To: Suanming Mou <suanmingm@mellanox.com>
>>> Cc: Matan Azrad <matan@mellanox.com>; Shahaf Shuler
>>> <shahafs@mellanox.com>; dev@dpdk.org
>>> Subject: Re: [dpdk-dev] [PATCH v2] net/mlx5: avoid crash when meter action
>>> conf is NULL
>>>
>>> On Mon, Dec 16, 2019 at 2:50 PM Suanming Mou
>>> <suanmingm@mellanox.com> wrote:
>>>>
>>>>
>>>>> -----Original Message-----
>>>>> From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
>>>>> Sent: Monday, December 16, 2019 9:29 AM
>>>>> To: Matan Azrad <matan@mellanox.com>; Shahaf Shuler
>>>>> <shahafs@mellanox.com>
>>>>> Cc: dev@dpdk.org; Suanming Mou <suanmingm@mellanox.com>
>>>>> Subject: Re: [PATCH v2] net/mlx5: avoid crash when meter action conf is
>>>>> NULL
>>>>>
>>>>> On Fri, Dec 13, 2019 at 10:21 PM <xiangxia.m.yue@gmail.com> wrote:
>>>>>>
>>>>>> From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
>>>>>>
>>>>>> When offloading the meter, should check the action conf and make
>>> sure
>>>>>> it is valid.
>>>>>>
>>>>>> Fixes: f46bf7488705 ("net/mlx5: support meter flow action")
>>>>>> Cc: Suanming Mou <suanmingm@mellanox.com>
>>>>>>
>>>>>> Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
>>>>>> ---
>>>>>> v2: coding style issues:
>>>>>>
>>> https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatch
>>>>>>
>>>>>
>>> es.dpdk.org%2Fpatch%2F63849%2F&amp;data=02%7C01%7Csuanmingm%4
>>>>> 0mellanox
>>>>>>
>>> .com%7C65507f811a6c4e942c1d08d781c77b2a%7Ca652971c7d2e4d9ba6a4
>>>>> d149256f
>>>>>>
>>>>>
>>> 461b%7C0%7C0%7C637120566090170306&amp;sdata=0qTU8puaLH8IQkUm
>>>>> %2B4nIDG8G
>>>>>> 3dTi9ktvYKp%2BcxJ8dE4%3D&amp;reserved=0
>>>>>> ---
>>>>>>  drivers/net/mlx5/mlx5_flow_dv.c | 9 ++++++++-
>>>>>>  1 file changed, 8 insertions(+), 1 deletion(-)
>>>>>>
>>>>>> diff --git a/drivers/net/mlx5/mlx5_flow_dv.c
>>>>>> b/drivers/net/mlx5/mlx5_flow_dv.c index 73aaea4..7528556 100644
>>>>>> --- a/drivers/net/mlx5/mlx5_flow_dv.c
>>>>>> +++ b/drivers/net/mlx5/mlx5_flow_dv.c
>>>>>> @@ -3402,7 +3402,12 @@ struct field_modify_info modify_tcp[] = {  {
>>>>>>         struct mlx5_priv *priv = dev->data->dev_private;
>>>>>>         const struct rte_flow_action_meter *am = action->conf;
>>>>>> -       struct mlx5_flow_meter *fm = mlx5_flow_meter_find(priv, am-
>>>>>> mtr_id);
>>>>>> +       struct mlx5_flow_meter *fm;
>>>>>> +
>>>>>> +       if (!am)
>>>>>> +               return rte_flow_error_set(error, EINVAL,
>>>>>> +                                         RTE_FLOW_ERROR_TYPE_ACTION, NULL,
>>>>>> +                                         "meter action conf is
>>>>>> + NULL");
>>>>>>
>>>>>>         if (action_flags & MLX5_FLOW_ACTION_METER)
>>>>>>                 return rte_flow_error_set(error, ENOTSUP, @@ -3417,6
>>>>>> +3422,8 @@ struct field_modify_info modify_tcp[] = {
>>>>>>                                           RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
>>>>>>                                           NULL,
>>>>>>                                           "meter action not
>>>>>> supported");
>>>>>> +
>>>>
>>>> Redundant empty line.
>>>> Reviewed-by: Suanming Mou <suanmingm@mellanox.com>
>>> so this patch will be applied ?
>>>>>> +       fm = mlx5_flow_meter_find(priv, am->mtr_id);
>>>>>>         if (!fm)
>>>>>>                 return rte_flow_error_set(error, EINVAL,
>>>>>>                                           RTE_FLOW_ERROR_TYPE_ACTION,
>>>>>> NULL,
>>>>>> --
>>>>>> 1.8.3.1
>>>>>>
>>>>> ping
>>
>>
>> Removed redundant empty line and applied patch to next-net-mlx,
>>
> 
> Hi Raslan,
> 
> The stable tag seems missing, can you please add it in your tree? Also can you
> please drop the cc'ed names from commit log while merging?
> 

Also can you please prefer the 'fix' instead of 'avoid', 'fix' became kind of
keyword we are using, so better to stick to it for consistency, can you please
fix in you tree?
Raslan Darawsheh Jan. 8, 2020, 3:11 p.m. UTC | #7
> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@intel.com>
> Sent: Wednesday, January 8, 2020 4:39 PM
> To: Raslan Darawsheh <rasland@mellanox.com>; Tonghao Zhang
> <xiangxia.m.yue@gmail.com>; Suanming Mou
> <suanmingm@mellanox.com>
> Cc: Matan Azrad <matan@mellanox.com>; Shahaf Shuler
> <shahafs@mellanox.com>; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v2] net/mlx5: avoid crash when meter action
> conf is NULL
> 
> On 1/8/2020 9:17 AM, Raslan Darawsheh wrote:
> > Hi,
> >
> >> -----Original Message-----
> >> From: dev <dev-bounces@dpdk.org> On Behalf Of Tonghao Zhang
> >> Sent: Tuesday, January 7, 2020 8:39 AM
> >> To: Suanming Mou <suanmingm@mellanox.com>
> >> Cc: Matan Azrad <matan@mellanox.com>; Shahaf Shuler
> >> <shahafs@mellanox.com>; dev@dpdk.org
> >> Subject: Re: [dpdk-dev] [PATCH v2] net/mlx5: avoid crash when meter
> >> action conf is NULL
> >>
> >> On Mon, Dec 16, 2019 at 2:50 PM Suanming Mou
> <suanmingm@mellanox.com>
> >> wrote:
> >>>
> >>>
> >>>> -----Original Message-----
> >>>> From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> >>>> Sent: Monday, December 16, 2019 9:29 AM
> >>>> To: Matan Azrad <matan@mellanox.com>; Shahaf Shuler
> >>>> <shahafs@mellanox.com>
> >>>> Cc: dev@dpdk.org; Suanming Mou <suanmingm@mellanox.com>
> >>>> Subject: Re: [PATCH v2] net/mlx5: avoid crash when meter action
> >>>> conf is NULL
> >>>>
> >>>> On Fri, Dec 13, 2019 at 10:21 PM <xiangxia.m.yue@gmail.com> wrote:
> >>>>>
> >>>>> From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> >>>>>
> >>>>> When offloading the meter, should check the action conf and make
> >> sure
> >>>>> it is valid.
> >>>>>
> >>>>> Fixes: f46bf7488705 ("net/mlx5: support meter flow action")
> >>>>> Cc: Suanming Mou <suanmingm@mellanox.com>
> >>>>>
> >>>>> Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> >>>>> ---
> >>>>> v2: coding style issues:
> >>>>>
> >>
> https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatc
> >> h
> >>>>>
> >>>>
> >>
> es.dpdk.org%2Fpatch%2F63849%2F&amp;data=02%7C01%7Csuanmingm%4
> >>>> 0mellanox
> >>>>>
> >> .com%7C65507f811a6c4e942c1d08d781c77b2a%7Ca652971c7d2e4d9ba6a4
> >>>> d149256f
> >>>>>
> >>>>
> >>
> 461b%7C0%7C0%7C637120566090170306&amp;sdata=0qTU8puaLH8IQkUm
> >>>> %2B4nIDG8G
> >>>>> 3dTi9ktvYKp%2BcxJ8dE4%3D&amp;reserved=0
> >>>>> ---
> >>>>>  drivers/net/mlx5/mlx5_flow_dv.c | 9 ++++++++-
> >>>>>  1 file changed, 8 insertions(+), 1 deletion(-)
> >>>>>
> >>>>> diff --git a/drivers/net/mlx5/mlx5_flow_dv.c
> >>>>> b/drivers/net/mlx5/mlx5_flow_dv.c index 73aaea4..7528556 100644
> >>>>> --- a/drivers/net/mlx5/mlx5_flow_dv.c
> >>>>> +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> >>>>> @@ -3402,7 +3402,12 @@ struct field_modify_info modify_tcp[] = {  {
> >>>>>         struct mlx5_priv *priv = dev->data->dev_private;
> >>>>>         const struct rte_flow_action_meter *am = action->conf;
> >>>>> -       struct mlx5_flow_meter *fm = mlx5_flow_meter_find(priv, am-
> >>>>> mtr_id);
> >>>>> +       struct mlx5_flow_meter *fm;
> >>>>> +
> >>>>> +       if (!am)
> >>>>> +               return rte_flow_error_set(error, EINVAL,
> >>>>> +                                         RTE_FLOW_ERROR_TYPE_ACTION, NULL,
> >>>>> +                                         "meter action conf is
> >>>>> + NULL");
> >>>>>
> >>>>>         if (action_flags & MLX5_FLOW_ACTION_METER)
> >>>>>                 return rte_flow_error_set(error, ENOTSUP, @@
> >>>>> -3417,6
> >>>>> +3422,8 @@ struct field_modify_info modify_tcp[] = {
> >>>>>                                           RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
> >>>>>                                           NULL,
> >>>>>                                           "meter action not
> >>>>> supported");
> >>>>> +
> >>>
> >>> Redundant empty line.
> >>> Reviewed-by: Suanming Mou <suanmingm@mellanox.com>
> >> so this patch will be applied ?
> >>>>> +       fm = mlx5_flow_meter_find(priv, am->mtr_id);
> >>>>>         if (!fm)
> >>>>>                 return rte_flow_error_set(error, EINVAL,
> >>>>>
> >>>>> RTE_FLOW_ERROR_TYPE_ACTION, NULL,
> >>>>> --
> >>>>> 1.8.3.1
> >>>>>
> >>>> ping
> >
> >
> > Removed redundant empty line and applied patch to next-net-mlx,
> >
> 
> Hi Raslan,
> 
> The stable tag seems missing, can you please add it in your tree? Also can you
> please drop the cc'ed names from commit log while merging?

Done!

Kindest regards,
Raslan Darawsheh

Patch
diff mbox series

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 73aaea4..7528556 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -3402,7 +3402,12 @@  struct field_modify_info modify_tcp[] = {
 {
 	struct mlx5_priv *priv = dev->data->dev_private;
 	const struct rte_flow_action_meter *am = action->conf;
-	struct mlx5_flow_meter *fm = mlx5_flow_meter_find(priv, am->mtr_id);
+	struct mlx5_flow_meter *fm;
+
+	if (!am)
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ACTION, NULL,
+					  "meter action conf is NULL");
 
 	if (action_flags & MLX5_FLOW_ACTION_METER)
 		return rte_flow_error_set(error, ENOTSUP,
@@ -3417,6 +3422,8 @@  struct field_modify_info modify_tcp[] = {
 					  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
 					  NULL,
 					  "meter action not supported");
+
+	fm = mlx5_flow_meter_find(priv, am->mtr_id);
 	if (!fm)
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ACTION, NULL,