From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from ale.deltatee.com (ale.deltatee.com [204.191.154.188]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2A8F43B14C1; Mon, 27 Jul 2026 18:12:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=204.191.154.188 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785175972; cv=none; b=S5JknQqaf2vVMKnw1MAoF7tG0W6txcn4S5QmmW301MMcJw6fH16lXC+ZG5Sqzd/fiV2X0Ir8bVgX13ACIWF3TlsO8gB66wKYH9xKNI8lhsmZoBoBvTcaEmuOrXC0MKi6S9FzO3kDPUR40LHqp49haqTYqYjrU79xnivh7usLglg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785175972; c=relaxed/simple; bh=c1RDThDu/yg04bQSvgQI5zZi0YfbwuOZe497uObnO8I=; h=From:To:Cc:Date:Message-ID:In-Reply-To:References:MIME-Version: Subject; b=kWVPdSL9eIj3Qkm1UE0sGMyaVdyhFWeTSsxPxBCZR0KxlRbfU6+hm3CZhcgftfZH0bnh0EZhKcvReOi6/p4WStGHn/Hu4/uWOR71CXYZYzrLHTpI6QbCN4SlWey7EwNk5TgCS/aQmYqD0XB1EIq6z3HcXiUxBeWuIJPd3kkgOfs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=deltatee.com; spf=pass smtp.mailfrom=deltatee.com; dkim=pass (2048-bit key) header.d=deltatee.com header.i=@deltatee.com header.b=D1wL5dpz; arc=none smtp.client-ip=204.191.154.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=deltatee.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=deltatee.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=deltatee.com header.i=@deltatee.com header.b="D1wL5dpz" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=deltatee.com; s=20200525; h=Subject:MIME-Version:References:In-Reply-To: Message-ID:Date:Cc:To:From:content-disposition; bh=yNCvsxX1ZdcmE8oOIwPo/bMfv+7yuyYsTjy6+dHYoIo=; b=D1wL5dpzYuuoxyZ4C5WSfdQRF7 rdaDLVbf5pcPxq8wk3N54W29j0rsJEoGMT69e4n8Gdmy2BcKpHJc4/RODHea8YlX5++BGkobX7XlK cqODhkDdmcZ54HFlce3z8BQQmzj8Wz0AgTYeXgM2g8IWAEGkkS1Ro0gRNoLCn4kZY18HoTvDKwlWS hlJLQDLwGzZc1uLGRVJL/EKQvXdfwIZxc+XqyVXBv6Lza2WDKpNOBmZHsUbV885D0hXgxmiwVtPWj AOx6p4SVJUfBS53wIqduSOIUiSoh5HOzFvw6JkZIXiac7ULpQ9OyUUfts01tC0CYpHAU90sjhtvTH dEc3STtw==; Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1woPom-000000004uz-3nuq; Mon, 27 Jul 2026 12:12:49 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.98.2) (envelope-from ) id 1woPRQ-000000001jy-2ksL; Mon, 27 Jul 2026 11:48:40 -0600 From: Logan Gunthorpe To: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, dmaengine@vger.kernel.org, Vinod Koul Cc: Frank Li , Kelvin Cao , =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , Dave Jiang , George Ge , Jaeyoung Chung , Logan Gunthorpe , Sangyun Kim , Kyungwook Boo Date: Mon, 27 Jul 2026 11:48:36 -0600 Message-ID: <20260727174837.6645-7-logang@deltatee.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260727174837.6645-1-logang@deltatee.com> References: <20260727174837.6645-1-logang@deltatee.com> Precedence: bulk X-Mailing-List: dmaengine@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, dmaengine@vger.kernel.org, vkoul@kernel.org, Frank.li@nxp.com, linux@weissschuh.net, dave.jiang@intel.com, kelvin.cao@microchip.com, george.ge@microchip.com, logang@deltatee.com, jjy600901@snu.ac.kr, sangyun.kim@snu.ac.kr, bookyungwook@gmail.com X-SA-Exim-Mail-From: gunthorp@deltatee.com X-Spam-Level: Subject: [PATCH v1 6/6] dmaengine: plx_dma: fix NULL pointer deref in plx_dma_isr() X-SA-Exim-Version: 4.2.1 (built Sun, 23 Feb 2025 07:57:16 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) plx_dma_create() registered the interrupt handler with request_irq() before initializing plxdev->bar. If the device raised an interrupt in that window, plx_dma_isr() would dereference the still-NULL bar. Move the bar assignment ahead of request_irq() so everything the handler can touch is initialized before it can run. Reported-by: Sangyun Kim Reported-by: Kyungwook Boo Link: https://lore.kernel.org/all/20260610112121.676561-1-jjy600901@snu.ac.kr/T/#u Fixes: c2dbcaa8c672 ("dmaengine: plx-dma: Implement hardware initialization and cleanup") Signed-off-by: Logan Gunthorpe --- drivers/dma/plx_dma.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/dma/plx_dma.c b/drivers/dma/plx_dma.c index 84941a918b01..409898e92c32 100644 --- a/drivers/dma/plx_dma.c +++ b/drivers/dma/plx_dma.c @@ -504,17 +504,17 @@ static int plx_dma_create(struct pci_dev *pdev) if (!plxdev) return -ENOMEM; - rc = request_irq(pci_irq_vector(pdev, 0), plx_dma_isr, 0, - KBUILD_MODNAME, plxdev); - if (rc) - goto free_plx; - spin_lock_init(&plxdev->ring_lock); tasklet_setup(&plxdev->desc_task, plx_dma_desc_task); RCU_INIT_POINTER(plxdev->pdev, pdev); plxdev->bar = pcim_iomap_table(pdev)[0]; + rc = request_irq(pci_irq_vector(pdev, 0), plx_dma_isr, 0, + KBUILD_MODNAME, plxdev); + if (rc) + goto free_plx; + dma = &plxdev->dma_dev; INIT_LIST_HEAD(&dma->channels); dma_cap_set(DMA_MEMCPY, dma->cap_mask); -- 2.47.3