Commit 7e241bcb authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Linus Torvalds

[PATCH] __bdevname leak fix

The __bdevname library function is leaking module references due to

	__bdevname
 	->get_gendisk
 	  ->kobj_lookup
 	    ->ata_probe
 	      ->get_disk
 	        ->try_module_get

What we're trying to do in there is too ambitious.  Change it to just print
the major and minor.
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 5d76a31e
......@@ -137,25 +137,14 @@ const char *bdevname(struct block_device *bdev, char *buf)
EXPORT_SYMBOL(bdevname);
/*
* NOTE: this cannot be called from interrupt context.
*
* But in interrupt context you should really have a struct
* block_device anyway and use bdevname() above.
* There's very little reason to use this, you should really
* have a struct block_device just about everywhere and use
* bdevname() instead.
*/
const char *__bdevname(dev_t dev, char *buffer)
{
struct gendisk *disk;
int part;
disk = get_gendisk(dev, &part);
if (disk) {
buffer = disk_name(disk, part, buffer);
put_disk(disk);
} else {
snprintf(buffer, BDEVNAME_SIZE, "unknown-block(%u,%u)",
scnprintf(buffer, BDEVNAME_SIZE, "unknown-block(%u,%u)",
MAJOR(dev), MINOR(dev));
}
return buffer;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment