From: Giel van Schijndel <me@mortis.eu>
To: linux-kernel@vger.kernel.org
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
Giel van Schijndel <me@mortis.eu>,
Steve French <sfrench@samba.org>,
linux-cifs@vger.kernel.org (open list:COMMON INTERNET F...),
samba-technical@lists.samba.org (moderated list:COMMON INTERNET
F...)
Subject: [PATCH RESEND] cifs: use memzero_explicit to clear stack buffer
Date: Tue, 6 Jan 2015 22:37:00 +0100 [thread overview]
Message-ID: <1420580220-6276-1-git-send-email-me@mortis.eu> (raw)
In-Reply-To: <1420394744-20268-1-git-send-email-me@mortis.eu>
When leaving a function use memzero_explicit instead of memset(0) to
clear stack allocated buffers. memset(0) may be optimized away.
This particular buffer is highly likely to contain sensitive data which
we shouldn't leak (it's named 'passwd' after all).
Signed-off-by: Giel van Schijndel <me@mortis.eu>
Reported-at: http://www.viva64.com/en/b/0299/
Reported-by: Andrey Karpov
Reported-by: Svyatoslav Razmyslov
---
fs/cifs/smbencrypt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/cifs/smbencrypt.c b/fs/cifs/smbencrypt.c
index 6c15663..a4232ec 100644
--- a/fs/cifs/smbencrypt.c
+++ b/fs/cifs/smbencrypt.c
@@ -221,7 +221,7 @@ E_md4hash(const unsigned char *passwd, unsigned char *p16,
}
rc = mdfour(p16, (unsigned char *) wpwd, len * sizeof(__le16));
- memset(wpwd, 0, 129 * sizeof(__le16));
+ memzero_explicit(wpwd, sizeof(wpwd));
return rc;
}
--
2.1.4
next prev parent reply other threads:[~2015-01-06 21:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-04 18:05 [PATCH] Use memzero_explicit to clear local buffers Giel van Schijndel
2015-01-04 21:35 ` Herbert Xu
2015-01-04 22:49 ` Giel van Schijndel
2015-01-04 23:36 ` Herbert Xu
2015-01-06 19:42 ` Giel van Schijndel
2015-01-06 20:54 ` Herbert Xu
2015-01-04 23:05 ` Giel van Schijndel
2015-01-06 21:37 ` Giel van Schijndel [this message]
2015-01-06 22:59 ` [PATCH RESEND] cifs: use memzero_explicit to clear stack buffer Herbert Xu
2015-01-13 0:12 ` Steve French
2015-01-09 18:53 ` Steve French
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=1420580220-6276-1-git-send-email-me@mortis.eu \
--to=me@mortis.eu \
--cc=herbert@gondor.apana.org.au \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=samba-technical@lists.samba.org \
--cc=sfrench@samba.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®