From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 9464344AB6A; Tue, 21 Jul 2026 22:33:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784673204; cv=none; b=fSTJB6RYIaSbcAXtzOwMkGwrFACOm1SSuAsmz3wZNJPgwQdqlmXm7Qc2ItJ5UnJ+j/73D1EkcWAgTs7YzdQ6OU5Dim3CaTr2OKCYG27bZ6ZhjzHkLsxxLbycaN8nD84/TXy1qZvrZUmYqh7ttrqyCX3NbBrUAzAaL2Fe5TA0lxM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784673204; c=relaxed/simple; bh=8LvQWMVguLHGdobqGe7IQOIFArBbDjiB7dEvt0Owj64=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Tcva6qWwjtRMTvTbOoeEo9D3nFoqgIuiGZn+7xx24yO5/4iI89twd3diykYqClLjqx+ZOPrkU7EpiHmxpASp2vkCjsQx2fO3EvwbfjM4CB+GN4mlbZd1CSEqzxJ4CbrQu1FvR/ryY5dxYZFfcxrGH7ljoY/vF+ea3tSFV9eLATc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=eecJto3m; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="eecJto3m" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B62A1F000E9; Tue, 21 Jul 2026 22:33:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784673203; bh=N9WjlFOFELkxFuCr45QjLFOztcYGlUd2mL9/MNqRaAg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=eecJto3mvV2MHE9YYIDwXGsC5KOFbmqxk40rQcrqHRsvHqsY6GIHEkmWmjkToMTwT B0dYC6GpdFmNghMnso77eYFJJUzlTgSLAr3RD7TAGGT48wXimNa221V81jhCNIxRIz xSKcvVlOeeVRZ5OOKVry83cUx1qTTTEUL8pxLZwo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sangyun Kim , Kyungwook Boo , Jaeyoung Chung , Maxwell Doose , Vladimir Zapolskiy , Stable@vger.kernel.org, Jonathan Cameron Subject: [PATCH 5.10 037/699] iio: adc: lpc32xx: Initialize completion before requesting IRQ Date: Tue, 21 Jul 2026 17:16:36 +0200 Message-ID: <20260721152356.545885848@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152355.667394603@linuxfoundation.org> References: <20260721152355.667394603@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Maxwell Doose commit e561b35633f450ee607e87a6401d97f156a0cd54 upstream. In the report from Jaeyoung Chung: "lpc32xx_adc_probe() in drivers/iio/adc/lpc32xx_adc.c registers its interrupt handler with devm_request_irq() before it initializes st->completion with init_completion(). If an interrupt arrives after devm_request_irq() and before init_completion(), the handler calls complete() on an uninitialized completion, causing a kernel panic. The probe path, in lpc32xx_adc_probe(): iodev = devm_iio_device_alloc(&pdev->dev, sizeof(*st)); /* st kzalloc-zeroed */ ... retval = devm_request_irq(&pdev->dev, irq, lpc32xx_adc_isr, 0, LPC32XXAD_NAME, st); /* register handler */ ... init_completion(&st->completion); /* initialize completion */ lpc32xx_adc_isr() calls complete(): complete(&st->completion); If the device raises an interrupt before init_completion() runs, complete() acquires the uninitialized wait.lock and walks the zeroed task_list in swake_up_locked(). The zeroed task_list makes list_empty() return false, so swake_up_locked() dereferences a NULL list entry, triggering a KASAN wild-memory-access." Fix the chance of a spurious IRQ causing an uninitialized pointer dereference by moving init_completion() above devm_request_irq(). Fixes: 7901b2a1453e ("staging:iio:adc:lpc32xx rename local state structure to _state") Reported-by: Sangyun Kim Reported-by: Kyungwook Boo Reported-by: Jaeyoung Chung Closes: https://lore.kernel.org/linux-iio/20260610115700.774689-1-jjy600901@snu.ac.kr/ Signed-off-by: Maxwell Doose Reviewed-by: Vladimir Zapolskiy Cc: Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/adc/lpc32xx_adc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/iio/adc/lpc32xx_adc.c +++ b/drivers/iio/adc/lpc32xx_adc.c @@ -176,6 +176,8 @@ static int lpc32xx_adc_probe(struct plat if (irq <= 0) return -ENXIO; + init_completion(&st->completion); + retval = devm_request_irq(&pdev->dev, irq, lpc32xx_adc_isr, 0, LPC32XXAD_NAME, st); if (retval < 0) { @@ -194,8 +196,6 @@ static int lpc32xx_adc_probe(struct plat platform_set_drvdata(pdev, iodev); - init_completion(&st->completion); - iodev->name = LPC32XXAD_NAME; iodev->info = &lpc32xx_adc_iio_info; iodev->modes = INDIO_DIRECT_MODE;