patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] vhost/vhost_crypto: do not use possibly NULL Pointers
@ 2021-05-24  8:58 Thierry Herbelot
  2021-05-24  9:08 ` [dpdk-stable] [PATCH v2] " Thierry Herbelot
  0 siblings, 1 reply; 4+ messages in thread
From: Thierry Herbelot @ 2021-05-24  8:58 UTC (permalink / raw)
  To: dev
  Cc: Thierry Herbelot, Thomas Monjalon, stable, Maxime Coquelin, Chenbo Xia

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>
---
 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..5113a552bd2e 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;
 
 	if (unlikely(!vc_req)) {
 		VC_LOG_ERR("Failed to retrieve vc_req");
 		return NULL;
 	}
+	vq = vc_req->vq;
+	used_idx = vc_req->desc_idx, desc_idx;
 
 	if (old_vq && (vq != old_vq))
 		return vq;
-- 
2.29.2


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

* [dpdk-stable] [PATCH v2] vhost/vhost_crypto: do not use possibly NULL Pointers
  2021-05-24  8:58 [dpdk-stable] [PATCH] vhost/vhost_crypto: do not use possibly NULL Pointers Thierry Herbelot
@ 2021-05-24  9:08 ` Thierry Herbelot
  2021-06-01  7:40   ` Maxime Coquelin
  2021-06-17 16:49   ` Maxime Coquelin
  0 siblings, 2 replies; 4+ messages in thread
From: Thierry Herbelot @ 2021-05-24  9:08 UTC (permalink / raw)
  To: dev
  Cc: Thierry Herbelot, Thomas Monjalon, stable, Maxime Coquelin, Chenbo Xia

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


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

* Re: [dpdk-stable] [PATCH v2] vhost/vhost_crypto: do not use possibly NULL Pointers
  2021-05-24  9:08 ` [dpdk-stable] [PATCH v2] " Thierry Herbelot
@ 2021-06-01  7:40   ` Maxime Coquelin
  2021-06-17 16:49   ` Maxime Coquelin
  1 sibling, 0 replies; 4+ messages in thread
From: Maxime Coquelin @ 2021-06-01  7:40 UTC (permalink / raw)
  To: Thierry Herbelot, dev
  Cc: Thomas Monjalon, stable, Maxime Coquelin, Chenbo Xia

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


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

* Re: [dpdk-stable] [PATCH v2] vhost/vhost_crypto: do not use possibly NULL Pointers
  2021-05-24  9:08 ` [dpdk-stable] [PATCH v2] " Thierry Herbelot
  2021-06-01  7:40   ` Maxime Coquelin
@ 2021-06-17 16:49   ` Maxime Coquelin
  1 sibling, 0 replies; 4+ messages in thread
From: Maxime Coquelin @ 2021-06-17 16:49 UTC (permalink / raw)
  To: Thierry Herbelot, dev; +Cc: Thomas Monjalon, stable, Chenbo Xia



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

Applied to dpdk-next-virtio/main.

Thanks,
Maxime


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

end of thread, other threads:[~2021-06-17 16:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-24  8:58 [dpdk-stable] [PATCH] vhost/vhost_crypto: do not use possibly NULL Pointers Thierry Herbelot
2021-05-24  9:08 ` [dpdk-stable] [PATCH v2] " Thierry Herbelot
2021-06-01  7:40   ` Maxime Coquelin
2021-06-17 16:49   ` Maxime Coquelin

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ https://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git