patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH 20.11] crypto/dpaa2_sec: fix crypto operation pointer
@ 2022-06-28  3:44 Gagandeep Singh
  2022-07-19 11:11 ` Xueming(Steven) Li
  0 siblings, 1 reply; 2+ messages in thread
From: Gagandeep Singh @ 2022-06-28  3:44 UTC (permalink / raw)
  To: stable; +Cc: Gagandeep Singh, Akhil Goyal

[ upstream commit e3d264383b560a447806d9ff478bad234fda5675 ]

Driver is filling the crypto_op variable with an invalid value
for atomic events which can results into segmentation fault.

This patch assigning the correct crypto_op and event buffer
pointers by extracting from FD.

Fixes: a77db24643b7 ("crypto/dpaa2_sec: support atomic queues")

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
---
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index 64ee56e7c..839c11ed2 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -3705,7 +3705,7 @@ dpaa2_sec_process_atomic_event(struct qbman_swp *swp __rte_unused,
 				 struct rte_event *ev)
 {
 	uint8_t dqrr_index;
-	struct rte_crypto_op *crypto_op = (struct rte_crypto_op *)ev->event_ptr;
+	struct rte_crypto_op *crypto_op;
 	/* Prefetching mbuf */
 	rte_prefetch0((void *)(size_t)(DPAA2_GET_FD_ADDR(fd)-
 		rte_dpaa2_bpid_info[DPAA2_GET_FD_BPID(fd)].meta_data_size));
@@ -3721,12 +3721,13 @@ dpaa2_sec_process_atomic_event(struct qbman_swp *swp __rte_unused,
 	ev->queue_id = rxq->ev.queue_id;
 	ev->priority = rxq->ev.priority;
 
-	ev->event_ptr = sec_fd_to_mbuf(fd);
+	crypto_op = sec_fd_to_mbuf(fd);
 	dqrr_index = qbman_get_dqrr_idx(dq);
 	*dpaa2_seqn(crypto_op->sym->m_src) = dqrr_index + 1;
 	DPAA2_PER_LCORE_DQRR_SIZE++;
 	DPAA2_PER_LCORE_DQRR_HELD |= 1 << dqrr_index;
 	DPAA2_PER_LCORE_DQRR_MBUF(dqrr_index) = crypto_op->sym->m_src;
+	ev->event_ptr = crypto_op;
 }
 
 int
-- 
2.25.1


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

* RE: [PATCH 20.11] crypto/dpaa2_sec: fix crypto operation pointer
  2022-06-28  3:44 [PATCH 20.11] crypto/dpaa2_sec: fix crypto operation pointer Gagandeep Singh
@ 2022-07-19 11:11 ` Xueming(Steven) Li
  0 siblings, 0 replies; 2+ messages in thread
From: Xueming(Steven) Li @ 2022-07-19 11:11 UTC (permalink / raw)
  To: Gagandeep Singh, stable; +Cc: Akhil Goyal

Thanks, patch applied.

> -----Original Message-----
> From: Gagandeep Singh <g.singh@nxp.com>
> Sent: Tuesday, June 28, 2022 11:44 AM
> To: stable@dpdk.org
> Cc: Gagandeep Singh <g.singh@nxp.com>; Akhil Goyal <gakhil@marvell.com>
> Subject: [PATCH 20.11] crypto/dpaa2_sec: fix crypto operation pointer
> 
> [ upstream commit e3d264383b560a447806d9ff478bad234fda5675 ]
> 
> Driver is filling the crypto_op variable with an invalid value for atomic events which can results into segmentation fault.
> 
> This patch assigning the correct crypto_op and event buffer pointers by extracting from FD.
> 
> Fixes: a77db24643b7 ("crypto/dpaa2_sec: support atomic queues")
> 
> Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
> Acked-by: Akhil Goyal <gakhil@marvell.com>
> ---
>  drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> index 64ee56e7c..839c11ed2 100644
> --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> @@ -3705,7 +3705,7 @@ dpaa2_sec_process_atomic_event(struct qbman_swp *swp __rte_unused,
>  				 struct rte_event *ev)
>  {
>  	uint8_t dqrr_index;
> -	struct rte_crypto_op *crypto_op = (struct rte_crypto_op *)ev->event_ptr;
> +	struct rte_crypto_op *crypto_op;
>  	/* Prefetching mbuf */
>  	rte_prefetch0((void *)(size_t)(DPAA2_GET_FD_ADDR(fd)-
>  		rte_dpaa2_bpid_info[DPAA2_GET_FD_BPID(fd)].meta_data_size));
> @@ -3721,12 +3721,13 @@ dpaa2_sec_process_atomic_event(struct qbman_swp *swp __rte_unused,
>  	ev->queue_id = rxq->ev.queue_id;
>  	ev->priority = rxq->ev.priority;
> 
> -	ev->event_ptr = sec_fd_to_mbuf(fd);
> +	crypto_op = sec_fd_to_mbuf(fd);
>  	dqrr_index = qbman_get_dqrr_idx(dq);
>  	*dpaa2_seqn(crypto_op->sym->m_src) = dqrr_index + 1;
>  	DPAA2_PER_LCORE_DQRR_SIZE++;
>  	DPAA2_PER_LCORE_DQRR_HELD |= 1 << dqrr_index;
>  	DPAA2_PER_LCORE_DQRR_MBUF(dqrr_index) = crypto_op->sym->m_src;
> +	ev->event_ptr = crypto_op;
>  }
> 
>  int
> --
> 2.25.1


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

end of thread, other threads:[~2022-07-19 11:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-28  3:44 [PATCH 20.11] crypto/dpaa2_sec: fix crypto operation pointer Gagandeep Singh
2022-07-19 11:11 ` Xueming(Steven) Li

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