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 B731037B3F7; Sat, 12 Sep 2026 07:47:33 +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=1789199254; cv=none; b=qCWPLo1V90OJN7XYEJ3AjCCmWN+sWTUH8FOL2OfMegQb6JQv+6y4KNDOvo1bDqhYpVJiEtfikDaFwD9C9cBVbVbS5sBVlkMtpgWDVeRfC6/t6BROMo0RYahe8Nvng2uW3+ZfztgjETp77496w8nSfEEwzFjGe+kmzQbj11uoPbc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789199254; c=relaxed/simple; bh=5lprLwh2wUDBZx/Rl8cw1JvS9Krdvr37UAXsdFQztrE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fnGmCynooZGTqIblOj3DxypZq80ssm8nL6Y7z7mcw1s7/k46bNsq7fVWZeTlG6ic5yEBa7dbyxbNPBmnf8SB7Kj8VS1YMSe1OQTAaRXNDAGm7F/kWNEucAedNOQZ9k0iB+3cOK/6eza1fuC6kTha5vsVgrsxuL+KUpcUMCvQ6Dc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=nOXKllN7; 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="nOXKllN7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BAD2E1F000FF; Sat, 12 Sep 2026 07:47:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789199253; bh=Gj/lmh4zHOkRDQJooAmntQF0F+cNooAMwqbrv7lJFsU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=nOXKllN7G0taqgCU5aEAAIw+kyxEZaz6Sd7mfNQXad4iPrN5dMPT5e7uMZmgle+lf ExUchg6wn8UypceY9wZuxRwSu733a0hhfiLNDzGJHlhssUTZw7hZj9Xd1DNonD8bq2 qnFPVDZFG0gvrUcmOZ/DFOz9lODwJSts7oKEHQJw= 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 7.2 0505/1815] char: xilinx_hwicap: unregister class on init errors Date: Sat, 12 Sep 2026 08:37:35 +0200 Message-ID: <20260912065700.745599331@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065648.999753832@linuxfoundation.org> References: <20260912065648.999753832@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 7.2-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 34a345dc5e724..9bb5fa642fd88 100644 --- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c +++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c @@ -760,7 +760,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) @@ -771,6 +771,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