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 EADD4432E97; Tue, 21 Jul 2026 21:42:56 +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=1784670178; cv=none; b=h7zhpCnPp4HnPkdfuQCXp7Mhs0Kn4bEOKy9QuHEEEKECwb/Omza8VurVEUX2NkbjriAKppEiJHcYCt34OFVw5/cA4jE/DyvCRUj+hECPCMf2sawRIwHZUVr5ja5H81m0S/LSpwqIbLhj+whoFQTsC7KaT9WT+YuG7sV1tCkUSzc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784670178; c=relaxed/simple; bh=9wMRs5PvI+s4jnrZ3GMYD2Xgl1Q+mxkyA9jIbBbWGho=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=F1BktKHPLxZK4+NUJ5KN6w9a24fRaDOR0oZduB8+eLPYB34lbKl6kx0Z3wjmMquMHCx/1/wuhJvx1iQ1IgJY1OKkQ3QhJKWTqj5HEdKFGX/jEk8/SJpvRzVzUA8tl3vkKJn+mW6fcsnF+tFaWXwnlGs7hnWcwv9AHyjjvgqTEY4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Kd2R+bRu; 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="Kd2R+bRu" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B5711F000E9; Tue, 21 Jul 2026 21:42:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784670176; bh=daVHeb5u6exZoTdBXWNUqmDv5bdQb8fBPOcUbhO0iWk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Kd2R+bRupjaci2Utm6oPDwqFZUPBStJEF2rAr06ZevNHSvgyCcbrVEdv1nNDAagLV jacy9lQfsKX3GNg/2aMNhF0M63SX4dL0+R1esgAPaiTzxu2bYHjpGdBjBw7I5gmtZJ 8udJYEq96rbhjappo5XPT4RD7Up3cyDwKN3rMJPY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sangyun Kim , Kyungwook Boo , Masami Hiramatsu , Kunihiko Hayashi , Mark Brown Subject: [PATCH 6.1 0832/1067] spi: uniphier: Fix completion initialization order before devm_request_irq() Date: Tue, 21 Jul 2026 17:23:53 +0200 Message-ID: <20260721152443.162478116@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152424.521567757@linuxfoundation.org> References: <20260721152424.521567757@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.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Kunihiko Hayashi commit f3ad1c87d8201e54b66bd6072442f0b5d5a308ee upstream. The driver calls devm_request_irq() before initializing the completion used by the interrupt handler. Because the interrupt may occur immediately after devm_request_irq(), the handler may execute before init_completion(). This may result in calling complete() on an uninitialized completion, causing undefined behavior. This has been observed with KASAN. Fix this by initializing the completion before registering the IRQ. Reported-by: Sangyun Kim Reported-by: Kyungwook Boo Fixes: 5ba155a4d4cc ("spi: add SPI controller driver for UniPhier SoC") Cc: stable@vger.kernel.org Cc: Masami Hiramatsu Signed-off-by: Kunihiko Hayashi Reviewed-by: Masami Hiramatsu (Google) Link: https://patch.msgid.link/20260616011223.201357-1-hayashi.kunihiko@socionext.com Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- drivers/spi/spi-uniphier.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/spi/spi-uniphier.c +++ b/drivers/spi/spi-uniphier.c @@ -659,6 +659,8 @@ static int uniphier_spi_probe(struct pla priv->host = host; priv->is_save_param = false; + init_completion(&priv->xfer_done); + priv->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); if (IS_ERR(priv->base)) { ret = PTR_ERR(priv->base); @@ -686,8 +688,6 @@ static int uniphier_spi_probe(struct pla goto out_host_put; } - init_completion(&priv->xfer_done); - clk_rate = clk_get_rate(priv->clk); host->max_speed_hz = DIV_ROUND_UP(clk_rate, SSI_MIN_CLK_DIVIDER);