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 E7A19367B92; Tue, 21 Jul 2026 21:55:18 +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=1784670920; cv=none; b=V4lkRgO90mKQKwJz2/qJJGc2pa6kHImVhUGuuD9AQqqJxKafwf+krHMhrlDd2KjYs5UGfnLmBNx0bpSryGw4Z0MIpphZuOR3YQUkn0Eivx3NSbVOBu/XgDX2qGill6GEVVHcjLwT/5H6E0NC+ePAuhQS8wSO5lAZl5hIgNK4Gxo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784670920; c=relaxed/simple; bh=gpRnnqEVjC+p26xxtq+rXGSpiLOkGn09vJvbKl2rR5A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mtq9QIwODYuk4J9DU2HpA/EeR/8fhkrQq/ruUldqEhkR8c+it0pKi/8VlR/5jze1cs69YoBqdV8T37uaMuGQweFl2+PkZNWzwAY9X21bpRleQrsnqPygmuYnQ8tbEftZGtxPGrpvSyg4aQbAUCIu6dFFjeruUA4QQOMmdFIC96M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=D0cP3Pp2; 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="D0cP3Pp2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FAE71F00A3A; Tue, 21 Jul 2026 21:55:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784670918; bh=ZiGIZgOVVlmsFbDL3w/45M/tszOhGQ6uH8aleVyGh2E=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=D0cP3Pp21OZvMT1yl75nqFWVG0p/lhNYWD2bAK6YOsKUgz9JPMTemC3HFI/O0QL6G 2ds7PFPdtp3W/Z0Aox5kheH1qadPAwQ6/Y8qW0OKf/Tn3khImBBU8t0E0v+OReNGNB WL75hOL5MLoq0ux6LuO05thAHKFCDjHicFYvHDrE= 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.15 051/843] iio: adc: spear: Initialize completion before requesting IRQ Date: Tue, 21 Jul 2026 17:14:46 +0200 Message-ID: <20260721152407.132045437@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152405.946368001@linuxfoundation.org> References: <20260721152405.946368001@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.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Maxwell Doose commit 3ee2128b6f0eb0be7b6cb8f6e0f1f113a65201a0 upstream. In the report from Jaeyoung Chung: "spear_adc_probe() in drivers/iio/adc/spear_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 spear_adc_probe(): iodev = devm_iio_device_alloc(&pdev->dev, sizeof(*st)); /* st kzalloc-zeroed */ ... retval = devm_request_irq(&pdev->dev, irq, spear_adc_isr, 0, LPC32XXAD_NAME, st); /* register handler */ ... init_completion(&st->completion); /* initialize completion */ spear_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: b586e5d9eee0 ("staging:iio:adc:spear rename device specific 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/spear_adc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/drivers/iio/adc/spear_adc.c +++ b/drivers/iio/adc/spear_adc.c @@ -282,6 +282,7 @@ static int spear_adc_probe(struct platfo st = iio_priv(indio_dev); + init_completion(&st->completion); mutex_init(&st->lock); st->np = np; @@ -346,8 +347,6 @@ static int spear_adc_probe(struct platfo platform_set_drvdata(pdev, indio_dev); - init_completion(&st->completion); - indio_dev->name = SPEAR_ADC_MOD_NAME; indio_dev->info = &spear_adc_info; indio_dev->modes = INDIO_DIRECT_MODE;