author | Jan Kara <jack@suse.cz> | |
Tue, 2 Jun 2015 15:10:28 +0000 (17:10 +0200) | ||
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
Sat, 6 Jun 2015 15:19:32 +0000 (08:19 -0700) | ||
commit | 9ad68dc3f6f155f6a8bda0bb8837c854a9db2ff2 | |
tree | f6fa4f1c33e5601154b0efda70873fbac669a20c | tree | snapshot (tar.xz tar.gz zip) |
parent | 7bbf0eb78d91361497ce6dbb787cf1625cbaeb1a | commit | diff |
lib: Fix strnlen_user() to not touch memory after specified maximum
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>
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 | diff | blob | history |