Looks good. Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@xxxxxxx> 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@xxxxxxx> > Fixes: 7bd1d5edd016 ("Merge branch 'x86-urgent-for-linus' of > git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip") > Cc: stable@xxxxxxxxxxxxxxx > --- > 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); > >