kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Len Brown <lenb@kernel.org>,
	ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] ACPI: scan: Fix a memory leak in an error handling path
Date: Mon, 10 May 2021 19:04:16 +0200	[thread overview]
Message-ID: <CAJZ5v0jNG54Y4LYCFjqh2UKWXLswJFfKMxjrpPpGoSjNnEPibg@mail.gmail.com> (raw)
In-Reply-To: <YJkkjI6+k34ZoQ69@smile.fi.intel.com>

On Mon, May 10, 2021 at 3:17 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> 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 <andriy.shevchenko@linux.intel.com>
>
> Thanks!
>
> > Fixes: eb50aaf960e3 ("ACPI: scan: Use unique number for instance_no")
> > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> > ---
> >  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!

      reply	other threads:[~2021-05-10 17:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-08  7:23 [PATCH] ACPI: scan: Fix a memory leak in an error handling path Christophe JAILLET
2021-05-08 14:50 ` Edmundo Carmona Antoranz
2021-05-08 18:47   ` Christophe JAILLET
2021-05-10  5:39   ` Dan Carpenter
     [not found]     ` <CAOc6etbVZkANHVVmP5rss-nQqSYNiSFRXrg_nVUBV-719xKqJw@mail.gmail.com>
2021-05-10 13:55       ` Dan Carpenter
2021-05-10 12:18 ` Andy Shevchenko
2021-05-10 17:04   ` Rafael J. Wysocki [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=CAJZ5v0jNG54Y4LYCFjqh2UKWXLswJFfKMxjrpPpGoSjNnEPibg@mail.gmail.com \
    --to=rafael@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    /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;
as well as URLs for NNTP newsgroup(s).