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 B11AA4BEE43; Sat, 12 Sep 2026 18:47:47 +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=1789238868; cv=none; b=JdADv/4wQ5ohqO/jWD2Ha9tZfVIRmNErnSwLqWVGVfZ956mq6ubbYpNSnyKMNOXpf7AmTadXcsQ8XcXZQMudz7I9v0RZf9opSNrXW4X4REDYOG7sopMgwKm5jEhhGuYAPKfQAWUqDU/4cE1qUjkz+HQJQUY21aYNCOHSmsClYtQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789238868; c=relaxed/simple; bh=+M76YrJdpxxITsKsuIACz1zwMGs1w+JbUTQEP8OJa2o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=i1HicUq8Lg9vUufx6mLOdYlomizsoRFxH0yUQMr4h1MztIWpotf7IeAXpP/CDPR+jts3h8HqsRmUlrnHdTs/z3OZ2NxNh/aVQG5LU1Z6oI5fe/mWZx5rYHriU61hJLHERAtbI0k2tCWkA15Boy2d1N6CorZj98glYdtJU4xpvaQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ammspzuT; 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="ammspzuT" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50E9C1F000FF; Sat, 12 Sep 2026 18:47:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789238867; bh=laprKJ/zpfgMoeqdFcVtHwK70rOL6JJyKxE/JR1tmcw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ammspzuT+wm9IK5TLHRCFZu/tmbUGeN0NcOB8mJnX6rqnJGLMAhthjm7vsgpqwZM7 10NfCSb/3nXVzaN3F4pHcHBRXouxFKtF0pWKWjWXqh0sCB8K2OXg8mr4/ozxloN99I Vdh0AEJhN/VCLVy4w+Zb8wEbETRdWSKvZr1AlmQg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ijae Kim , Myeonghun Pak , Radhey Shyam Pandey , Sasha Levin Subject: [PATCH 5.15 550/935] char: xilinx_hwicap: unregister class on init errors Date: Sat, 12 Sep 2026 08:59:40 +0200 Message-ID: <20260912065539.441080635@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065526.833703348@linuxfoundation.org> References: <20260912065526.833703348@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: Myeonghun Pak [ Upstream commit e7e12b4cc0f0c3a2782aea084d4215e23f5512b3 ] hwicap_module_init() registers icap_class before reserving the character-device region and registering the platform driver. If either of those later steps fails, the init path must undo the successful class registration before returning an error. Route the chrdev registration failure through a class unwind label, and let the platform-driver registration failure fall through the existing chrdev unwind before unregistering the class. The normal module exit path is unchanged. This issue was identified during our ongoing static-analysis research while reviewing kernel code. Fixes: ef141a0bb0dc ("[POWERPC] Xilinx: hwicap driver") Co-developed-by: Ijae Kim Signed-off-by: Ijae Kim Signed-off-by: Myeonghun Pak Reviewed-by: Radhey Shyam Pandey Link: https://patch.msgid.link/20260623085604.89284-1-mhun512@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/char/xilinx_hwicap/xilinx_hwicap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c index 067396bedf224..4fd6830d070d1 100644 --- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c +++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c @@ -864,7 +864,7 @@ static int __init hwicap_module_init(void) HWICAP_DEVICES, DRIVER_NAME); if (retval < 0) - return retval; + goto failed_class; retval = platform_driver_register(&hwicap_platform_driver); if (retval) @@ -875,6 +875,9 @@ static int __init hwicap_module_init(void) failed: unregister_chrdev_region(devt, HWICAP_DEVICES); + failed_class: + class_unregister(&icap_class); + return retval; } -- 2.53.0