* Patch "lib: Fix strnlen_user() to not touch memory after specified maximum" has been added to the 3.14-stable tree
@ 2015-06-03 1:32 gregkh
0 siblings, 0 replies; only message in thread
From: gregkh @ 2015-06-03 1:32 UTC (permalink / raw)
To: jack, gregkh, torvalds; +Cc: stable, stable-commits
This is a note to let you know that I've just added the patch titled
lib: Fix strnlen_user() to not touch memory after specified maximum
to the 3.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
lib-fix-strnlen_user-to-not-touch-memory-after-specified-maximum.patch
and it can be found in the queue-3.14 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.
>From f18c34e483ff6b1d9866472221e4015b3a4698e4 Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Tue, 2 Jun 2015 17:10:28 +0200
Subject: lib: Fix strnlen_user() to not touch memory after specified maximum
From: Jan Kara <jack@suse.cz>
commit f18c34e483ff6b1d9866472221e4015b3a4698e4 upstream.
If the specified maximum length of the string is a multiple of unsigned
long, we would load one long behind the specified maximum. If that
happens to be in a next page, we can hit a page fault although we were
not expected to.
Fix the off-by-one bug in the test whether we are at the end of the
specified range.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
lib/strnlen_user.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/lib/strnlen_user.c
+++ b/lib/strnlen_user.c
@@ -57,7 +57,8 @@ static inline long do_strnlen_user(const
return res + find_zero(data) + 1 - align;
}
res += sizeof(unsigned long);
- if (unlikely(max < sizeof(unsigned long)))
+ /* We already handled 'unsigned long' bytes. Did we do it all ? */
+ if (unlikely(max <= sizeof(unsigned long)))
break;
max -= sizeof(unsigned long);
if (unlikely(__get_user(c,(unsigned long __user *)(src+res))))
Patches currently in stable-queue which might be from jack@suse.cz are
queue-3.14/lib-fix-strnlen_user-to-not-touch-memory-after-specified-maximum.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-06-03 1:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-03 1:32 Patch "lib: Fix strnlen_user() to not touch memory after specified maximum" has been added to the 3.14-stable tree gregkh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).