From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 21C28A034C; Thu, 28 Apr 2022 13:49:16 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5179442865; Thu, 28 Apr 2022 13:48:20 +0200 (CEST) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2062.outbound.protection.outlook.com [40.107.20.62]) by mails.dpdk.org (Postfix) with ESMTP id BC7CF4284F; Thu, 28 Apr 2022 13:48:18 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EdX8sg2iPFFEECRSQhmsW4Xfmsmz64byhsASXXNMLP3plG4vd7WdL/J0pc9o+kHf4yxuvQV/Z0NowkTsYsh7uTuZAQ3VxeU1e17nitX2IbiaNS8P4xOHGU59w2Ti3v9zBnBKGO1cEqbvqqbb1pwWhQat7gAxsfWyX/arEsvcaqw9YwcGFk2ovGWdjlutHKjRYMF2ZjI40wnoHgCY5nlkrUet3ZVDCP3WLErEyYjmitSqhnbBgXsAXTZmQkXIcSagCfmWcAp91YaNABO150jSHxy2H6VXFvU42/DMVh3DjAERQNn/T9zmQDdDNAD99ArMFtVDuK4plR55Ufkt5PK8hQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=qE5wOHwxpQ030v6UJ4HYVk+HOhLA8kytV1k9n9KpvtU=; b=K4pvq8TjGELPaKrr/NqwH0SxuNZfuT/92fMP2HOWwpPgkbf7M++TNiMZ7z5a0udfuf+kkiBb16kR8GMrF43+vvfql4u8VGtcbIzqyjiQjpvEjxgemNVk/6VOGJrbzlSow9wgGhQvGGaZYWclmetvstSND+UpDohxFAvMqIG02PG21XSbDsnY2CBUWWqWzRcOE7/39Z0nU3ejGU5qpZPUbqSktObAi7aiejTQS/8IH1Ez1a0SGgDxh6jndGszxxRZQGnxZXUgdYCDm+pPh4CqGjXGN+PtOqE7LpooZ46R/O+OfHUVpLECGbXp1QGQGSMoXF6XBIWz45Q0T0mHcY3Scw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qE5wOHwxpQ030v6UJ4HYVk+HOhLA8kytV1k9n9KpvtU=; b=GQ26+QNj3T2rXYcNojM7XkzBQnMOSL9yGOHi9oMULmxU0VSn2jw/5iPw6M8ehyU1vfc7iLiSDVwSh2fdeSdeS6a1plzjVp6W1G+0JigjHYPND1cd00MWbNqG5X6JlD0s3NEnfffId6R5MRVmkbBs+6As8qEQj4iwo7CJcn78EUc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8198.eurprd04.prod.outlook.com (2603:10a6:20b:3b0::14) by AM9PR04MB8162.eurprd04.prod.outlook.com (2603:10a6:20b:3e3::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5206.13; Thu, 28 Apr 2022 11:48:18 +0000 Received: from AS8PR04MB8198.eurprd04.prod.outlook.com ([fe80::8cf1:93b:c340:3be2]) by AS8PR04MB8198.eurprd04.prod.outlook.com ([fe80::8cf1:93b:c340:3be2%9]) with mapi id 15.20.5206.014; Thu, 28 Apr 2022 11:48:17 +0000 From: Gagandeep Singh To: gakhil@marvell.com, dev@dpdk.org Cc: Gagandeep Singh , stable@dpdk.org Subject: [PATCH v2 10/14] crypto/dpaa2_sec: fix crypto op pointer value Date: Thu, 28 Apr 2022 17:17:29 +0530 Message-Id: <20220428114733.1419957-11-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220428114733.1419957-1-g.singh@nxp.com> References: <20220422035100.3180870-1-g.singh@nxp.com> <20220428114733.1419957-1-g.singh@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI2PR02CA0002.apcprd02.prod.outlook.com (2603:1096:4:194::22) To AS8PR04MB8198.eurprd04.prod.outlook.com (2603:10a6:20b:3b0::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c1a7995e-7a61-4d26-5885-08da290cfc61 X-MS-TrafficTypeDiagnostic: AM9PR04MB8162:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DPFVjopESsrnwo6gXFI55twlzfkbMb3xq98ynMTSKd9Y1tcF4Pllnb7zPmzIYO+RCFqJDG0ZS1+9mGLqAjaYUHLyTKCqWGdldhC3N1b1TlorFaFYThSXTHSVwLZToTf0sIeaAPb2NW83S4Wp1GfWFIC3+Z1Dr3cqPdcLQBl+o6F1tJDTPZwbd/59nzyzPZQtoq+f6gZEfb5ks4d/26lNa279A8246YySDmGy8qTp7oJ+87m8ZShwaTBVhVzGiao9euACsjTu9WzyHUU7GcUsX+BocRl3X6rq/v9L0ua8GwrwnBRCtS5bn+uL5XE6cWu8uG+oakBjwHiTcbf6POht9T511Sxta95GS38GnwZ8RVNPaz82NSYCerkfD6CqkU9rHXdmiPYN1gX3WVBVi+cqslTfKp24w6JKk0ETxrzqv+CDbl/Co+/6NUrnSeoRdqKAjvEYpklb0JHuxXayko6nJ+b+TEEDg38GbWegkVErDQVRyud0zm1AjA+gSOlb0UGlq0tHUgbvanLmLyeql2kct+TpwjQ9LQG88aBzlnzB7xaBrjJ7zYgm+YkAP+9L0lyVBhPzWG+71eTMvFRpY1LE+6TVNqRwzzXFfzz6OsuaRYGo/yD79cNHRbfFV99PYRIcLggYglymPJbDYUiCgLpxJUnOrQi4Od6YRKkPwGbKw/5J9XBfiQH0+DufiOYANMseNO/ctT2QIt2zXgHnXsl4dhCZaXYdJ1bgnapJ0WCATTk84XkaqKAGsCPbPE2ktzA9 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR04MB8198.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(6486002)(508600001)(8676002)(4326008)(66476007)(66556008)(86362001)(66946007)(316002)(55236004)(2906002)(38100700002)(6512007)(38350700002)(26005)(6666004)(6506007)(52116002)(5660300002)(2616005)(1076003)(186003)(83380400001)(8936002)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?HhFvAVhYPLtugJDqn6zPs3sSWRr3TW4qek01EaQGbT18pqxPh/BeqjXZBhp8?= =?us-ascii?Q?OLAFn08e13f0pR6z7ZztL01NXWItv6XwJ/ox919SsgR8dnpe/cozV6eGZre2?= =?us-ascii?Q?KlrI2tPp0NG0ykg7g9+piP1plgjCglVOV12MlgKcxUpga7WmJr5I+A45UjUL?= =?us-ascii?Q?xzBT5mS75CpQrf0rDNCVOxW0PziGb02sjkJhM2OWKV6LSGSuPT0g4e1UH2J2?= =?us-ascii?Q?3TmD6a5MlydpqJWny20M348TYhmW9b6BnmhyTkwRwDViLlJxRO4kpcdfLzi8?= =?us-ascii?Q?AH7eu+cZRs6v/QnwNntCH4Tbtar8jdTuAF0jcP32vNlqcWVID4VMWIvetSdv?= =?us-ascii?Q?3wFomCYhmE9C/AjPOaYejsyOxIfKhwXYdTCzwkk+zlxR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VIjLt0O0xRed7HnLidF9NWfamJP+QspTTc2DS?= =?us-ascii?Q?hBmPNDakjRFmVJ0Eul8CiHSb3jGJq0rEw5b/0oWegxjoqtmsFIl9013pIDbR?= =?us-ascii?Q?+/UtEwKjPqn45wOytg1imOpLCtSNfcnmzBKnexdVivDjKBsj1DhFqMohmCh+?= =?us-ascii?Q?o4q9BxKauaDS4CH9lDGjl/YH9szbrP6GSFuke0FMGDM0rtX8YHm/RtRE+DOs?= =?us-ascii?Q?/bBMuSC+BGlT0tnkg+G6P/qxf03ivMiQ9VgXnZE4pqX9ZPemjSS1cFx20iFs?= =?us-ascii?Q?oTRbBm61yA77Qj9mFhyeiw4qTBZfsfmBlOgFDMxaahQ8IYtVfeCJtHSD8kIO?= =?us-ascii?Q?ntzisX/l/ez0oRGMZRaNLA5t07da+iqGfj/8KvHmfMiFuEXHagD/jC9qirHd?= =?us-ascii?Q?SwXGN0WOmUVaG46NbjeZvXTR6wlUKbmY6YboBUDCE5EA8WEewSqV6UTnR7an?= =?us-ascii?Q?jcGQ/lgx4A=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c1a7995e-7a61-4d26-5885-08da290cfc61 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8198.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Apr 2022 11:48:17.9443 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: r+3dkEUiX8syamUaIFhcqUob3G/XDmcqISK0mbPqxsREyAhzNQBrnW5FdvRhdtHE X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8162 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Driver is filling the crypto_op variable with an invalid value for atomic and ordered 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") Fixes: 4562de326d30 ("crypto/dpaa2_sec: support ordered queue") Cc: stable@dpdk.org Signed-off-by: Gagandeep Singh --- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c index 86c8df241b..9f2b384af9 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c @@ -4019,7 +4019,7 @@ dpaa2_sec_process_atomic_event(struct qbman_swp *swp __rte_unused, { uint8_t dqrr_index; struct dpaa2_sec_qp *qp; - 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)); @@ -4036,12 +4036,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, qp); + crypto_op = sec_fd_to_mbuf(fd, qp); dqrr_index = qbman_get_dqrr_idx(dq); *dpaa2_seqn(crypto_op->sym->m_src) = QBMAN_ENQUEUE_FLAG_DCA | dqrr_index; 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; } static void __rte_hot @@ -4051,7 +4052,7 @@ dpaa2_sec_process_ordered_event(struct qbman_swp *swp, struct dpaa2_queue *rxq, struct rte_event *ev) { - struct rte_crypto_op *crypto_op = (struct rte_crypto_op *)ev->event_ptr; + struct rte_crypto_op *crypto_op; struct dpaa2_sec_qp *qp; /* Prefetching mbuf */ @@ -4069,7 +4070,7 @@ dpaa2_sec_process_ordered_event(struct qbman_swp *swp, ev->sched_type = rxq->ev.sched_type; ev->queue_id = rxq->ev.queue_id; ev->priority = rxq->ev.priority; - ev->event_ptr = sec_fd_to_mbuf(fd, qp); + crypto_op = sec_fd_to_mbuf(fd, qp); *dpaa2_seqn(crypto_op->sym->m_src) = DPAA2_ENQUEUE_FLAG_ORP; *dpaa2_seqn(crypto_op->sym->m_src) |= qbman_result_DQ_odpid(dq) << @@ -4078,6 +4079,7 @@ dpaa2_sec_process_ordered_event(struct qbman_swp *swp, DPAA2_EQCR_SEQNUM_SHIFT; qbman_swp_dqrr_consume(swp, dq); + ev->event_ptr = crypto_op; } int -- 2.25.1