* [PATCH 0/2] Fix kobject_add refcount imbalance on block layer
@ 2019-06-04 4:00 Lin Yi
2019-06-04 4:02 ` [PATCH 1/2] block :blk-sysfs :fix kobj refcount imbalance on the err return path Lin Yi
2019-06-04 4:05 ` [PATCH 2/2] block :blk-mq-sysfs :fix kobj refcount imbalance on " Lin Yi
0 siblings, 2 replies; 6+ messages in thread
From: Lin Yi @ 2019-06-04 4:00 UTC (permalink / raw)
To: bvanassche, axboe; +Cc: linux-block
kobject_add increments the parent kobj refcount, but forget to release it
after err return, it will lead to a memory leak.
Lin Yi (2):
block :blk-sysfs :fix kobj refcount imbalance on the err return path
block :blk-mq-sysfs :fix kobj refcount imbalance on err return path
block/blk-mq-sysfs.c | 4 +++-
block/blk-sysfs.c | 1 +
2 files changed, 4 insertions(+), 1 deletion(-)
--
1.9.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] block :blk-sysfs :fix kobj refcount imbalance on the err return path
2019-06-04 4:00 [PATCH 0/2] Fix kobject_add refcount imbalance on block layer Lin Yi
@ 2019-06-04 4:02 ` Lin Yi
2019-06-04 5:36 ` Chaitanya Kulkarni
2019-06-04 4:05 ` [PATCH 2/2] block :blk-mq-sysfs :fix kobj refcount imbalance on " Lin Yi
1 sibling, 1 reply; 6+ messages in thread
From: Lin Yi @ 2019-06-04 4:02 UTC (permalink / raw)
To: bvanassche, axboe
Cc: linux-block, liujian6, csong, zhiyunq, yiqiuping, teroincn
kobject_add takes a refcount to the object dev->kobj, but forget to
release it before return, lead to a memory leak.
Signed-off-by: Lin Yi <teroincn@163.com>
Fixes: 7bd1d5edd016 ("Merge branch 'x86-urgent-for-linus' of
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip")
Cc: stable@vger.kernel.org
---
block/blk-sysfs.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index 75b5281..539b7cb 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -971,6 +971,7 @@ int blk_register_queue(struct gendisk *disk)
ret = kobject_add(&q->kobj, kobject_get(&dev->kobj), "%s", "queue");
if (ret < 0) {
blk_trace_remove_sysfs(dev);
+ kobject_put(&dev->kobj);
goto unlock;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] block :blk-mq-sysfs :fix kobj refcount imbalance on err return path
2019-06-04 4:00 [PATCH 0/2] Fix kobject_add refcount imbalance on block layer Lin Yi
2019-06-04 4:02 ` [PATCH 1/2] block :blk-sysfs :fix kobj refcount imbalance on the err return path Lin Yi
@ 2019-06-04 4:05 ` Lin Yi
2019-06-04 5:33 ` Chaitanya Kulkarni
2019-06-04 5:34 ` Chaitanya Kulkarni
1 sibling, 2 replies; 6+ messages in thread
From: Lin Yi @ 2019-06-04 4:05 UTC (permalink / raw)
To: bvanassche, axboe
Cc: linux-block, liujian6, csong, zhiyunq, yiqiuping, teroincn
kobject_add takes a refcount to the object dev->kobj, but forget to
release it before return, lead to a memory leak.
Signed-off-by: Lin Yi <teroincn@163.com>
Fixes: 7bd1d5edd016 ("Merge branch 'x86-urgent-for-linus' of
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip")
Cc: stable@vger.kernel.org
---
block/blk-mq-sysfs.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/block/blk-mq-sysfs.c b/block/blk-mq-sysfs.c
index d6e1a9b..7499a47 100644
--- a/block/blk-mq-sysfs.c
+++ b/block/blk-mq-sysfs.c
@@ -323,8 +323,10 @@ int __blk_mq_register_dev(struct device *dev, struct request_queue *q)
lockdep_assert_held(&q->sysfs_lock);
ret = kobject_add(q->mq_kobj, kobject_get(&dev->kobj), "%s", "mq");
- if (ret < 0)
+ if (ret < 0) {
+ kobject_put(&dev->kobj);
goto out;
+ }
kobject_uevent(q->mq_kobj, KOBJ_ADD);
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] block :blk-mq-sysfs :fix kobj refcount imbalance on err return path
2019-06-04 4:05 ` [PATCH 2/2] block :blk-mq-sysfs :fix kobj refcount imbalance on " Lin Yi
@ 2019-06-04 5:33 ` Chaitanya Kulkarni
2019-06-04 5:34 ` Chaitanya Kulkarni
1 sibling, 0 replies; 6+ messages in thread
From: Chaitanya Kulkarni @ 2019-06-04 5:33 UTC (permalink / raw)
To: Lin Yi, bvanassche, axboe
Cc: linux-block, liujian6, csong, zhiyunq, yiqiuping
Looks good.
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
On 6/3/19 9:05 PM, Lin Yi wrote:
> kobject_add takes a refcount to the object dev->kobj, but forget to
> release it before return, lead to a memory leak.
>
> Signed-off-by: Lin Yi <teroincn@163.com>
> Fixes: 7bd1d5edd016 ("Merge branch 'x86-urgent-for-linus' of
> git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip")
> Cc: stable@vger.kernel.org
> ---
> block/blk-mq-sysfs.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/block/blk-mq-sysfs.c b/block/blk-mq-sysfs.c
> index d6e1a9b..7499a47 100644
> --- a/block/blk-mq-sysfs.c
> +++ b/block/blk-mq-sysfs.c
> @@ -323,8 +323,10 @@ int __blk_mq_register_dev(struct device *dev, struct request_queue *q)
> lockdep_assert_held(&q->sysfs_lock);
>
> ret = kobject_add(q->mq_kobj, kobject_get(&dev->kobj), "%s", "mq");
> - if (ret < 0)
> + if (ret < 0) {
> + kobject_put(&dev->kobj);
> goto out;
> + }
>
> kobject_uevent(q->mq_kobj, KOBJ_ADD);
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] block :blk-mq-sysfs :fix kobj refcount imbalance on err return path
2019-06-04 4:05 ` [PATCH 2/2] block :blk-mq-sysfs :fix kobj refcount imbalance on " Lin Yi
2019-06-04 5:33 ` Chaitanya Kulkarni
@ 2019-06-04 5:34 ` Chaitanya Kulkarni
1 sibling, 0 replies; 6+ messages in thread
From: Chaitanya Kulkarni @ 2019-06-04 5:34 UTC (permalink / raw)
To: Lin Yi, bvanassche, axboe
Cc: linux-block, liujian6, csong, zhiyunq, yiqiuping
Looks good.
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
On 6/3/19 9:05 PM, Lin Yi wrote:
> kobject_add takes a refcount to the object dev->kobj, but forget to
> release it before return, lead to a memory leak.
>
> Signed-off-by: Lin Yi <teroincn@163.com>
> Fixes: 7bd1d5edd016 ("Merge branch 'x86-urgent-for-linus' of
> git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip")
> Cc: stable@vger.kernel.org
> ---
> block/blk-mq-sysfs.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/block/blk-mq-sysfs.c b/block/blk-mq-sysfs.c
> index d6e1a9b..7499a47 100644
> --- a/block/blk-mq-sysfs.c
> +++ b/block/blk-mq-sysfs.c
> @@ -323,8 +323,10 @@ int __blk_mq_register_dev(struct device *dev, struct request_queue *q)
> lockdep_assert_held(&q->sysfs_lock);
>
> ret = kobject_add(q->mq_kobj, kobject_get(&dev->kobj), "%s", "mq");
> - if (ret < 0)
> + if (ret < 0) {
> + kobject_put(&dev->kobj);
> goto out;
> + }
>
> kobject_uevent(q->mq_kobj, KOBJ_ADD);
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] block :blk-sysfs :fix kobj refcount imbalance on the err return path
2019-06-04 4:02 ` [PATCH 1/2] block :blk-sysfs :fix kobj refcount imbalance on the err return path Lin Yi
@ 2019-06-04 5:36 ` Chaitanya Kulkarni
0 siblings, 0 replies; 6+ messages in thread
From: Chaitanya Kulkarni @ 2019-06-04 5:36 UTC (permalink / raw)
To: Lin Yi, bvanassche, axboe
Cc: linux-block, liujian6, csong, zhiyunq, yiqiuping
Looks good.
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
On 6/3/19 9:03 PM, Lin Yi wrote:
> kobject_add takes a refcount to the object dev->kobj, but forget to
> release it before return, lead to a memory leak.
>
> Signed-off-by: Lin Yi <teroincn@163.com>
> Fixes: 7bd1d5edd016 ("Merge branch 'x86-urgent-for-linus' of
> git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip")
> Cc: stable@vger.kernel.org
> ---
> block/blk-sysfs.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
> index 75b5281..539b7cb 100644
> --- a/block/blk-sysfs.c
> +++ b/block/blk-sysfs.c
> @@ -971,6 +971,7 @@ int blk_register_queue(struct gendisk *disk)
> ret = kobject_add(&q->kobj, kobject_get(&dev->kobj), "%s", "queue");
> if (ret < 0) {
> blk_trace_remove_sysfs(dev);
> + kobject_put(&dev->kobj);
> goto unlock;
> }
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-06-04 5:36 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-04 4:00 [PATCH 0/2] Fix kobject_add refcount imbalance on block layer Lin Yi
2019-06-04 4:02 ` [PATCH 1/2] block :blk-sysfs :fix kobj refcount imbalance on the err return path Lin Yi
2019-06-04 5:36 ` Chaitanya Kulkarni
2019-06-04 4:05 ` [PATCH 2/2] block :blk-mq-sysfs :fix kobj refcount imbalance on " Lin Yi
2019-06-04 5:33 ` Chaitanya Kulkarni
2019-06-04 5:34 ` Chaitanya Kulkarni
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.