From patchwork Tue Nov 5 14:02:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olivier Moysan X-Patchwork-Id: 13863006 Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) (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 D52E93BBC9; Tue, 5 Nov 2024 14:10:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.207.212.93 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730815816; cv=none; b=ZAwTHxXkc0y+yEaZ+opHVIxQiefIjVdGJkAyva1a0qiT7NkO96B7E0CHOwzpih+GOOXisZC7w6KcXj2OYpdy5Jk/INN8jzMpg7S+f1BSLCWOCrT95XPmRX5RUgV4j8MOPOCoy4k8QbyB3uemY3ED5dRyz9c2wxShq33lLIIE1f8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730815816; c=relaxed/simple; bh=2jgdjl1sahrjzuVXc/VmgFbPQ6N0LL7xdmWkPn03TV4=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=jlK3ixYCtonI8eetySEflUtGj97trTMOlSMv5u+kyspbpdrFQlx3qHtyZqfdNf8waQHAt8uGI2cP8GoPPAJ/+j//Up7kcDXR7u5EVBkNo8Pmj2Y0NykcZZqBaptRISeTrQmD3Q5HiPgzdAO7VSMjGB5+j6XwG3iupUMuOLZ0GFA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com; spf=pass smtp.mailfrom=foss.st.com; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b=rFxDHAs2; arc=none smtp.client-ip=91.207.212.93 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foss.st.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="rFxDHAs2" Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4A5CGuu3004386; Tue, 5 Nov 2024 15:09:44 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= cc:content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=selector1; bh=DBZ37o87693Es4cCNyLxHr d7NY4Ze7ssSN37sw3EsrI=; b=rFxDHAs2Zg4JtmHgavsKyIJBSzB8uluibICj1n bQc5gX40ZUVHlzrHdvSZS+0H8eTfOS4P6bPIvFBbzIP94RTJ33vQB1PfoOS9UTmC ZKS/qiL8NVPtL+TfZrxKwiPfX2TLspHlAlKnvi2CqV+SRoeGoquKi5n8Xj5I1HZF REju30cgTt3NNjAxuaqnc4AFwnLsYPZw/xcxcgXrnvSYPTzLXbphaXmQ7lwp8Knf bDjbuuP0A92IR6UDPVSfTy/qvGcjQltjha5haNsSkDVQKli/XZlFVlHAoZaY8+PR Cwd2owMt3V+EbV9pBpR9KiUtFBy7leScXIOFahvlL353nrsg== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 42nd00488c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 05 Nov 2024 15:09:44 +0100 (CET) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 2642D40049; Tue, 5 Nov 2024 15:08:35 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 8DDA22676BC; Tue, 5 Nov 2024 15:07:49 +0100 (CET) Received: from localhost (10.252.16.126) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Tue, 5 Nov 2024 15:07:49 +0100 From: Olivier Moysan To: , Olivier Moysan , Arnaud Pouliquen , Liam Girdwood , "Mark Brown" , Jaroslav Kysela , Takashi Iwai , Maxime Coquelin , "Alexandre Torgue" CC: Olivier Moysan , , , , Subject: [PATCH 1/1] ASoC: stm32: spdifrx: fix dma channel release in stm32_spdifrx_remove Date: Tue, 5 Nov 2024 15:02:42 +0100 Message-ID: <20241105140242.527279-1-olivier.moysan@foss.st.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SHFCAS1NODE1.st.com (10.75.129.72) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 From: Amelie Delaunay In case of error when requesting ctrl_chan DMA channel, ctrl_chan is not null. So the release of the dma channel leads to the following issue: [ 4.879000] st,stm32-spdifrx 500d0000.audio-controller: dma_request_slave_channel error -19 [ 4.888975] Unable to handle kernel NULL pointer dereference at virtual address 000000000000003d [...] [ 5.096577] Call trace: [ 5.099099] dma_release_channel+0x24/0x100 [ 5.103235] stm32_spdifrx_remove+0x24/0x60 [snd_soc_stm32_spdifrx] [ 5.109494] stm32_spdifrx_probe+0x320/0x4c4 [snd_soc_stm32_spdifrx] To avoid this issue, release channel only if the pointer is valid. Fixes: 794df9448edb ("ASoC: stm32: spdifrx: manage rebind issue") Signed-off-by: Amelie Delaunay Signed-off-by: Olivier Moysan --- sound/soc/stm/stm32_spdifrx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/stm/stm32_spdifrx.c b/sound/soc/stm/stm32_spdifrx.c index d1b32ba1e1a2..9e30852de93c 100644 --- a/sound/soc/stm/stm32_spdifrx.c +++ b/sound/soc/stm/stm32_spdifrx.c @@ -939,7 +939,7 @@ static void stm32_spdifrx_remove(struct platform_device *pdev) { struct stm32_spdifrx_data *spdifrx = platform_get_drvdata(pdev); - if (spdifrx->ctrl_chan) + if (!IS_ERR(spdifrx->ctrl_chan)) dma_release_channel(spdifrx->ctrl_chan); if (spdifrx->dmab)