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 A754945B1C; Sat, 12 Oct 2024 11:28:31 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8BE0E4060B; Sat, 12 Oct 2024 11:28:23 +0200 (CEST) Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) by mails.dpdk.org (Postfix) with ESMTP id 7EF71402EB for ; Sat, 12 Oct 2024 11:28:20 +0200 (CEST) Received: from mail.maildlp.com (unknown [172.19.88.163]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4XQdTL5NBzz1ymxZ; Sat, 12 Oct 2024 17:28:22 +0800 (CST) Received: from kwepemf500004.china.huawei.com (unknown [7.202.181.242]) by mail.maildlp.com (Postfix) with ESMTPS id AC2D4180019; Sat, 12 Oct 2024 17:28:17 +0800 (CST) Received: from localhost.localdomain (10.28.79.22) by kwepemf500004.china.huawei.com (7.202.181.242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Sat, 12 Oct 2024 17:28:17 +0800 From: Jie Hai To: , , , Chengwen Feng , Kevin Laatz , Bruce Richardson , Conor Walsh CC: , Subject: [RESEND 1/2] dmadev: fix potential null pointer access Date: Sat, 12 Oct 2024 17:17:34 +0800 Message-ID: <20241012091735.24012-2-haijie1@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20241012091735.24012-1-haijie1@huawei.com> References: <20241012091735.24012-1-haijie1@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemf500004.china.huawei.com (7.202.181.242) 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 From: Chengwen Feng When rte_dma_vchan_status(dev_id, vchan, NULL) is called, a null pointer access is triggered. This patch adds the null pointer checker. Fixes: 5e0f85912754 ("dmadev: add channel status check for testing use") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng --- lib/dmadev/rte_dmadev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dmadev/rte_dmadev.c b/lib/dmadev/rte_dmadev.c index 845727210fab..60c3d8ebf68e 100644 --- a/lib/dmadev/rte_dmadev.c +++ b/lib/dmadev/rte_dmadev.c @@ -741,7 +741,7 @@ rte_dma_vchan_status(int16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status * { struct rte_dma_dev *dev = &rte_dma_devices[dev_id]; - if (!rte_dma_is_valid(dev_id)) + if (!rte_dma_is_valid(dev_id) || status == NULL) return -EINVAL; if (vchan >= dev->data->dev_conf.nb_vchans) { -- 2.22.0