Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp264979rdb; Thu, 21 Dec 2023 08:31:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IFzUPfpNtMWiDkv9/g9GoJMjG/F7bcI5j7w/bRRCeGonNhRV4ZFLvflmrcAPRdWUZhStVP1 X-Received: by 2002:a17:902:d2cb:b0:1d0:8db6:17d0 with SMTP id n11-20020a170902d2cb00b001d08db617d0mr13908263plc.25.1703176299702; Thu, 21 Dec 2023 08:31:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703176299; cv=none; d=google.com; s=arc-20160816; b=YG5prVZWQnpyJAwBPrxySci3lSg3mV9gsNkEQhrA28BZ6V17q+G9U68lkPAhkJP3kN ggH87SBKl3Ce08T2zxMZyPHZ94YEvr/NDQklhSm0ZWw62a2hnOxapLXvZcJJey2At9yk Ogf39JiIg60X0WLYlg8a6UuObp3AzDAvzmRfczp6EtYMzogzXPNlSNxfQ1KsL2tf86eB fNV2eRTE2SODHn2Yh27fy+UvJ8YpJoG4eOzycLq+8AqnVNWO5whpISXCJsT/lZm11ulh 2QI0eXWAdC4DXsioZKR4fFmURgzutZM+TS4S5tg0mFhVjzzmnrbImjHNSYh32TR2/zAj Ywaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:subject :references:in-reply-to:cc:to:from:dkim-signature; bh=nwfmOg6DwaPf5Ryj43YBvmlvUPW7FLhFZyE2S+znoAI=; fh=rDJifFgVCPXwwD8stOPjvqHrwhHsVkDQkb3AZqSBBn4=; b=fIzREGzRkaMQl1mECnTRUvXbh26rXQWpjfwvDhd8WLRwUm82QVL5wQ7PMoJQVrpDcM 9WIGrmq1dyIRF7n4iOoFHUsq+16vSKF8whZJpB79oYBv9Bh933OmNg4QLk6hgqLAwC+B a2DDhw52dBtO6bw6UwWRlIDEDbnOzqUIDICsW5r/DgciN3QW3Ly9z/DaFcFRbwqDIalb pEDbQIXEFAEy8ULjAcw3aIow9qa2sJdTP73mcHIfAXkyG+v7Mu0CQonHz/niiyUhMSeI RHBn6kwdM/OYW07GBU2S7GfylmhfASx5CoU8FjXMv8s8NaFWTP6upEBZzlYfntwdyF4I tp5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=P1HrzvHW; spf=pass (google.com: domain of linux-kernel+bounces-8773-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8773-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id n4-20020a170902d2c400b001d3ef794a1fsi1739721plc.465.2023.12.21.08.31.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 08:31:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-8773-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=P1HrzvHW; spf=pass (google.com: domain of linux-kernel+bounces-8773-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8773-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id BA9F3B22F1D for ; Thu, 21 Dec 2023 16:31:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1616962814; Thu, 21 Dec 2023 16:30:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="P1HrzvHW" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 4250B59917; Thu, 21 Dec 2023 16:30:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39A3FC433CA; Thu, 21 Dec 2023 16:30:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703176214; bh=A57ukB5dDklEZ9q0kgCWQa6lMi3LSmaS7YQSckNb91Y=; h=From:To:Cc:In-Reply-To:References:Subject:Date:From; b=P1HrzvHWzb/+3jULyDf6W9QWJPsgKr5LDrGbm1XLEwRz9R0015HLoNtLisFIoKRT+ u753KdaTa2kMDgpHg6AoYVyShNVOVH5p4/+UySAFwdFBjH26xRMrhpbxM59i1E8/ZE 6ty2JTBNAxxjWl9m49KGmFtREZZ5hxgj4t2aymcYH5nE1tWSwJqU6IVEeOnBAhUNZR jben7mscQwQWRFleCIIsDt5E7syQP9KIMeFJE2Tcuv/HIDTK+90x6kunvYqzR/+kdO Kc9nssCHoC60gPXLhc+sKTjYmw6f5gXLwxbyKYjgz+GNg0/eUzV4ED7aJHpcOKZ3dN 3a7MM7miVPoSA== From: Vinod Koul To: Dave Jiang , Amelie Delaunay Cc: linux-stm32@st-md-mailman.stormreply.com, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231213160452.2598073-1-amelie.delaunay@foss.st.com> References: <20231213160452.2598073-1-amelie.delaunay@foss.st.com> Subject: Re: [PATCH] dmaengine: fix NULL pointer in channel unregistration function Message-Id: <170317621281.683420.8268114839792721931.b4-ty@kernel.org> Date: Thu, 21 Dec 2023 22:00:12 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Mailer: b4 0.12.3 On Wed, 13 Dec 2023 17:04:52 +0100, Amelie Delaunay wrote: > __dma_async_device_channel_register() can fail. In case of failure, > chan->local is freed (with free_percpu()), and chan->local is nullified. > When dma_async_device_unregister() is called (because of managed API or > intentionally by DMA controller driver), channels are unconditionally > unregistered, leading to this NULL pointer: > [ 1.318693] Unable to handle kernel NULL pointer dereference at virtual address 00000000000000d0 > [...] > [ 1.484499] Call trace: > [ 1.486930] device_del+0x40/0x394 > [ 1.490314] device_unregister+0x20/0x7c > [ 1.494220] __dma_async_device_channel_unregister+0x68/0xc0 > > [...] Applied, thanks! [1/1] dmaengine: fix NULL pointer in channel unregistration function commit: f5c24d94512f1b288262beda4d3dcb9629222fc7 Best regards, -- ~Vinod