Skip to contentSkip to conversation

blk-fs: put dev->kobj in blk_register_queue fail path

PATCH In review Xiaotian Feng 2 participants 2 messages Aug 13, 2010 – Aug 23, 2010 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 blk-fs: put dev->kobj in blk_register_queue fail path

kernel needs to kobject_put on dev->kobj if elv_register_queue fails.

Cc Jens Axboe <[email protected]>
Cc "Martin K. Petersen" <[email protected]>
Cc Stephen Hemminger <[email protected]>
Cc Nikanth Karthikesan <[email protected]>
Cc David Teigland <[email protected]>
---
 block/blk-sysfs.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
block/blk-sysfs.c +1 -0
index 001ab18..0749b89 100644
@@ -511,6 +511,7 @@ int blk_register_queue(struct gendisk *disk)
 		kobject_uevent(&q->kobj, KOBJ_REMOVE);
 		kobject_del(&q->kobj);
 		blk_trace_remove_sysfs(disk_to_dev(disk));
+		kobject_put(&dev->kobj);
 		return ret;
 	}
 
Signature · 1 line
1.7.2.1
maintainer
#1 lore raw
Quoted 17 lines · Xiaotian Feng

kernel needs to kobject_put on dev->kobj if elv_register_queue fails.

Cc Jens Axboe <[email protected]>
Cc "Martin K. Petersen" <[email protected]>
Cc Stephen Hemminger <[email protected]>
Cc Nikanth Karthikesan <[email protected]>
Cc David Teigland <[email protected]>
---
 block/blk-sysfs.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
block/blk-sysfs.c +0 -0
index 001ab18..0749b89 100644

block/blk-sysfs.c int blk_register_queue(struct gendisk *disk) · line 517

Quoted 7 lines
block/blk-sysfs.c +1 -0
@@ -511,6 +511,7 @@ int blk_register_queue(struct gendisk *disk)
 		kobject_uevent(&q->kobj, KOBJ_REMOVE);
 		kobject_del(&q->kobj);
 		blk_trace_remove_sysfs(disk_to_dev(disk));
+		kobject_put(&dev->kobj);
 		return ret;
 	}
 

Looks correct. Thanks, applied.

Signature · 1 line
Jens Axboe