From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.0 required=3.0 tests=BAYES_00,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F278C433ED for ; Mon, 10 May 2021 17:04:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7A77B613C8 for ; Mon, 10 May 2021 17:04:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232146AbhEJRFz (ORCPT ); Mon, 10 May 2021 13:05:55 -0400 Received: from mail-ot1-f41.google.com ([209.85.210.41]:39767 "EHLO mail-ot1-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232240AbhEJRFc (ORCPT ); Mon, 10 May 2021 13:05:32 -0400 Received: by mail-ot1-f41.google.com with SMTP id d25-20020a0568300459b02902f886f7dd43so1626762otc.6; Mon, 10 May 2021 10:04:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Xl40YY+UwmSdCEgMPbdm3QhhBzG29tkagPo5lF6lVJo=; b=Y+fT1O5nbFKwneruCBEYTmli7uj1O7O0yfWxq9uQjw9I1WxTtLj/YLMcg2e3z3tbaQ kfrFN+h/WOkYSLOOzZHO2mL9exWCrNo2KFi4KXUQSt6wfnUncSGzfihlslmgx8Mkiy6a i4t6JRkMSTcJ5w7baw0PgmCoyul/zBxXpqlElHS9b/m4SZA/QlTGD0VLfgQUoALoTmzs R6HpnmjvRcUJq0/BIFsFxulBkYj/us02hoxJsWs8OMR5jMR2dd19YDRkfYDOcgyqdMDc HTnBaT1NtUsMFuPNwtaZsqFA4B2uA1+JboRkWS5A0lEE4yRm/MPLVjbPzlF0L4QSACrW Q3EQ== X-Gm-Message-State: AOAM5332qe37xkUWBUBbj6QPLM9dmAiP2rymUS/d74wdVsRn50MVlcbC fZQ+ItYTUGE0LkBj/3XLcJHYIAxOF/Rq1nPGH7Y6A39P X-Google-Smtp-Source: ABdhPJxzgKL8nTsWIc40ErSnfp5DyWliOhM0nTQ1BzEHKT4msTNjiCn2yiQ2dwjPpUTGyhyDC/TVBPvXdsy+/1VNcX4= X-Received: by 2002:a05:6830:55b:: with SMTP id l27mr21934250otb.260.1620666267231; Mon, 10 May 2021 10:04:27 -0700 (PDT) MIME-Version: 1.0 References: <63bf4e87eb42fa3fff2cd87eb605ebcc01f4b2f7.1620458525.git.christophe.jaillet@wanadoo.fr> In-Reply-To: From: "Rafael J. Wysocki" Date: Mon, 10 May 2021 19:04:16 +0200 Message-ID: Subject: Re: [PATCH] ACPI: scan: Fix a memory leak in an error handling path To: Andy Shevchenko Cc: Christophe JAILLET , "Rafael J. Wysocki" , Len Brown , ACPI Devel Maling List , Linux Kernel Mailing List , kernel-janitors@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: kernel-janitors@vger.kernel.org On Mon, May 10, 2021 at 3:17 PM Andy Shevchenko wrote: > > On Sat, May 08, 2021 at 09:23:09AM +0200, Christophe JAILLET wrote: > > If 'acpi_device_set_name()' fails, we must free > > 'acpi_device_bus_id->bus_id' or there is a (potential) memory leak. > > Good catch! > I guess I have lost it somewhere in the middle of developing the mentioned fix. > > Reviewed-by: Andy Shevchenko > > Thanks! > > > Fixes: eb50aaf960e3 ("ACPI: scan: Use unique number for instance_no") > > Signed-off-by: Christophe JAILLET > > --- > > drivers/acpi/scan.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c > > index a22778e880c2..651a431e2bbf 100644 > > --- a/drivers/acpi/scan.c > > +++ b/drivers/acpi/scan.c > > @@ -700,6 +700,7 @@ int acpi_device_add(struct acpi_device *device, > > > > result = acpi_device_set_name(device, acpi_device_bus_id); > > if (result) { > > + kfree_const(acpi_device_bus_id->bus_id); > > kfree(acpi_device_bus_id); > > goto err_unlock; > > } > > -- Applied as 5.13-rc material, thanks!