[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <PH0PR84MB1953EC528F8D549E6B3B7669A803A@PH0PR84MB1953.NAMPRD84.PROD.OUTLOOK.COM>
Date: Tue, 25 Jul 2023 19:48:19 +0000
From: "Lopez, Jorge A (Security)" <jorge.lopez2@...com>
To: Christophe JAILLET <christophe.jaillet@...adoo.fr>,
Hans de Goede <hdegoede@...hat.com>,
Mark Gross <markgross@...nel.org>,
Thomas Weißschuh <linux@...ssschuh.net>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>,
"platform-driver-x86@...r.kernel.org"
<platform-driver-x86@...r.kernel.org>
Subject: RE: [PATCH] platform/x86: hp-bioscfg: Fix some memory leaks in
hp_populate_enumeration_elements_from_package()
Hi Christophe,
I will submit a patch to address memory leaks in hp_populate_enumeration_elements_from_package() reported here and to address some uninitialized variable errors reported in a separate email.
Regards,
Jorge Lopez
HP Inc
"Once you stop learning, you start dying"
Albert Einstein
> -----Original Message-----
> From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
> Sent: Monday, July 17, 2023 3:54 PM
> To: Lopez, Jorge A (Security) <jorge.lopez2@...com>; Hans de Goede
> <hdegoede@...hat.com>; Mark Gross <markgross@...nel.org>; Thomas
> Weißschuh <linux@...ssschuh.net>
> Cc: linux-kernel@...r.kernel.org; kernel-janitors@...r.kernel.org;
> Christophe JAILLET <christophe.jaillet@...adoo.fr>; platform-driver-
> x86@...r.kernel.org
> Subject: [PATCH] platform/x86: hp-bioscfg: Fix some memory leaks in
> hp_populate_enumeration_elements_from_package()
>
> CAUTION: External Email
>
> In the loop in the ENUM_POSSIBLE_VALUES case, we allocate some memory
> that is never freed.
>
> While at it, add some "str_value = NULL" to avoid some potential double
> free.
>
> Fixes: 6b2770bfd6f9 ("platform/x86: hp-bioscfg: enum-attributes")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
> ---
> /!\ Speculative /!\
>
> This patch is based on analysis of the surrounding code and should be
> reviewed with care !
>
> /!\ Speculative /!\
> ---
> drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c
> b/drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c
> index b1b241f0205a..dd173020c747 100644
> --- a/drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c
> +++ b/drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c
> @@ -224,6 +224,7 @@ static int
> hp_populate_enumeration_elements_from_package(union acpi_object
> *enum
> sizeof(enum_data->common.prerequisites[reqs]));
>
> kfree(str_value);
> + str_value = NULL;
> }
> break;
>
> @@ -275,6 +276,9 @@ static int
> hp_populate_enumeration_elements_from_package(union acpi_object
> *enum
> strscpy(enum_data->possible_values[pos_values],
> str_value,
> sizeof(enum_data-
> >possible_values[pos_values]));
> +
> + kfree(str_value);
> + str_value = NULL;
> }
> break;
> default:
> @@ -283,6 +287,7 @@ static int
> hp_populate_enumeration_elements_from_package(union acpi_object
> *enum
> }
>
> kfree(str_value);
> + str_value = NULL;
> }
>
> exit_enumeration_package:
> --
> 2.34.1
Powered by blists - more mailing lists