From: Vaughan Cao <vaughan.cao@oracle.com>
To: axboe@kernel.dk, linux-kernel@vger.kernel.org
Cc: vaughan.cao@oracle.com
Subject: [PATCH] block: register_blkdev doesn't check name against NULL
Date: Tue, 10 Sep 2013 18:40:14 +0800 [thread overview]
Message-ID: <1378809614-17490-1-git-send-email-vaughan.cao@oracle.com> (raw)
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
next reply other threads:[~2013-09-10 10:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-10 10:40 Vaughan Cao [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1378809614-17490-1-git-send-email-vaughan.cao@oracle.com \
--to=vaughan.cao@oracle.com \
--cc=axboe@kernel.dk \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®