Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp144583rwb; Tue, 25 Jul 2023 13:20:31 -0700 (PDT) X-Google-Smtp-Source: APBJJlEXMOXh99RGTrNTedZxw4U1OUX8O4RacoyOrh6YA/g/X0V/XhCwR+zd8hRDjyOUg7jCy8Eb X-Received: by 2002:a17:902:b598:b0:1b5:532e:33b8 with SMTP id a24-20020a170902b59800b001b5532e33b8mr178795pls.35.1690316430658; Tue, 25 Jul 2023 13:20:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690316430; cv=none; d=google.com; s=arc-20160816; b=HfPfYgtbbU941kZDe3dFN1MufKiBF1GaZY6kz6IKEHc+zA71rDZXieDsAuFrjvdk/c kzcB9oureRu2ntjDFllIP6sw5dctRF+27B5miQbEqZSuw+CIe/hapqwpqaRLQE99X5zM 8v/Ynr/Mrzd5JqWzRFNygZN6Z1L+cw/MnVDfoHJYE8qHqT1QphsvNc0uN+Cy5+Ex2GLJ l7gLyubd45w8mCUL/UAxOxUrgBwD6QhnsFFZIvCPh8AcFEoOArHYDQo+kmPgd9PGE2vn eY9iGsQpYoM0m3kH2YZY8EysNbEg/khnxaBVogFDTPFPilVaokxzflE1B4VrekbJfZEi TyXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=sufhrMxuR6De3yDY1epOJ1EtNjfVaEPMJu2zXJEU/VA=; fh=PcG0/tHxH1aGfbagjRYIJ3PejZ6bO9WgrnRlx62hIyY=; b=hyn+Luju6BsQVCT0ojrKmNpSC2tMOp/LjW4fBRrWMtB5JcO/CsZdIr7qYAq+Tm4mQq 0MhjEFOVpzwRMrWZRi+sbxyavvIR0ZTgRJuEWKBBg/pRVX+Yc0ytVYAeo6l32CRUDChP plJHAVAl9Tw7SHFZl+R69k/dnEFmRtWwPpK+ZvRgaN+6pL0kVnQJASO6R/OJO2EnDtPk 5UqS5XrYYU7mjhYL/1iHlUiBJx1PFs47/LH8tIsjJoqzv3nFmvp472kPVMzbAlGKzqBL z/m+xb4FbcdOEQ28LJvXLfkW/5BEyZ+B5KF9mQg1rXljuHeCgUAD3RRxTn/x+FKX+W8A kiCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hp.com header.s=mimecast20180716 header.b=Ow+sgsLO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=hp.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y11-20020a170902b48b00b001bb162e944dsi11639372plr.51.2023.07.25.13.19.57; Tue, 25 Jul 2023 13:20:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@hp.com header.s=mimecast20180716 header.b=Ow+sgsLO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=hp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231398AbjGYTvK (ORCPT + 99 others); Tue, 25 Jul 2023 15:51:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230403AbjGYTvI (ORCPT ); Tue, 25 Jul 2023 15:51:08 -0400 X-Greylist: delayed 118 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 25 Jul 2023 12:50:23 PDT Received: from us-smtp-delivery-162.mimecast.com (us-smtp-delivery-162.mimecast.com [170.10.133.162]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6447E1BCC for ; Tue, 25 Jul 2023 12:50:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hp.com; s=mimecast20180716; t=1690314622; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sufhrMxuR6De3yDY1epOJ1EtNjfVaEPMJu2zXJEU/VA=; b=Ow+sgsLO5eUCKYa4Ffyh7hR5Z/DYWzQS0RjOvD2KL4qQRkvtDWwsS9nNME3xWFhiRN/cJ5 71cUIhxV0C4j0uj0N4VyMHSFQL8T2u+DwZgklpHveo/pxn/ZIakvPIB2CF7t1TZZcjnpIS T6kFdTlxTcKQVs+KQ/y21hlYXdHNcNM= Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2046.outbound.protection.outlook.com [104.47.56.46]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-464-iikB6d2SOWuOs1D78y3mVQ-2; Tue, 25 Jul 2023 15:48:22 -0400 X-MC-Unique: iikB6d2SOWuOs1D78y3mVQ-2 Received: from PH0PR84MB1953.NAMPRD84.PROD.OUTLOOK.COM (2603:10b6:510:160::10) by PH0PR84MB1383.NAMPRD84.PROD.OUTLOOK.COM (2603:10b6:510:16c::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.32; Tue, 25 Jul 2023 19:48:19 +0000 Received: from PH0PR84MB1953.NAMPRD84.PROD.OUTLOOK.COM ([fe80::5e6b:1f96:bb19:ec40]) by PH0PR84MB1953.NAMPRD84.PROD.OUTLOOK.COM ([fe80::5e6b:1f96:bb19:ec40%7]) with mapi id 15.20.6609.031; Tue, 25 Jul 2023 19:48:19 +0000 From: "Lopez, Jorge A (Security)" To: Christophe JAILLET , Hans de Goede , Mark Gross , =?iso-8859-1?Q?Thomas_Wei=DFschuh?= CC: "linux-kernel@vger.kernel.org" , "kernel-janitors@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() Thread-Topic: [PATCH] platform/x86: hp-bioscfg: Fix some memory leaks in hp_populate_enumeration_elements_from_package() Thread-Index: AQHZuPHkIWGabZ7ClU64DUVfhVGEta/K7pLA Date: Tue, 25 Jul 2023 19:48:19 +0000 Message-ID: References: <9770122e4e079dfa87d860ed86ba1a1237bcf944.1689627201.git.christophe.jaillet@wanadoo.fr> In-Reply-To: <9770122e4e079dfa87d860ed86ba1a1237bcf944.1689627201.git.christophe.jaillet@wanadoo.fr> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-bromium-msgid: 21ed85f3-5ec8-4d30-8b43-dd11a07cc5f7 x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PH0PR84MB1953:EE_|PH0PR84MB1383:EE_ x-ms-office365-filtering-correlation-id: 6cc94ba3-eae3-4140-e9a8-08db8d4818d9 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0 x-microsoft-antispam-message-info: J5QMgXsiTopUiRw6j1NCHSpc2Sfx8BMztzA5SrhJWHipjEy/7YlCpj8klnJ/IpDz5S/kpHPhVL+Ez5zW9k3L+8j389tPWa3bDIlQ3RxDeE9r4B3mOaDEzStRBk6BOH8oqFWU77UtSrqeUmMfnMy93mrBxt/61vzyX9WNHt6YmmvVR18xt/LOD0vpQVgSvjg//Sqn+vJEqpRr3h4zs/qtrTuf6DMBHllxSTAKJeu0SGksvFSJE2TwiPpP/tCdNOngJx95LYggdkU0SO/bugTrojs2MnFyzD/Pah6hBDdMNJfMdTa1zfeSThPp0QrwxQK+kFfhkH+WYzEu/r5xe0qvS3jJFTvdFge9mYnoLadsoqnBnlhmrquruXVw5/81Vq1y7CBHyXNY8Y3voQBC63w5fA8j4pdfgRwqzSIqzzrsBSsLTI+PPMQMg/8+hnF1JHP/zwwbtP//ZB8EhKo/ORYNKm4/VZ7PeENisjQEfzRp1n6P7ep0j7FI5J889gNhSNqmR0C2BNuVeuZaczNVmZvqA0l5cmOnS5GkG0+uZhckSjd3qVWMKXsui3vQ2ha/Ge4GuM95w7kuep1Kk9dFq3oX376j0LX2wPiDMptjKU1qXIz4pRKEqA6L8W1n96hKBOhx x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR84MB1953.NAMPRD84.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230028)(4636009)(136003)(366004)(39860400002)(376002)(346002)(396003)(451199021)(33656002)(38070700005)(86362001)(82960400001)(55016003)(38100700002)(66446008)(64756008)(478600001)(316002)(4326008)(54906003)(76116006)(41300700001)(110136005)(66946007)(9686003)(52536014)(5660300002)(8936002)(8676002)(7696005)(66476007)(2906002)(186003)(26005)(71200400001)(6506007)(66556008)(122000001)(83380400001)(66574015)(53546011);DIR:OUT;SFP:1102 x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?0OMOe995bRNnE2Qjn9aoZIo5ULzUzcI9bvXc7QIDegVmaR7sCxCYvG1XGG?= =?iso-8859-1?Q?MZoTE9TTceS9rXSBhT7NqEu7JHjMRUeWj6oFuQlT9jDBakn735VAoc7+1i?= =?iso-8859-1?Q?hKo/LP/eRnl6Hnn9Of/EYXTcG28AtT/oZVQAOfu6ynUqYTQJ5rZsvnYDGG?= =?iso-8859-1?Q?X4CM5B1SRtLBwSVLBq33I5R4Dk78A1jCbTlqPTItU0FhpKoAUsToSzY7JQ?= =?iso-8859-1?Q?bdnvlnw5cyW2wJae9oMqNtJbI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8859-1?Q?qV7hVnNjR/cQZergp9K5dLYEzLw2ZM+qdomhRU8Hve8Of2DgN8KX15ifXG?= =?iso-8859-1?Q?uKgZFbxA4DyaFpHVIDs30+IKnYHckgSNPKXNsM4lj7WDsW/WJzlFTDDk5e?= =?iso-8859-1?Q?nHBd2mRETwZdGFc0wK+SlX1H9gl9T9Az9LI/LmQv0GkDh8YP9jKjOiS0i8?= =?iso-8859-1?Q?rKBC2jLdLwgUX7cGI4obz87I7LjNwhNxO8Ipl/W9WBds4C2kLKCE/wUCB1?= =?iso-8859-1?Q?iZUt8wrMSDqtK1BykT6JJEZ09Vnj0ovZoaMZcGrU/4UFksWqhMkySMRMeI?= =?iso-8859-1?Q?CbzdXtuQFheQ8m1YlbAr3gZs3zYdYC4A1iaHKsiDh1wosoRABsewdv7iOw?= =?iso-8859-1?Q?Who/q6h4TjujsY8WrRRqjsbiypRIxSH+yD50DwFFDZt8Jp+qFFH1PfbN5v?= =?iso-8859-1?Q?OttiSmzBDZbsxWhcFh3nAOOD76CU8Cu2eeDMVC2Dlhy+Yadyi6HRulErBy?= =?iso-8859-1?Q?OvWsYhdqhvNBW+CHKTqohPPv+0GOVVEpbj?= MIME-Version: 1.0 X-OriginatorOrg: hp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR84MB1953.NAMPRD84.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 6cc94ba3-eae3-4140-e9a8-08db8d4818d9 X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Jul 2023 19:48:19.7098 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: ca7981a2-785a-463d-b82a-3db87dfc3ce6 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: sVIsTshVf9/pDoynhl5cWmJ/H+li87Whgxhomwa/TLhPGppAZw02nBV6fZAI7Ks0G+JHcv82pdBkg6ZkgIr2cg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR84MB1383 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: hp.com Content-Language: en-US Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Christophe, I will submit a patch to address memory leaks in hp_populate_enumeration_el= ements_from_package() reported here and to address some uninitialized varia= ble 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 > Sent: Monday, July 17, 2023 3:54 PM > To: Lopez, Jorge A (Security) ; Hans de Goede > ; Mark Gross ; Thomas > Wei=DFschuh > Cc: linux-kernel@vger.kernel.org; kernel-janitors@vger.kernel.org; > Christophe JAILLET ; platform-driver- > x86@vger.kernel.org > Subject: [PATCH] platform/x86: hp-bioscfg: Fix some memory leaks in > hp_populate_enumeration_elements_from_package() >=20 > CAUTION: External Email >=20 > In the loop in the ENUM_POSSIBLE_VALUES case, we allocate some memory > that is never freed. >=20 > While at it, add some "str_value =3D NULL" to avoid some potential double > free. >=20 > Fixes: 6b2770bfd6f9 ("platform/x86: hp-bioscfg: enum-attributes") > Signed-off-by: Christophe JAILLET > --- > /!\ Speculative /!\ >=20 > This patch is based on analysis of the surrounding code and should be > reviewed with care ! >=20 > /!\ Speculative /!\ > --- > drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c | 5 +++++ > 1 file changed, 5 insertions(+) >=20 > 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.prerequi= sites[reqs])); >=20 > kfree(str_value); > + str_value =3D NULL; > } > break; >=20 > @@ -275,6 +276,9 @@ static int > hp_populate_enumeration_elements_from_package(union acpi_object > *enum > strscpy(enum_data->possible_value= s[pos_values], > str_value, > sizeof(enum_data- > >possible_values[pos_values])); > + > + kfree(str_value); > + str_value =3D NULL; > } > break; > default: > @@ -283,6 +287,7 @@ static int > hp_populate_enumeration_elements_from_package(union acpi_object > *enum > } >=20 > kfree(str_value); > + str_value =3D NULL; > } >=20 > exit_enumeration_package: > -- > 2.34.1