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 32D7218C03E; Tue, 10 Sep 2024 10:20:29 +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=1725963629; cv=none; b=TTkGsOKd4iUVUVRmbYYigM1TRKHxx+g/PnK+LAyOqyKroKpXusCtcxQ1l1Bc0/3YYJ+x/2/6+WCteHe/NTVBt2h8tFCvSD24jfkAPwJtEz0qi9WevyJ3qMGY3UXmlBoa1XR4OM3Kv6C9GUs8KWL7Nkp9c/B8WvGR6EMOS4a+jkY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725963629; c=relaxed/simple; bh=VNy/AptBIK6vDEy6afezN0GysH4OQAk1GoVWBDdzXCU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=d8ISdUIUdjhGkpjZJKWBn9o/VAm5WFh31IR4NrYN+EJII3HyUo24wAhw/Vq6nvdFpPVyZQ64rw1oK+r9uf4DEkFgo5C2d/LUR/+phxJfoTWqx/6On+DqtV8fHvW+lBndHBA1e8lr1VqdI2t/PdqIzkhBT8PIIKr4J6BEhKJjo4w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=lD0tcQYE; 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="lD0tcQYE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB223C4CEC6; Tue, 10 Sep 2024 10:20:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1725963629; bh=VNy/AptBIK6vDEy6afezN0GysH4OQAk1GoVWBDdzXCU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lD0tcQYEC0WZG/3eTcJcS0PtzK7JF4/KEzhVaMXRUP0rAdX6558It+PnIMq2/sPqa L2eqwxYWH2HPmUkFYC1/knlwxKqL80zMphV+lyNl4R+gitWybnl8RAz1Fr/V/Vyb7n diXvRP2aergUviQvTTw0Z9HLFf6jIdfP6QaCQFnw= 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 5.15 123/214] platform/x86: dell-smbios: Fix error path in dell_smbios_init() Date: Tue, 10 Sep 2024 11:32:25 +0200 Message-ID: <20240910092603.790814433@linuxfoundation.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240910092558.714365667@linuxfoundation.org> References: <20240910092558.714365667@linuxfoundation.org> User-Agent: quilt/0.67 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-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 5.15-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 77b0f5bbe3ac..b19c5ff31a70 100644 --- a/drivers/platform/x86/dell/dell-smbios-base.c +++ b/drivers/platform/x86/dell/dell-smbios-base.c @@ -589,7 +589,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