From: Junxiao Bi <junxiao.bi@oracle.com>
To: linux-nfs@vger.kernel.org
Cc: bfields@fieldses.org
Subject: [PATCH] nfsd: fix memory corruption due to uninitialized variable
Date: Sun, 18 Jan 2015 20:29:02 +0800 [thread overview]
Message-ID: <1421584142-12505-1-git-send-email-junxiao.bi@oracle.com> (raw)
nfsd4_decode_open() doesn't initialize variable open->op_file and
open->op_stp, they are initialized in nfsd4_process_open1(), but if
any error happens before initializing them, nfsd4_open() will call
into nfsd4_cleanup_open_state() and corrupt the memory.
Since nfsd4_process_open1() will initialize these two variables and
open->op_openowner, make them default to null at the beginning.
Signed-off-by: Junxiao Bi <junxiao.bi@oracle.com>
---
fs/nfsd/nfs4state.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index c06a1ba..6e74a91 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -3547,6 +3547,10 @@ nfsd4_process_open1(struct nfsd4_compound_state *cstate,
struct nfs4_openowner *oo = NULL;
__be32 status;
+ open->op_file = NULL;
+ open->op_openowner = NULL;
+ open->op_stp = NULL;
+
if (STALE_CLIENTID(&open->op_clientid, nn))
return nfserr_stale_clientid;
/*
--
1.7.9.5
next reply other threads:[~2015-01-18 12:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-18 12:29 Junxiao Bi [this message]
2015-01-18 14:43 ` [PATCH] nfsd: fix memory corruption due to uninitialized variable Trond Myklebust
2015-01-19 1:17 ` Junxiao Bi
2015-01-19 14:29 ` Jeff Layton
2015-01-20 11:49 ` Junxiao Bi
2015-01-20 12:23 ` Jeff Layton
2015-01-20 12:26 ` Junxiao Bi
2015-01-20 14:36 ` Bruce Fields
2015-01-21 1:30 ` Junxiao Bi
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=1421584142-12505-1-git-send-email-junxiao.bi@oracle.com \
--to=junxiao.bi@oracle.com \
--cc=bfields@fieldses.org \
--cc=linux-nfs@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