[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VeiUccZp7fLeRv9d2qt61Ha=CPEo2rwKypY42WGO4Aejw@mail.gmail.com>
Date: Thu, 1 Mar 2018 12:54:35 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Arvind Yadav <arvind.yadav.cs@...il.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] driver core: Free memory obtained by kzalloc
On Thu, Mar 1, 2018 at 7:59 AM, Arvind Yadav <arvind.yadav.cs@...il.com> wrote:
> Here kfree() is taking NULL. So moving 'dev = NULL' after kfree().
Ouch! Does system_root_device_release() code ring a bell? How did you test this?
When you start eventually looking to the code?
NAK.
> diff --git a/drivers/base/bus.c b/drivers/base/bus.c
> index ef61833..ccb64a0 100644
> --- a/drivers/base/bus.c
> +++ b/drivers/base/bus.c
> @@ -1170,9 +1170,9 @@ static int subsys_register(struct bus_type *subsys,
>
> err_dev_reg:
> put_device(dev);
> - dev = NULL;
> err_name:
> kfree(dev);
> + dev = NULL;
> err_dev:
> bus_unregister(subsys);
> return err;
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists