From: Jeff Guo <jia.guo@intel.com>
To: alvinx.zhang@intel.com, dev@dpdk.org
Cc: wei.zhao1@intel.com, xiaolong.ye@intel.com
Subject: Re: [dpdk-dev] [PATCH v2] net/igc: fix memory illegal accesses
Date: Fri, 8 May 2020 13:09:51 +0800 [thread overview]
Message-ID: <9a05472b-8fc3-2802-010f-5b3690000444@intel.com> (raw)
In-Reply-To: <20200507093156.18616-1-alvinx.zhang@intel.com>
On 5/7/2020 5:31 PM, alvinx.zhang@intel.com wrote:
> From: Alvin Zhang <alvinx.zhang@intel.com>
>
> Fix some out-of-bounds memory issues, they may lead to wrong results
> or affect application stability.
>
> Fixes: bd3fcf0d0fa1 (net/igc: support RSS)
> Cc: stable@dpdk.org
>
> Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
> ---
>
> V2: update git log
>
> drivers/net/igc/igc_ethdev.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/igc/igc_ethdev.c b/drivers/net/igc/igc_ethdev.c
> index 16d98c6..6ab3ee9 100644
> --- a/drivers/net/igc/igc_ethdev.c
> +++ b/drivers/net/igc/igc_ethdev.c
> @@ -2266,6 +2266,8 @@ static int eth_igc_vlan_tpid_set(struct rte_eth_dev *dev,
> return -EINVAL;
> }
>
> + RTE_BUILD_BUG_ON(ETH_RSS_RETA_SIZE_128 % IGC_RSS_RDT_REG_SIZE);
> +
> /* set redirection table */
> for (i = 0; i < ETH_RSS_RETA_SIZE_128; i += IGC_RSS_RDT_REG_SIZE) {
> union igc_rss_reta_reg reta, reg;
> @@ -2278,7 +2280,8 @@ static int eth_igc_vlan_tpid_set(struct rte_eth_dev *dev,
> IGC_RSS_RDT_REG_SIZE_MASK);
>
> /* if no need to update the register */
> - if (!mask)
> + if (!mask ||
> + shift > (RTE_RETA_GROUP_SIZE - IGC_RSS_RDT_REG_SIZE))
> continue;
>
> /* check mask whether need to read the register value first */
> @@ -2289,6 +2292,7 @@ static int eth_igc_vlan_tpid_set(struct rte_eth_dev *dev,
> IGC_RETA(i / IGC_RSS_RDT_REG_SIZE));
>
> /* update the register */
> + RTE_BUILD_BUG_ON(sizeof(reta.bytes) != IGC_RSS_RDT_REG_SIZE);
> for (j = 0; j < IGC_RSS_RDT_REG_SIZE; j++) {
> if (mask & (1u << j))
> reta.bytes[j] =
> @@ -2318,6 +2322,8 @@ static int eth_igc_vlan_tpid_set(struct rte_eth_dev *dev,
> return -EINVAL;
> }
>
> + RTE_BUILD_BUG_ON(ETH_RSS_RETA_SIZE_128 % IGC_RSS_RDT_REG_SIZE);
> +
> /* read redirection table */
> for (i = 0; i < ETH_RSS_RETA_SIZE_128; i += IGC_RSS_RDT_REG_SIZE) {
> union igc_rss_reta_reg reta;
> @@ -2330,10 +2336,12 @@ static int eth_igc_vlan_tpid_set(struct rte_eth_dev *dev,
> IGC_RSS_RDT_REG_SIZE_MASK);
>
> /* if no need to read register */
> - if (!mask)
> + if (!mask ||
> + shift > (RTE_RETA_GROUP_SIZE - IGC_RSS_RDT_REG_SIZE))
> continue;
>
> /* read register and get the queue index */
> + RTE_BUILD_BUG_ON(sizeof(reta.bytes) != IGC_RSS_RDT_REG_SIZE);
> reta.dword = IGC_READ_REG_LE_VALUE(hw,
> IGC_RETA(i / IGC_RSS_RDT_REG_SIZE));
> for (j = 0; j < IGC_RSS_RDT_REG_SIZE; j++) {
Reviewed-by: Jeff Guo <jia.guo@intel.com>
next prev parent reply other threads:[~2020-05-08 5:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-07 2:01 [dpdk-dev] [PATCH] " alvinx.zhang
2020-05-07 6:30 ` Jeff Guo
2020-05-07 8:08 ` Zhang, AlvinX
2020-05-07 9:08 ` [dpdk-dev] [PATCH v2] " alvinx.zhang
2020-05-07 9:31 ` alvinx.zhang
2020-05-08 5:09 ` Jeff Guo [this message]
2020-05-08 8:27 ` Ye Xiaolong
2020-05-08 8:54 ` [dpdk-dev] [PATCH v3] " alvinx.zhang
2020-05-12 5:23 ` Ye Xiaolong
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=9a05472b-8fc3-2802-010f-5b3690000444@intel.com \
--to=jia.guo@intel.com \
--cc=alvinx.zhang@intel.com \
--cc=dev@dpdk.org \
--cc=wei.zhao1@intel.com \
--cc=xiaolong.ye@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).