mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Lopez, Jorge A (Security)" <jorge.lopez2@hp.com>
To: "Christophe JAILLET" <christophe.jaillet@wanadoo.fr>,
	"Hans de Goede" <hdegoede@redhat.com>,
	"Mark Gross" <markgross@kernel.org>,
	"Thomas Weißschuh" <linux@weissschuh.net>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>,
	"platform-driver-x86@vger.kernel.org" 
	<platform-driver-x86@vger.kernel.org>
Subject: RE: [PATCH] platform/x86: hp-bioscfg: Fix some memory leaks in hp_populate_enumeration_elements_from_package()
Date: Tue, 25 Jul 2023 19:48:19 +0000	[thread overview]
Message-ID: <PH0PR84MB1953EC528F8D549E6B3B7669A803A@PH0PR84MB1953.NAMPRD84.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <9770122e4e079dfa87d860ed86ba1a1237bcf944.1689627201.git.christophe.jaillet@wanadoo.fr>

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@wanadoo.fr>
> Sent: Monday, July 17, 2023 3:54 PM
> To: Lopez, Jorge A (Security) <jorge.lopez2@hp.com>; Hans de Goede
> <hdegoede@redhat.com>; Mark Gross <markgross@kernel.org>; Thomas
> Weißschuh <linux@weissschuh.net>
> Cc: linux-kernel@vger.kernel.org; kernel-janitors@vger.kernel.org;
> Christophe JAILLET <christophe.jaillet@wanadoo.fr>; platform-driver-
> x86@vger.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@wanadoo.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


      parent reply	other threads:[~2023-07-25 19:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-17 20:53 Christophe JAILLET
2023-07-18  7:55 ` Dan Carpenter
2023-07-18 17:36   ` Christophe JAILLET
2023-07-25 20:00     ` Lopez, Jorge A (Security)
2023-07-25 19:48 ` Lopez, Jorge A (Security) [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=PH0PR84MB1953EC528F8D549E6B3B7669A803A@PH0PR84MB1953.NAMPRD84.PROD.OUTLOOK.COM \
    --to=jorge.lopez2@hp.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=hdegoede@redhat.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@weissschuh.net \
    --cc=markgross@kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®