block: fix improper kobject release in blk_integrity_unregister
authorXiaotian Feng <dfeng@redhat.com>
Tue, 28 Jul 2009 07:11:14 +0000 (09:11 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Tue, 28 Jul 2009 07:11:14 +0000 (09:11 +0200)
blk_integrity_unregister should use kobject_put to release the kobject,
otherwise after bi is freed, memory of bi->kobj->name is leaked.

Signed-off-by: Xiaotian Feng <dfeng@redhat.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
block/blk-integrity.c

index 73e28d35568841e5caebd9b8b0648c5b21bee0b4..15c630813b1ca550b39f40c8745c100f6ea8b2a3 100644 (file)
@@ -379,6 +379,7 @@ void blk_integrity_unregister(struct gendisk *disk)
 
        kobject_uevent(&bi->kobj, KOBJ_REMOVE);
        kobject_del(&bi->kobj);
+       kobject_put(&bi->kobj);
        kmem_cache_free(integrity_cachep, bi);
        disk->integrity = NULL;
 }