[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1491480169-1889-3-git-send-email-dmonakhov@openvz.org>
Date: Thu, 6 Apr 2017 16:02:46 +0400
From: Dmitry Monakhov <dmonakhov@...nvz.org>
To: linux-kernel@...r.kernel.org
Cc: darrick.wong@...cle.com, axboe@...nel.dk, tytso@....edu,
jack@...e.cz, hch@...radead.org,
Dmitry Monakhov <dmonakhov@...nvz.org>
Subject: [PATCH 2/5] block: protect bdevname from null pointer bdev
Some callers (usually error paths) call bdevname with null bdev.
Signed-off-by: Dmitry Monakhov <dmonakhov@...nvz.org>
---
block/partition-generic.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/block/partition-generic.c b/block/partition-generic.c
index 7afb990..284de18 100644
--- a/block/partition-generic.c
+++ b/block/partition-generic.c
@@ -46,6 +46,8 @@ char *disk_name(struct gendisk *hd, int partno, char *buf)
const char *bdevname(struct block_device *bdev, char *buf)
{
+ if (unlikely(!bdev))
+ return snprintf(buf, BDEVNAME_SIZE, "unknown-block(null)");
return disk_name(bdev->bd_disk, bdev->bd_part->partno, buf);
}
--
2.9.3
Powered by blists - more mailing lists