* [PATCH] lightnvm: pblk: Fix reference count leak in pblk_sysfs_init.
@ 2020-05-27 21:06 wu000273
2020-05-28 6:28 ` Javier González
2020-05-29 6:49 ` Matias Bjørling
0 siblings, 2 replies; 3+ messages in thread
From: wu000273 @ 2020-05-27 21:06 UTC (permalink / raw)
To: kjlu
Cc: wu000273, Matias Bjorling, Matias Bjørling, Jens Axboe,
Javier González, linux-block, linux-kernel
From: Qiushi Wu <wu000273@umn.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@umn.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;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] lightnvm: pblk: Fix reference count leak in pblk_sysfs_init.
2020-05-27 21:06 [PATCH] lightnvm: pblk: Fix reference count leak in pblk_sysfs_init wu000273
@ 2020-05-28 6:28 ` Javier González
2020-05-29 6:49 ` Matias Bjørling
1 sibling, 0 replies; 3+ messages in thread
From: Javier González @ 2020-05-28 6:28 UTC (permalink / raw)
To: wu000273
Cc: kjlu, Matias Bjorling, Matias Bjørling, Jens Axboe,
Javier González, linux-block, linux-kernel
On 27.05.2020 16:06, wu000273@umn.edu wrote:
>From: Qiushi Wu <wu000273@umn.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@umn.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;
> }
>
>--
>2.17.1
>
Looks good to me.
Reviewed-by: Javier González <javier@javigon.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] lightnvm: pblk: Fix reference count leak in pblk_sysfs_init.
2020-05-27 21:06 [PATCH] lightnvm: pblk: Fix reference count leak in pblk_sysfs_init wu000273
2020-05-28 6:28 ` Javier González
@ 2020-05-29 6:49 ` Matias Bjørling
1 sibling, 0 replies; 3+ messages in thread
From: Matias Bjørling @ 2020-05-29 6:49 UTC (permalink / raw)
To: wu000273, kjlu; +Cc: Jens Axboe, linux-block, linux-kernel
On 27/05/2020 23.06, wu000273@umn.edu wrote:
> From: Qiushi Wu <wu000273@umn.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@umn.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@lightnvm.io>
Jens, would you kindly pick up the patch?
Thank you, Matias
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-05-29 6:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-27 21:06 [PATCH] lightnvm: pblk: Fix reference count leak in pblk_sysfs_init wu000273
2020-05-28 6:28 ` Javier González
2020-05-29 6:49 ` Matias Bjørling
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).