From: Guo Chao <yan@linux.vnet.ibm.com>
To: viro@zeniv.linux.org.uk
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] Trig a BUG when kern_path see LOOKUP_ROOT in flag
Date: Wed, 4 Jul 2012 10:00:05 +0800 [thread overview]
Message-ID: <1341367205-29571-1-git-send-email-yan@linux.vnet.ibm.com> (raw)
kern_path does not prepare for LOOKUP_ROOT, if this flag is passed down,
path_init will reference uninitialized nameidata. When things go wrong, it will
not be as obvious as dereferencing a null pointer. Kindly trig a bug here.
Signed-off-by: Guo Chao <yan@linux.vnet.ibm.com>
---
fs/namei.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/namei.c b/fs/namei.c
index 1b64746..2b8c226 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1888,6 +1888,9 @@ struct dentry *kern_path_locked(const char *name, struct path *path)
int kern_path(const char *name, unsigned int flags, struct path *path)
{
struct nameidata nd;
+
+ BUG_ON(flags & LOOKUP_ROOT);
+
int res = do_path_lookup(AT_FDCWD, name, flags, &nd);
if (!res)
*path = nd.path;
--
1.7.9.5
reply other threads:[~2012-07-04 2:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1341367205-29571-1-git-send-email-yan@linux.vnet.ibm.com \
--to=yan@linux.vnet.ibm.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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®