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 037C92F617C; Sat, 12 Sep 2026 12:21:48 +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=1789215709; cv=none; b=JHUYv+HqAwPGe7e0TQvJMHt7WT1NLzzrJOTRzoikEdisi2mi98Rg7n3vo7TSqoyyRrzZr7XjX2mdkfXeFdXBYa7g2nGe8deb024P6oJuQoQQQAkY18BscCiHW7Y2Nc07cCwd3nnIPs4koytuE70Q3U2GqUP9+4a/xpbbLP15SpA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789215709; c=relaxed/simple; bh=pz8QHMfcfCpiX08ihsh8Xl3dc5hLq+OPD5qm4nYLLsM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=notu39BP754E7NqkXN02l+81F0YnbOsQZCEJ7ttXBPbKZr2NKZuOBi+3ATBBTgF57ohHW/3k8Xpsp/oPu08yeOlgjDEy/QKpD+slDfLQgPzkcGt+gof6RQsVM6XcftqFpe2Bp5corliDfz+alBA32tdUc7KQWzSEKfIjOjUAVIw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=lv4ErHbm; 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="lv4ErHbm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C37581F000FF; Sat, 12 Sep 2026 12:21:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789215707; bh=/XqloterBnOqwxSHWZ7JcOwO3V717v+uvIIUT9k8/1I=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=lv4ErHbm0QrrljKFQzG9AbX3gP6wEvxuj/ecXc1wOlA4ykPUrnnrf/vY+LRs1PMJO BglmKKAq74APR0doahBr2ioVIg2k/Oh01DCFIN7HCstprnjHI/Cuhat4PWKPukZMjM i0XqDUB/0BKughFnIAp4s1mgJ22RQ1+GryVLg8Gk= 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 6.12 0587/1376] char: xilinx_hwicap: unregister class on init errors Date: Sat, 12 Sep 2026 08:50:13 +0200 Message-ID: <20260912065620.615273783@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065607.535295758@linuxfoundation.org> References: <20260912065607.535295758@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org 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: 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 4f6c3cb8aa413..259900a9ee211 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