DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/ice: avoid out-of-bound access
@ 2022-09-06  2:28 Zhichao Zeng
  2022-09-06  4:47 ` Zhang, Qi Z
  2022-09-14  8:11 ` Xu, Ke1
  0 siblings, 2 replies; 3+ messages in thread
From: Zhichao Zeng @ 2022-09-06  2:28 UTC (permalink / raw)
  To: dev; +Cc: qiming.yang, yidingx.zhou, Zhichao Zeng, Qi Zhang

Add judgment on 'ethdev_port_id' to avoid out-of-bound accessing
the 'rte_eth_devices'.

Fixes: 6f8fba7e437e ("net/ice: support represented port flow action")

Signed-off-by: Zhichao Zeng <zhichaox.zeng@intel.com>
---
 drivers/net/ice/ice_switch_filter.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c
index 240fa10750..59fb31aa9d 100644
--- a/drivers/net/ice/ice_switch_filter.c
+++ b/drivers/net/ice/ice_switch_filter.c
@@ -1631,6 +1631,10 @@ ice_switch_parse_dcf_action(struct ice_dcf_adapter *ad,
 		case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT:
 			rule_info->sw_act.fltr_act = ICE_FWD_TO_VSI;
 			act_ethdev = action->conf;
+
+			if (!rte_eth_dev_is_valid_port(act_ethdev->port_id))
+				goto invalid;
+
 			repr_dev = &rte_eth_devices[act_ethdev->port_id];
 
 			if (!repr_dev->data)
-- 
2.25.1


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

* RE: [PATCH] net/ice: avoid out-of-bound access
  2022-09-06  2:28 [PATCH] net/ice: avoid out-of-bound access Zhichao Zeng
@ 2022-09-06  4:47 ` Zhang, Qi Z
  2022-09-14  8:11 ` Xu, Ke1
  1 sibling, 0 replies; 3+ messages in thread
From: Zhang, Qi Z @ 2022-09-06  4:47 UTC (permalink / raw)
  To: Zeng, ZhichaoX, dev; +Cc: Yang, Qiming, Zhou, YidingX



> -----Original Message-----
> From: Zeng, ZhichaoX <zhichaox.zeng@intel.com>
> Sent: Tuesday, September 6, 2022 10:29 AM
> To: dev@dpdk.org
> Cc: Yang, Qiming <qiming.yang@intel.com>; Zhou, YidingX
> <yidingx.zhou@intel.com>; Zeng, ZhichaoX <zhichaox.zeng@intel.com>;
> Zhang, Qi Z <qi.z.zhang@intel.com>
> Subject: [PATCH] net/ice: avoid out-of-bound access
> 
> Add judgment on 'ethdev_port_id' to avoid out-of-bound accessing the
> 'rte_eth_devices'.
> 
> Fixes: 6f8fba7e437e ("net/ice: support represented port flow action")
> 
> Signed-off-by: Zhichao Zeng <zhichaox.zeng@intel.com>

Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Squashed to the fix target patch as it has not been merged.
https://patchwork.dpdk.org/project/dpdk/patch/20220725053549.4130777-1-zhichaox.zeng@intel.com/

Thanks
Qi



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

* RE: [PATCH] net/ice: avoid out-of-bound access
  2022-09-06  2:28 [PATCH] net/ice: avoid out-of-bound access Zhichao Zeng
  2022-09-06  4:47 ` Zhang, Qi Z
@ 2022-09-14  8:11 ` Xu, Ke1
  1 sibling, 0 replies; 3+ messages in thread
From: Xu, Ke1 @ 2022-09-14  8:11 UTC (permalink / raw)
  To: Zeng, ZhichaoX, dev
  Cc: Yang, Qiming, Zhou, YidingX, Zeng, ZhichaoX, Zhang,  Qi Z


> -----Original Message-----
> From: Zhichao Zeng <zhichaox.zeng@intel.com>
> Sent: Tuesday, September 6, 2022 10:29 AM
> To: dev@dpdk.org
> Cc: Yang, Qiming <qiming.yang@intel.com>; Zhou, YidingX
> <yidingx.zhou@intel.com>; Zeng, ZhichaoX <zhichaox.zeng@intel.com>;
> Zhang, Qi Z <qi.z.zhang@intel.com>
> Subject: [PATCH] net/ice: avoid out-of-bound access
> 
> Add judgment on 'ethdev_port_id' to avoid out-of-bound accessing the
> 'rte_eth_devices'.
> 
> Fixes: 6f8fba7e437e ("net/ice: support represented port flow action")
> 
> Signed-off-by: Zhichao Zeng <zhichaox.zeng@intel.com>
> ---
>  drivers/net/ice/ice_switch_filter.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/net/ice/ice_switch_filter.c
> b/drivers/net/ice/ice_switch_filter.c
> index 240fa10750..59fb31aa9d 100644
> --- a/drivers/net/ice/ice_switch_filter.c
> +++ b/drivers/net/ice/ice_switch_filter.c
> @@ -1631,6 +1631,10 @@ ice_switch_parse_dcf_action(struct
> ice_dcf_adapter *ad,
>  		case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT:
>  			rule_info->sw_act.fltr_act = ICE_FWD_TO_VSI;
>  			act_ethdev = action->conf;
> +
> +			if (!rte_eth_dev_is_valid_port(act_ethdev->port_id))
> +				goto invalid;
> +
>  			repr_dev = &rte_eth_devices[act_ethdev->port_id];
> 
>  			if (!repr_dev->data)
> --
> 2.25.1

Tested and passed.

Tested-by: Ke Xu <ke1.xu@intel.com>


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

end of thread, other threads:[~2022-09-14  8:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-06  2:28 [PATCH] net/ice: avoid out-of-bound access Zhichao Zeng
2022-09-06  4:47 ` Zhang, Qi Z
2022-09-14  8:11 ` Xu, Ke1

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).