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 4D186332604; Thu, 16 Jul 2026 14:21:43 +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=1784211704; cv=none; b=ttL2Btpe4N8QpfGRUZOEWlvGTo08W9ufyZ11XjchgZLqm+Hm1/hmHMCu48Q5luOEhFvhd2rFUOTm9nUv+4ti3LgQ3sOBwJdu9COWtbbowPt0YYhBvElJmfewLNfXy1mGnkOWfj2kZ7WAMHpbeogAyeKSrT8+FSiPuYeAcIkg+nY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784211704; c=relaxed/simple; bh=hiPqD2j8aeeW6gfYSpsdLoQfD88MHH8PhN9suN4P0mU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cqWEhGdvfMj+IIX7Cmcw4MbCioJfgUFgmRRxA3blNO/BEo+wbxenz7MvQzBcZMTOvtSSZwxTOrRH1x8BsG5vI6/4r7vVvG2grUqH+Y1vu2vPzZrGvw26p6Thr+sluJzUiLE1w22kIo6UrdZSjzJGdjhfHFkBSOoaopMFFa44hO4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=a7PEReBb; 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="a7PEReBb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B80E51F000E9; Thu, 16 Jul 2026 14:21:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784211703; bh=jLzArIhWIB6WZRuclyrO3fwLGTeXam2wIqjEpDS7ag8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=a7PEReBbNq/UAa/1Ky9M1bUgu9j+15Oi/9N1jSrh0P6krkAYA2pJx4ChF4sXK/x7z PT+cZwBN4+C84M8JrW3zNcuiemvpZqv9Bw6vQpWCmI73p/2XrpiAnrCP8ErPjwl/Ga uhZFophtFRaFZWr4UHEJM4c1BCWpOZXUoZR74tdk= 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 6.12 046/349] iio: adc: lpc32xx: Initialize completion before requesting IRQ Date: Thu, 16 Jul 2026 15:29:40 +0200 Message-ID: <20260716133034.353352338@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260716133033.287196923@linuxfoundation.org> References: <20260716133033.287196923@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 6.12-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 @@ -179,6 +179,8 @@ static int lpc32xx_adc_probe(struct plat if (irq < 0) return irq; + init_completion(&st->completion); + retval = devm_request_irq(&pdev->dev, irq, lpc32xx_adc_isr, 0, LPC32XXAD_NAME, st); if (retval < 0) { @@ -197,8 +199,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;