DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Xu, Ke1" <ke1.xu@intel.com>
To: "Zeng, ZhichaoX" <zhichaox.zeng@intel.com>,
	"dev@dpdk.org" <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: RE: [PATCH] net/ice: avoid out-of-bound access
Date: Wed, 14 Sep 2022 08:11:00 +0000	[thread overview]
Message-ID: <PH7PR11MB60569E12A06EEC4978275FDCD3469@PH7PR11MB6056.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20220906022859.159925-1-zhichaox.zeng@intel.com>


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


      parent reply	other threads:[~2022-09-14  8:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-06  2:28 Zhichao Zeng
2022-09-06  4:47 ` Zhang, Qi Z
2022-09-14  8:11 ` Xu, Ke1 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=PH7PR11MB60569E12A06EEC4978275FDCD3469@PH7PR11MB6056.namprd11.prod.outlook.com \
    --to=ke1.xu@intel.com \
    --cc=dev@dpdk.org \
    --cc=qi.z.zhang@intel.com \
    --cc=qiming.yang@intel.com \
    --cc=yidingx.zhou@intel.com \
    --cc=zhichaox.zeng@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).