On Wed, Feb 21, 2018 at 01:38:38PM +0000, Ophir Munk wrote:
> When creating an RSS flow with missing actions parameters, for example:
> flow create 0 ingress pattern <list of patterns>  / end actions rss / end
> testpmd aborts with segmentation fault.
> In the corrupted code mlx4_flow_prepare() accesses RSS action->conf pointer
> without verifying its validity.
> In case of missing RSS actions parameters this pointer is NULL and must not
>  be accessed.

Problem is that testpmd is far from perfect and shouldn't feed PMDs with
invalid pointers in the first place. The configuration structure is not
documented as optional with actions that take one.

> The fix is to return an error in such cases "missing rss actions".
> Fixes: 078b8b452e6b ("net/mlx4: add RSS flow rule action support")
> Cc: sta...@dpdk.org
> Signed-off-by: Ophir Munk <ophi...@mellanox.com>

I suggest to fix this at once for all present and future PMDs in testpmd
directly. It may be added as a workaround in mlx4 but not as a fix since the
cause is not in that PMD.

> ---
>  drivers/net/mlx4/mlx4_flow.c | 4 ++++
>  1 file changed, 4 insertions(+)
> diff --git a/drivers/net/mlx4/mlx4_flow.c b/drivers/net/mlx4/mlx4_flow.c
> index 2d55bfe..7a127a8 100644
> --- a/drivers/net/mlx4/mlx4_flow.c
> +++ b/drivers/net/mlx4/mlx4_flow.c
> @@ -735,6 +735,10 @@ mlx4_flow_prepare(struct priv *priv,
>                       if (flow->rss)
>                               break;
>                       rss = action->conf;
> +                     if (!rss) {
> +                             msg = "missing rss actions";
> +                             goto exit_action_not_supported;
> +                     }

This message may be understood as a lack of RSS action, while it is in fact
present. This error can be more accurately described as:

 "RSS action configuration wasn't provided"

Note the same issue exists with the QUEUE action handled just prior to this
one and probably affects other PMDs as well. You really should consider
fixing testpmd instead.

Adrien Mazarguil

Reply via email to