FAILED: patch "[PATCH] iio: adc: spear: Initialize completion before requesting IRQ" failed to apply to 5.10-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x 3ee2128b6f0eb0be7b6cb8f6e0f1f113a65201a0
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026071347-duplex-theatrics-64bf@gregkh' --subject-prefix 'PATCH 5.10.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 3ee2128b6f0eb0be7b6cb8f6e0f1f113a65201a0 Mon Sep 17 00:00:00 2001
From: Maxwell Doose <[email protected]>
Date: Fri, 12 Jun 2026 19:58:11 -0500
Subject: [PATCH] iio: adc: spear: Initialize completion before requesting IRQ
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().
drivers/iio/adc/spear_adc.c +1 -2
@@ -283,6 +283,7 @@ static int spear_adc_probe(struct platform_device *pdev) st =iio_priv (indio_dev); st->dev = dev; +init_completion (&st->completion);mutex_init (&st->lock);/*
@@ -329,8 +330,6 @@ static int spear_adc_probe(struct platform_device *pdev)spear_adc_configure (st); -init_completion (&st->completion); - indio_dev->name =SPEAR_ADC_MOD_NAME ; indio_dev->info = &spear_adc_info; indio_dev->modes =INDIO_DIRECT_MODE ;
PATCH 1/1 iio: adc: spear: Initialize completion before requesting IRQ
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().
--- drivers/iio/adc/spear_adc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/adc/spear_adc.c +2 -2
@@ -274,6 +274,8 @@ static int spear_adc_probe(struct platform_device *pdev) st =iio_priv (indio_dev); st->np = np; +init_completion (&st->completion); +/* * SPEAr600 has a different register layout than other SPEAr SoC's * (e.g. SPEAr3xx). Let's provide two register base addresses
@@ -334,8 +336,6 @@ static int spear_adc_probe(struct platform_device *pdev)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 ;
Signature · 1 line
2.55.0
Re: [PATCH 5.10.y] iio: adc: spear: Initialize completion before requesting IRQ
Quoted 2 lines
Fix the chance of a spurious IRQ causing an uninitialized pointer dereference by moving
init_completion()abovedevm_request_irq().
Queued for 5.10, thanks.
Signature · 2 lines
Thanks, Sasha