* Re: [PATCH] block: Fix reference count leak in blk_integrity_add
@ 2020-07-25 11:35 ` Markus Elfring
0 siblings, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2020-07-25 11:35 UTC (permalink / raw)
To: Yi Wang, Liao Pingfang, linux-block
Cc: kernel-janitors, linux-kernel, Jens Axboe, Wang Liang, Xue Zhihong
> kobject_init_and_add() takes reference even when it fails. If this
> function returns an error, kobject_put() must be called to properly
> clean up the memory associated with the object.
* An imperative wording can be preferred for the change description,
can't it?
* Would you like to add the tag “Fixes” to the commit message?
Regards,
Markus
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] block: Fix reference count leak in blk_integrity_add
@ 2020-07-25 11:35 ` Markus Elfring
0 siblings, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2020-07-25 11:35 UTC (permalink / raw)
To: Yi Wang, Liao Pingfang, linux-block
Cc: kernel-janitors, linux-kernel, Jens Axboe, Wang Liang, Xue Zhihong
> kobject_init_and_add() takes reference even when it fails. If this
> function returns an error, kobject_put() must be called to properly
> clean up the memory associated with the object.
* An imperative wording can be preferred for the change description,
can't it?
* Would you like to add the tag “Fixes” to the commit message?
Regards,
Markus
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] block: Fix reference count leak in blk_integrity_add
@ 2020-07-25 0:17 Yi Wang
0 siblings, 0 replies; 3+ messages in thread
From: Yi Wang @ 2020-07-25 0:17 UTC (permalink / raw)
To: axboe
Cc: linux-block, linux-kernel, xue.zhihong, wang.yi59, wang.liang82,
Liao Pingfang
From: Liao Pingfang <liao.pingfang@zte.com.cn>
kobject_init_and_add() takes reference even when it fails. If this
function returns an error, kobject_put() must be called to properly
clean up the memory associated with the object.
Signed-off-by: Liao Pingfang <liao.pingfang@zte.com.cn>
Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
---
block/blk-integrity.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/block/blk-integrity.c b/block/blk-integrity.c
index c03705c..118b2f2 100644
--- a/block/blk-integrity.c
+++ b/block/blk-integrity.c
@@ -436,8 +436,10 @@ EXPORT_SYMBOL(blk_integrity_unregister);
void blk_integrity_add(struct gendisk *disk)
{
if (kobject_init_and_add(&disk->integrity_kobj, &integrity_ktype,
- &disk_to_dev(disk)->kobj, "%s", "integrity"))
+ &disk_to_dev(disk)->kobj, "%s", "integrity")) {
+ kobject_put(&disk->integrity_kobj);
return;
+ }
kobject_uevent(&disk->integrity_kobj, KOBJ_ADD);
}
--
2.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-07-25 11:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-25 11:35 [PATCH] block: Fix reference count leak in blk_integrity_add Markus Elfring
2020-07-25 11:35 ` Markus Elfring
-- strict thread matches above, loose matches on Subject: below --
2020-07-25 0:17 Yi Wang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.