diff options
author | Christoph Hellwig <hch@infradead.org> | 2004-07-04 20:26:43 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-07-04 20:26:43 -0700 |
commit | 7e241bcbbe58d27d6bbe8012fd1a888efe4fc160 (patch) | |
tree | c1cc57d392c09f604643b1ef2da10228f5b557d1 /fs | |
parent | 5d76a31ed993a5b13504a400d6c627158cc7c348 (diff) | |
download | history-7e241bcbbe58d27d6bbe8012fd1a888efe4fc160.tar.gz |
[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: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/partitions/check.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/fs/partitions/check.c b/fs/partitions/check.c index cc107c30d8bc23..cc37e011f10d0b 100644 --- a/fs/partitions/check.c +++ b/fs/partitions/check.c @@ -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; } |