patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Maxime Coquelin <mcoqueli@redhat.com>
To: Thierry Herbelot <thierry.herbelot@6wind.com>, dev@dpdk.org
Cc: Thomas Monjalon <thomas@monjalon.net>,
	stable@dpdk.org, Maxime Coquelin <maxime.coquelin@redhat.com>,
	Chenbo Xia <chenbo.xia@intel.com>
Subject: Re: [dpdk-stable] [PATCH v2] vhost/vhost_crypto: do not use possibly NULL Pointers
Date: Tue, 1 Jun 2021 09:40:26 +0200	[thread overview]
Message-ID: <5539804e-1d57-2e15-1882-0dda7d7adcea@redhat.com> (raw)
In-Reply-To: <20210524090821.17780-1-thierry.herbelot@6wind.com>

Hi Thierry,

On 5/24/21 11:08 AM, Thierry Herbelot wrote:
> Use vc_req only after it was checked not to be NULL.
> 
> Fixes: 2d962bb736521 ("vhost/crypto: fix possible TOCTOU attack")
> Cc: stable@dpdk.org
> Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
> Cc: Chenbo Xia <chenbo.xia@intel.com>
> 
> Signed-off-by: Thierry Herbelot <thierry.herbelot@6wind.com>
> --
> V2: fix copy/paste typo
> ---
>  lib/vhost/vhost_crypto.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c
> index 6689c52df239..926b5c0bd94a 100644
> --- a/lib/vhost/vhost_crypto.c
> +++ b/lib/vhost/vhost_crypto.c
> @@ -1337,13 +1337,15 @@ vhost_crypto_finalize_one_request(struct rte_crypto_op *op,
>  	struct rte_mbuf *m_src = op->sym->m_src;
>  	struct rte_mbuf *m_dst = op->sym->m_dst;
>  	struct vhost_crypto_data_req *vc_req = rte_mbuf_to_priv(m_src);
> -	struct vhost_virtqueue *vq = vc_req->vq;
> -	uint16_t used_idx = vc_req->desc_idx, desc_idx;
> +	struct vhost_virtqueue *vq;
> +	uint16_t used_idx, desc_idx;
>  
>  	if (unlikely(!vc_req)) {
>  		VC_LOG_ERR("Failed to retrieve vc_req");
>  		return NULL;
>  	}
> +	vq = vc_req->vq;
> +	used_idx = vc_req->desc_idx;
>  
>  	if (old_vq && (vq != old_vq))
>  		return vq;
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime


  reply	other threads:[~2021-06-01  7:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-24  8:58 [dpdk-stable] [PATCH] " Thierry Herbelot
2021-05-24  9:08 ` [dpdk-stable] [PATCH v2] " Thierry Herbelot
2021-06-01  7:40   ` Maxime Coquelin [this message]
2021-06-17 16:49   ` Maxime Coquelin

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=5539804e-1d57-2e15-1882-0dda7d7adcea@redhat.com \
    --to=mcoqueli@redhat.com \
    --cc=chenbo.xia@intel.com \
    --cc=dev@dpdk.org \
    --cc=maxime.coquelin@redhat.com \
    --cc=stable@dpdk.org \
    --cc=thierry.herbelot@6wind.com \
    --cc=thomas@monjalon.net \
    /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).