DPDK patches and discussions
 help / color / mirror / Atom feed
From: bynes adam <adambynes@outlook.com>
To: Ilya Maximets <i.maximets@samsung.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	Helin Zhang <helin.zhang@intel.com>,
	Jingjing Wu <jingjing.wu@intel.com>, Zhe Tao <zhe.tao@intel.com>,
	Heetae Ahn <heetae82.ahn@samsung.com>,
	Thomas Monjalon <thomas.monjalon@6wind.com>,
	Sergey Dyasly <s.dyasly@samsung.com>
Subject: Re: [dpdk-dev] [PATCH] net/i40e: fix out-of-bounds writes during vector Rx
Date: Thu, 21 Jul 2016 19:09:42 +0000	[thread overview]
Message-ID: <SG2PR0201MB0998B4B2A792B3F45B330AA8B6090@SG2PR0201MB0998.apcprd02.prod.outlook.com> (raw)
In-Reply-To: <1469099018-31402-1-git-send-email-i.maximets@samsung.com>

On Thu, Jul 21, 2016 at 02:03:38PM +0300, Ilya Maximets wrote:
> From: Sergey Dyasly <s.dyasly@samsung.com>
> 
> Rx loop inside _recv_raw_pkts_vec() ignores nb_pkts argument and always
> tries to receive RTE_I40E_VPMD_RX_BURST (32) packets. This is a violation
> of rte_eth_rx_burst() API and can lead to memory corruption (out-of-bounds
> writes to struct rte_mbuf **rx_pkts) if nb_pkts is less than 32.
> 
> Fix this by actually using nb_pkts inside the loop.
> 
> Fixes: 9ed94e5bb04e ("i40e: add vector Rx")
> 
> Signed-off-by: Sergey Dyasly <s.dyasly@samsung.com>
> Acked-by: Ilya Maximets <i.maximets@samsung.com>
> ---
>  drivers/net/i40e/i40e_rxtx_vec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/i40e/i40e_rxtx_vec.c b/drivers/net/i40e/i40e_rxtx_vec.c
> index 05cb415..51fb282 100644
> --- a/drivers/net/i40e/i40e_rxtx_vec.c
> +++ b/drivers/net/i40e/i40e_rxtx_vec.c
> @@ -269,7 +269,7 @@ _recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts,
>  	 * D. fill info. from desc to mbuf
>  	 */
>  
> -	for (pos = 0, nb_pkts_recd = 0; pos < RTE_I40E_VPMD_RX_BURST;
> +	for (pos = 0, nb_pkts_recd = 0; pos < nb_pkts;
>  			pos += RTE_I40E_DESCS_PER_LOOP,
>  			rxdp += RTE_I40E_DESCS_PER_LOOP) {
>  		__m128i descs[RTE_I40E_DESCS_PER_LOOP];
> -- 
> 2.7.4
 Acked-by: Adam Bynes <adambynes@outlook.com>

  reply	other threads:[~2016-07-21 19:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-21 11:03 Ilya Maximets
2016-07-21 19:09 ` bynes adam [this message]
2016-07-21 23:35 ` Thomas Monjalon

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=SG2PR0201MB0998B4B2A792B3F45B330AA8B6090@SG2PR0201MB0998.apcprd02.prod.outlook.com \
    --to=adambynes@outlook.com \
    --cc=dev@dpdk.org \
    --cc=heetae82.ahn@samsung.com \
    --cc=helin.zhang@intel.com \
    --cc=i.maximets@samsung.com \
    --cc=jingjing.wu@intel.com \
    --cc=s.dyasly@samsung.com \
    --cc=thomas.monjalon@6wind.com \
    --cc=zhe.tao@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).