All of lore.kernel.org
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/mlx5: raw encap data cannot be empty
@ 2019-08-20  9:47 Xiaoyu Min
  2019-08-22  8:49 ` Dekel Peled
  2019-08-22 10:36 ` Raslan Darawsheh
  0 siblings, 2 replies; 3+ messages in thread
From: Xiaoyu Min @ 2019-08-20  9:47 UTC (permalink / raw)
  To: Shahaf Shuler, Yongseok Koh, Viacheslav Ovsiienko; +Cc: dev, dekelp

For the rte_flow_action_raw_encap, the header defination for
encapsulation must be available, otherwise it will lead to crash on some
OFED versions and logically it should be rejected.

Fixes: 8ba9eee4ce32 ("net/mlx5: add raw data encap/decap to Direct Verbs")
Cc: dekelp@mellanox.com

Signed-off-by: Xiaoyu Min <jackmin@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 21faa98ec3..41500bc109 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -949,6 +949,8 @@ flow_dv_validate_action_raw_encap(uint64_t action_flags,
 				  const struct rte_flow_attr *attr,
 				  struct rte_flow_error *error)
 {
+	const struct rte_flow_action_raw_encap *raw_encap =
+		(const struct rte_flow_action_raw_encap *)action->conf;
 	if (!(action->conf))
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ACTION, action,
@@ -970,6 +972,10 @@ flow_dv_validate_action_raw_encap(uint64_t action_flags,
 					  NULL,
 					  "encap action not supported for "
 					  "ingress");
+	if (!raw_encap->size || !raw_encap->data)
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ACTION, action,
+					  "raw encap data cannot be empty");
 	return 0;
 }
 
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] net/mlx5: raw encap data cannot be empty
  2019-08-20  9:47 [dpdk-dev] [PATCH] net/mlx5: raw encap data cannot be empty Xiaoyu Min
@ 2019-08-22  8:49 ` Dekel Peled
  2019-08-22 10:36 ` Raslan Darawsheh
  1 sibling, 0 replies; 3+ messages in thread
From: Dekel Peled @ 2019-08-22  8:49 UTC (permalink / raw)
  To: Jack Min, Shahaf Shuler, Yongseok Koh, Slava Ovsiienko; +Cc: dev

> -----Original Message-----
> From: Xiaoyu Min <jackmin@mellanox.com>
> Sent: Tuesday, August 20, 2019 12:47 PM
> To: Shahaf Shuler <shahafs@mellanox.com>; Yongseok Koh
> <yskoh@mellanox.com>; Slava Ovsiienko <viacheslavo@mellanox.com>
> Cc: dev@dpdk.org; Dekel Peled <dekelp@mellanox.com>
> Subject: [PATCH] net/mlx5: raw encap data cannot be empty
> 
> For the rte_flow_action_raw_encap, the header defination for
> encapsulation must be available, otherwise it will lead to crash on some OFED
> versions and logically it should be rejected.
> 
> Fixes: 8ba9eee4ce32 ("net/mlx5: add raw data encap/decap to Direct Verbs")
> Cc: dekelp@mellanox.com
> 
> Signed-off-by: Xiaoyu Min <jackmin@mellanox.com>
> ---
>  drivers/net/mlx5/mlx5_flow_dv.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow_dv.c
> b/drivers/net/mlx5/mlx5_flow_dv.c index 21faa98ec3..41500bc109 100644
> --- a/drivers/net/mlx5/mlx5_flow_dv.c
> +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> @@ -949,6 +949,8 @@ flow_dv_validate_action_raw_encap(uint64_t
> action_flags,
>  				  const struct rte_flow_attr *attr,
>  				  struct rte_flow_error *error)
>  {
> +	const struct rte_flow_action_raw_encap *raw_encap =
> +		(const struct rte_flow_action_raw_encap *)action->conf;
>  	if (!(action->conf))
>  		return rte_flow_error_set(error, EINVAL,
>  					  RTE_FLOW_ERROR_TYPE_ACTION,
> action, @@ -970,6 +972,10 @@
> flow_dv_validate_action_raw_encap(uint64_t action_flags,
>  					  NULL,
>  					  "encap action not supported for "
>  					  "ingress");
> +	if (!raw_encap->size || !raw_encap->data)
> +		return rte_flow_error_set(error, EINVAL,
> +					  RTE_FLOW_ERROR_TYPE_ACTION,
> action,
> +					  "raw encap data cannot be empty");
>  	return 0;
>  }
> 
> --
> 2.21.0

Acked-by: Dekel Peled <dekelp@mellanox.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] net/mlx5: raw encap data cannot be empty
  2019-08-20  9:47 [dpdk-dev] [PATCH] net/mlx5: raw encap data cannot be empty Xiaoyu Min
  2019-08-22  8:49 ` Dekel Peled
@ 2019-08-22 10:36 ` Raslan Darawsheh
  1 sibling, 0 replies; 3+ messages in thread
From: Raslan Darawsheh @ 2019-08-22 10:36 UTC (permalink / raw)
  To: Jack Min, Shahaf Shuler, Yongseok Koh, Slava Ovsiienko; +Cc: dev, Dekel Peled

Hi,

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Xiaoyu Min
> Sent: Tuesday, August 20, 2019 12:47 PM
> To: Shahaf Shuler <shahafs@mellanox.com>; Yongseok Koh
> <yskoh@mellanox.com>; Slava Ovsiienko <viacheslavo@mellanox.com>
> Cc: dev@dpdk.org; Dekel Peled <dekelp@mellanox.com>
> Subject: [dpdk-dev] [PATCH] net/mlx5: raw encap data cannot be empty
> 
> For the rte_flow_action_raw_encap, the header defination for
> encapsulation must be available, otherwise it will lead to crash on some
> OFED versions and logically it should be rejected.
> 
> Fixes: 8ba9eee4ce32 ("net/mlx5: add raw data encap/decap to Direct Verbs")
> Cc: dekelp@mellanox.com
> 
> Signed-off-by: Xiaoyu Min <jackmin@mellanox.com>
> ---

Patch applied to next-net-mlx,

Kindest regards
Raslan Darawsheh

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-08-22 10:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-20  9:47 [dpdk-dev] [PATCH] net/mlx5: raw encap data cannot be empty Xiaoyu Min
2019-08-22  8:49 ` Dekel Peled
2019-08-22 10:36 ` Raslan Darawsheh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.