From: Dan Carpenter <dan.carpenter@oracle.com>
To: Petr Vandrovec <petr@vandrovec.name>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] ncpfs: add a sanity check in ncp_is_nfs_extras()
Date: Sat, 28 Sep 2013 09:39:43 +0000 [thread overview]
Message-ID: <20130928093943.GD26611@elgon.mountain> (raw)
The "volnum" can come from the server and my static checker complains
that we can't trust it. In theory, it could lead to an info leak but
in real life, it is unlikely.
One way this comes from the server is ncp_obtain_info() initializes
target by calling:
ncp_extract_file_info(ncp_reply_data(server, 0), target);
It then passes target to ncp_obtain_nfs_info() and from there to
ncp_is_nfs_extras().
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/fs/ncpfs/ncplib_kernel.h b/fs/ncpfs/ncplib_kernel.h
index 32c0658..ae08b9f 100644
--- a/fs/ncpfs/ncplib_kernel.h
+++ b/fs/ncpfs/ncplib_kernel.h
@@ -119,6 +119,7 @@ int ncp_create_new(struct inode *dir, struct dentry *dentry,
static inline int ncp_is_nfs_extras(struct ncp_server* server, unsigned int volnum) {
#ifdef CONFIG_NCPFS_NFS_NS
return (server->m.flags & NCP_MOUNT_NFS_EXTRAS) &&
+ (volnum < ARRAY_SIZE(server->name_space)) &&
(server->name_space[volnum] = NW_NS_NFS);
#else
return 0;
reply other threads:[~2013-09-28 9:39 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=20130928093943.GD26611@elgon.mountain \
--to=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=petr@vandrovec.name \
/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