From nobody Mon Sep 28 23:06:42 2026 Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E5D3B3515EC for ; Sat, 15 Aug 2026 16:27:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786811246; cv=none; b=mhi0QBjZEI2u0CeCuL0Ygi+heoJXflA6qB+AfSt9VF6w4Yvt13Ntc6396iM3ucBES1laH5H+4U2+VYXLSmkdACG+DeXtZmv0MY4vmeV+qrxDZjpjWKy8RtNJjtNyMwVtHokWPip0q4dUopzWcf8TF+e04987TEVybFs9tlQN+bM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786811246; c=relaxed/simple; bh=Ria57sgjRM6qX6xpXmPX5TAIguxFpNSG6u/CIEFECzY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=liAsz8Hz99kPaemJQcrLs/FY6URh9TYU36TcUwhuBGWXuw4HFwj83v7L0XknwT5B60uHN00EFO7xI3uQ9lqb70I5VvHFQfw5S8DVTIx20oCBjjopYfk9Z3iv4hbdNPY5DyxK4Drv2PHmdhhilDMYLK/mb+tuTiqBzF+ydqLymEc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=m9zEOU8/; arc=none smtp.client-ip=209.85.216.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="m9zEOU8/" Received: by mail-pj1-f46.google.com with SMTP id 98e67ed59e1d1-38f0f132f56so2653082a91.0 for ; Sat, 15 Aug 2026 09:27:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786811244; x=1787416044; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=/7rlTdXPQx8KtQhzgq3ccigzE8IVB9jSLAgF9XPuDuY=; b=m9zEOU8/cJDlwbeRhJMxYBUNw5pMtryhAkR/2yY+r3P0sCwjCZnLrOsLAemxJPmcp2 EdOcAgSyJ0gA/sQww/U83o7iVwtKA6rcD6YSAtNNuaxwEfkKsJPn83Ic36GCE2IuzcpR 6SYGYdS75yjU9MYcx9oufJvJ+7swHfaas0YMYHTPo/k6O04JyVPjD8pJyZKQpw1bDagR 29fJwzWds43u6Ep+CGcWIpVNjuWSCwAhL3SPO2zRMDrpP7GZn2rcUDdncrCiSQ8+Xmaq QVHHDffCekMw+tLVuj0LgqneisjDBzWAlwg9h8waIYzoE97NP8U0xAaJg8zBvSKKskzE x34g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786811244; x=1787416044; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=/7rlTdXPQx8KtQhzgq3ccigzE8IVB9jSLAgF9XPuDuY=; b=Mpwx3UbFPi5VWAZqVHoZNHRSXmgn20NecjXUh9XgglkaeDyClDigu1xl6lPSOg2And +fVOobFy8R3QzoLQO3Y+k3DjPT/r6CA2fXq/aPQbsTqQr1jwU3zXYPqdGsKMMzfh4+er HojIUro86ncPCj0G7t/qm8qMEd7qTSWNnoQcgJLLiiEBK4qctP9x1DVZd6T9Ang/dRpU nUBSCRtri5QZDDFR3KGJUuDvPcl3+M0BXOn1ZjXZBDDB8AFxqBS5ze/ijCRuAI7eNSXh 6P50L3zMS6eabKDN9Fou9ItWGoothDDtAT/3a6VGiMx1jjZmavFPh7I2DdYLhRT/BPyW B3Xw== X-Forwarded-Encrypted: i=1; AHgh+RruomCuxU7AkJTq/NgYbcOHfZaDHzDUzQkvJr0WR+PziyIOJyB1xPRVOAdhHotQF/2u6BWfUcicwSsGems=@vger.kernel.org X-Gm-Message-State: AOJu0YwcdaWxM+5vnhbjfkpTGIZy0WJg016oRLMOveTw7G+FZCYK6fWT E/mLaxsWXcRKx2jEoMd7GWO17dhCyIuC1OtFSHQ5g8mPAex1YGToKVFq X-Gm-Gg: AR+sD12e+oE4oC4L+p4sLwU/62Ct8vgYqmwUd/uK/AMQp+N59RZgnDmQHbka/efvNNy fYbaxRtdQtJRJ4LOdZzncogt4LDAKXimImMxIIPiG77oUeVYItGCKVx1OVkqvmVgJaF/B9CfATN ejPymGy8N9oYmb5Hix60fhV02yrCiEnOEdSpl2I+iTS5xXewW2vvsay1T+iXMHj5wJ9q5TSZwjr jBFQhR28fgV+BhnrQ2akdfqYDCm4YGw9/cgac9yD3guigAkO6IS72GfjfLqWRDlIY77qFW8vMly aU0EGUbFvCUGLmlMQ3wh0HxIZU//sWGL6GTRF2NJO7ydR3+qq2mbpYdUfUT0X5UanQx2ir88PfB 5EVb5vrdJYZ1LhxekPfkA71RQsVhXXnmHcntiaCq2q5TO5kdaBstSUIBzQxeEjvT9WYTApVLI/o UOJafjXB8PMjw44/O8lD2a0eeXL9UopjhXM4Ls8EuKrvXjUX/J/5NY3nfIVZNYecVs6v45EwXSq NM51tKRQkJSZAx3k0u+Mrw2mkg797DQ X-Received: by 2002:a17:90b:37c3:b0:390:84db:888e with SMTP id 98e67ed59e1d1-3933afb4ba2mr11298200a91.7.1786811244193; Sat, 15 Aug 2026 09:27:24 -0700 (PDT) Received: from Ubuntu.. ([49.43.242.113]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-141387ed5b1sm36427232c88.8.2026.08.15.09.27.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Aug 2026 09:27:23 -0700 (PDT) From: Manish Baing To: perex@perex.cz, tiwai@suse.com, nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com, claudiu.beznea@tuxon.dev Cc: linux-sound@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, manishbaing2789@gmail.com, Sashiko AI Subject: [PATCH 1/2] ASoC: sound: atmel: ac97c: Fix IRQ handler null pointer dereference Date: Sat, 15 Aug 2026 16:27:05 +0000 Message-ID: <20260815162707.353893-2-manishbaing2789@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260815162707.353893-1-manishbaing2789@gmail.com> References: <20260815162707.353893-1-manishbaing2789@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" In atmel_ac97c_probe(), request_irq() is called before ioremap(). If an interrupt fires immediately, the handler atmel_ac97c_interrupt() will attempt to dereference chip->regs via ac97c_readl(), leading to a null pointer dereference and kernel panic. Move request_irq() to the end of the probe function, after memory is mapped and clocks are enabled, ensuring the hardware is fully ready before interrupts are serviced. Running make W=3D1 returns no errors. I was unable to test the patch because I do not have the hardware. The issue was flagged by the Sashiko AI bot. Link: https://sashiko.dev/#/patchset/20260530052812.115994-1-manishbaing278= 9@gmail.com?part=3D1 Reported-by: Sashiko AI Signed-off-by: Manish Baing --- sound/atmel/ac97c.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sound/atmel/ac97c.c b/sound/atmel/ac97c.c index e394205f469b..205475157e72 100644 --- a/sound/atmel/ac97c.c +++ b/sound/atmel/ac97c.c @@ -733,11 +733,6 @@ static int atmel_ac97c_probe(struct platform_device *p= dev) =20 chip =3D get_chip(card); =20 - retval =3D request_irq(irq, atmel_ac97c_interrupt, 0, "AC97C", chip); - if (retval) { - dev_dbg(&pdev->dev, "unable to request irq %d\n", irq); - goto err_request_irq; - } chip->irq =3D irq; =20 spin_lock_init(&chip->lock); @@ -785,6 +780,12 @@ static int atmel_ac97c_probe(struct platform_device *p= dev) goto err_ac97_bus; } =20 + retval =3D request_irq(irq, atmel_ac97c_interrupt, 0, "AC97C", chip); + if (retval) { + dev_dbg(&pdev->dev, "unable to request irq %d\n", irq); + goto err_request_irq; + } + retval =3D snd_card_register(card); if (retval) { dev_dbg(&pdev->dev, "could not register sound card\n"); --=20 2.43.0 From nobody Mon Sep 28 23:06:42 2026 Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EFDB942589A for ; Sat, 15 Aug 2026 16:27:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786811266; cv=none; b=kW8lqMcL2274fvYrD969TqGQWHUQ3V0dO3eoyVqDwZNdW54xfji7g+Yz707Je/3nKa85XuBZGU68bkE6J29njs49jF8Vq4oJB8qg9BIbB/ohYxfzk7GdJ1XnPgnM5IdyGbYxm2SNm+d8VEz7eWiB0TwcwlK3nH9agpqFEaDAYlQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786811266; c=relaxed/simple; bh=Btt4iLPBCTz3XYDO6c2R703syxLmssC5uJR4QwFg5VQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZuRA30QZIXZvtAZHULVKqBG4fSMhmXmN3R2TeQj1XuLsNVwzkZ3zwzjIth4cMAwSN2IsfsU7H1fqgSk040aIEvtMBNpqon1Nwzn7I1oj1RqlxW3Tt/W6YZiVZD4UY183itYN5yNycB+AM522pSdcXGSZsqdOBGO8kn0uOKRAC8Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=pEbWYNzx; arc=none smtp.client-ip=209.85.215.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="pEbWYNzx" Received: by mail-pg1-f176.google.com with SMTP id 41be03b00d2f7-cbb8b54fcf8so1864957a12.0 for ; Sat, 15 Aug 2026 09:27:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786811264; x=1787416064; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=u0aZhTYimAntKdzPJKS6oC7Sa1HRLwmKSoA78yTWTLs=; b=pEbWYNzxZ01J1kiRIocnsAEtlxpMyhxltXoosY3VoUd3AO9Zgj0YDj2bdC1BxYqFQG zDozdWrS47u7Y+Z+8uY3wZG3BuTH32oFgJdIwdVqotOOv8PsDkh4kMtMZNiKK2xIlIA2 u8aEdp0Mp7se87wD66Qak8hdhkNKqbFtnu3pdPPz7Kb+6+eqv64PzRGv1nj2zfavGwUa Il22R1VXXuH3LgyVCLVwWLKenYmds9kfEjlJqI9Nr7rPMK8rCZeIYED4McEezAUi1jLl /li8RAGPHY+OV9Ez658ZX5+hssH1gSx5q8O2UnXzWLxPxWgauNBYg0KA1vUiS7cwx2FR VuQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786811264; x=1787416064; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=u0aZhTYimAntKdzPJKS6oC7Sa1HRLwmKSoA78yTWTLs=; b=kdORqSP2UqNcapX0uigbLcYhhftlc5rjQc1R2hiuCllufnHRdWWELa0Gt+EIjtWwAC OPSAJq9jSjatV76woFEF19a1d45TmSZitWg+KIs4IYDY4cvhvuxB+UhgxwdKu/yPlVF6 rEwkh+2xwA6Gh4yu/C2GVDZk42wSkOoaeREvq7DYhesffFnIccgvkEDYhQyfpTX1OJ5u Lb7Hb5k9kYtdr0zubSTKPa+n8tUzTK6kaSIEWKzsqmwzRy/+SOGZB6aOed3zstArMoFU +bgiJ8YdK1CKVfxqmxjaGMvUDHXbrbsDE70w8uQm6hIKOuMKHqI1VRwzyzPk+HTUbTm8 rLNQ== X-Forwarded-Encrypted: i=1; AHgh+RraGyXj6/VXE1wx9bMkRxelZGW72FVtgf4nOyjDsucryBh8LO2glGsl7UB/7STMMz08iTG1bHdlGffo5Nk=@vger.kernel.org X-Gm-Message-State: AOJu0YxGc55fja4ZbxwHnh/K/U+xQYxIGHfo1R5NcpDNCjOzx9HLIa2n kYII7UQrfaXuxd2JCMUbZ9zXVFGeAGx0TwbORY4rZ0OZN1N3sOUh5Hcq X-Gm-Gg: AR+sD126x5+oUOHlHBAsS1kW4b2pgMb/VP1YPFgWDCT1HzBemY62SquChmUiHGwbAhW eqx4Lyldu49wFNLFOXHNGsI0mkBs9FbHCTErFYMFB1cjW26vyFRAP4jIazcU0oxl1OyZNWYOQ+/ 8xyAUs8mworhU0VKLU3Q/VknVfBsKfIBx0/+HLw24+zeXobfwvEIbgG9pzJxu9fDE42d0QIzNVr gf9q6KI+cdhxFj0WmmLV0fkXlQHwJAP/1egT2q8MXZGJeEV32YZvzHSsRgxiqFf1AET6TyxWVLx FgwBVqTL4zZOOA3zTofTRoDSk2B47WEJvACkVuXPLErUC0RNM426XpIoYGEXvdnoVbTuC4l1pI1 InGw0hxBFgo+uZyuSW1rUZd7Z7Tl+gPWyWu/eZneMkD0f1CvYjMid6bTAMlOole28n+MEDRfOl0 3q0sR5MowjBe1anTJMBozfb0Gd5/DRmEGqwRyF/4WSUKSIxmRRt1OCyXS3vy7Lk+28yr+KyofDQ aqDpyFRNOdcZjSaSZ7QNq+fgIoFx4z6 X-Received: by 2002:a05:6a21:7111:b0:3b1:882a:607b with SMTP id adf61e73a8af0-3cc71d24898mr16890086637.22.1786811264197; Sat, 15 Aug 2026 09:27:44 -0700 (PDT) Received: from Ubuntu.. ([49.43.242.113]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-141387ed5b1sm36427232c88.8.2026.08.15.09.27.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Aug 2026 09:27:43 -0700 (PDT) From: Manish Baing To: perex@perex.cz, tiwai@suse.com, nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com, claudiu.beznea@tuxon.dev Cc: linux-sound@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, manishbaing2789@gmail.com, Sashiko AI Subject: [PATCH 2/2] ASoC: atmel: ac97c: Fix use-after-free on driver teardown Date: Sat, 15 Aug 2026 16:27:06 +0000 Message-ID: <20260815162707.353893-3-manishbaing2789@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260815162707.353893-1-manishbaing2789@gmail.com> References: <20260815162707.353893-1-manishbaing2789@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" In atmel_ac97c_remove() and the probe error path, the driver disables clocks and unmaps memory before freeing the IRQ. If a stray interrupt fires during this window, the handler will attempt to access unmapped memory or unclocked hardware, resulting in a kernel panic. Reorder the teardown sequence to call free_irq() first, adhering to the standard reverse-initialization order. Running make W=3D1 returns no errors. I was unable to test the patch because I do not have the hardware. The issue was flagged by the Sashiko AI bot. Link: https://sashiko.dev/#/patchset/20260530052812.115994-1-manishbaing278= 9@gmail.com?part=3D1 Reported-by: Sashiko AI Signed-off-by: Manish Baing --- sound/atmel/ac97c.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sound/atmel/ac97c.c b/sound/atmel/ac97c.c index 205475157e72..24a27e67f15f 100644 --- a/sound/atmel/ac97c.c +++ b/sound/atmel/ac97c.c @@ -789,7 +789,7 @@ static int atmel_ac97c_probe(struct platform_device *pd= ev) retval =3D snd_card_register(card); if (retval) { dev_dbg(&pdev->dev, "could not register sound card\n"); - goto err_ac97_bus; + goto err_snd_card_register; } =20 platform_set_drvdata(pdev, card); @@ -799,11 +799,12 @@ static int atmel_ac97c_probe(struct platform_device *= pdev) =20 return 0; =20 +err_snd_card_register: + free_irq(irq, chip); err_ac97_bus: +err_request_irq: iounmap(chip->regs); err_ioremap: - free_irq(irq, chip); -err_request_irq: snd_card_free(card); err_snd_card_new: clk_disable_unprepare(pclk); @@ -841,10 +842,10 @@ static void atmel_ac97c_remove(struct platform_device= *pdev) ac97c_writel(chip, COMR, 0); ac97c_writel(chip, MR, 0); =20 + free_irq(chip->irq, chip); clk_disable_unprepare(chip->pclk); clk_put(chip->pclk); iounmap(chip->regs); - free_irq(chip->irq, chip); =20 snd_card_free(card); } --=20 2.43.0