[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c67132e2-e684-74b8-2809-98e80fc944e6@lightnvm.io>
Date: Fri, 29 May 2020 08:49:26 +0200
From: Matias Bjørling <mb@...htnvm.io>
To: wu000273@....edu, kjlu@....edu
Cc: Jens Axboe <axboe@...com>, linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] lightnvm: pblk: Fix reference count leak in
pblk_sysfs_init.
On 27/05/2020 23.06, wu000273@....edu wrote:
> From: Qiushi Wu <wu000273@....edu>
>
> kobject_init_and_add() takes reference even when it fails.
> Thus, when kobject_init_and_add() returns an error,
> kobject_put() must be called to properly clean up the kobject.
>
> Fixes: a4bd217b4326 ("lightnvm: physical block device (pblk) target")
> Signed-off-by: Qiushi Wu <wu000273@....edu>
> ---
> drivers/lightnvm/pblk-sysfs.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/lightnvm/pblk-sysfs.c b/drivers/lightnvm/pblk-sysfs.c
> index 6387302b03f2..90f1433b19a2 100644
> --- a/drivers/lightnvm/pblk-sysfs.c
> +++ b/drivers/lightnvm/pblk-sysfs.c
> @@ -711,6 +711,7 @@ int pblk_sysfs_init(struct gendisk *tdisk)
> "%s", "pblk");
> if (ret) {
> pblk_err(pblk, "could not register\n");
> + kobject_put(&pblk->kobj);
> return ret;
> }
>
Thanks, Quishi.
Signed-off-by: Matias Bjørling <mb@...htnvm.io>
Jens, would you kindly pick up the patch?
Thank you, Matias
Powered by blists - more mailing lists