From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 10544183CB0; Tue, 10 Sep 2024 09:48:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725961732; cv=none; b=UdPN1sWJK9DRGHC1PtlMLsMGI6c8qMUzapBr3UVOqBwKCa6IvevsxgDToI/UmWOSts1aSwpDs12OWsU/LggMbfBEfmpgqhYx+/GvqOa3fcZhDUCGtgQzQPVXxNPeA5eoso/QQCumRc2+Vp8oelOtwVUPpYyhj4zdy6Xs7TmCQ3s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725961732; c=relaxed/simple; bh=28v6gDaSp6X+/5EeHY82md46qaVMuRxGW5jfqWkfqxQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=E7IratmayKjdOn6dB6cGo4eQbMywUQd+KlWW7HlJ8cfNldPPKPjV9GBu+ZTysmDSiaAFsaqMtfi5xSxu6ZUsRpxgO9+4K76gG8fM0ojj/0m+wvyF2zNhFJEQv9xi+7F6ntQVHdFvfyv6hIgSeYS7fD28oLs/oP7QgNQt8Kzi55g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=eZaqRe26; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="eZaqRe26" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8AE55C4CEC3; Tue, 10 Sep 2024 09:48:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1725961731; bh=28v6gDaSp6X+/5EeHY82md46qaVMuRxGW5jfqWkfqxQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eZaqRe26f8LZZoBr7rAGB3KwwSYwqdL8yLDZWcw/HoHyGOcCGUi9eYXPv++cWsfjd AEdl3McAVgMUEuRMqcoVwkjCqKHf4Zm06h4oqmCBLEbup4DkJ5IvAUIj+aakpyNoed sArS+DKfQy4yyHM56Ctu3K0fMQSmiOhI1nAbFhsY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Aleksandr Mishin , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Sasha Levin Subject: [PATCH 6.10 162/375] platform/x86: dell-smbios: Fix error path in dell_smbios_init() Date: Tue, 10 Sep 2024 11:29:19 +0200 Message-ID: <20240910092627.925328825@linuxfoundation.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240910092622.245959861@linuxfoundation.org> References: <20240910092622.245959861@linuxfoundation.org> User-Agent: quilt/0.67 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-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Aleksandr Mishin [ Upstream commit ffc17e1479e8e9459b7afa80e5d9d40d0dd78abb ] In case of error in build_tokens_sysfs(), all the memory that has been allocated is freed at end of this function. But then free_group() is called which performs memory deallocation again. Also, instead of free_group() call, there should be exit_dell_smbios_smm() and exit_dell_smbios_wmi() calls, since there is initialization, but there is no release of resources in case of an error. Fix these issues by replacing free_group() call with exit_dell_smbios_wmi() and exit_dell_smbios_smm(). Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 33b9ca1e53b4 ("platform/x86: dell-smbios: Add a sysfs interface for SMBIOS tokens") Signed-off-by: Aleksandr Mishin Link: https://lore.kernel.org/r/20240830065428.9544-1-amishin@t-argos.ru Reviewed-by: Ilpo Järvinen Signed-off-by: Ilpo Järvinen Signed-off-by: Sasha Levin --- drivers/platform/x86/dell/dell-smbios-base.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/dell/dell-smbios-base.c b/drivers/platform/x86/dell/dell-smbios-base.c index b562ed99ec4e..4702669dbb60 100644 --- a/drivers/platform/x86/dell/dell-smbios-base.c +++ b/drivers/platform/x86/dell/dell-smbios-base.c @@ -587,7 +587,10 @@ static int __init dell_smbios_init(void) return 0; fail_sysfs: - free_group(platform_device); + if (!wmi) + exit_dell_smbios_wmi(); + if (!smm) + exit_dell_smbios_smm(); fail_create_group: platform_device_del(platform_device); -- 2.43.0