All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block: register_blkdev doesn't check name against NULL
@ 2013-09-10 10:40 Vaughan Cao
  2013-09-11  2:24 ` [PATCH v2] " Vaughan Cao
  0 siblings, 1 reply; 5+ messages in thread
From: Vaughan Cao @ 2013-09-10 10:40 UTC (permalink / raw)
  To: axboe, linux-kernel; +Cc: vaughan.cao

register_blkdev(0, NULL) can result kernel Oops by copying from NULL
in strlcpy(). Fix it by checking NULL pointer at the beginning.

Signed-off-by: Vaughan Cao <vaughan.cao@oracle.com>
---
 block/genhd.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/block/genhd.c b/block/genhd.c
index dadf42b..9564f19 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -287,6 +287,9 @@ int register_blkdev(unsigned int major, const char *name)
 	struct blk_major_name **n, *p;
 	int index, ret = 0;
 
+	if (!name)
+		return -EINVAL;
+
 	mutex_lock(&block_class_lock);
 
 	/* temporary */
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-09-30  2:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-10 10:40 [PATCH] block: register_blkdev doesn't check name against NULL Vaughan Cao
2013-09-11  2:24 ` [PATCH v2] " Vaughan Cao
2013-09-23 14:56   ` Jeff Moyer
2013-09-29  6:55     ` vaughan
2013-09-30  2:19       ` chaiwen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.