]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android-sdk/kernel-video.git/commit
lib: Fix strnlen_user() to not touch memory after specified maximum
authorJan Kara <jack@suse.cz>
Tue, 2 Jun 2015 15:10:28 +0000 (17:10 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 6 Jun 2015 15:19:32 +0000 (08:19 -0700)
commit9ad68dc3f6f155f6a8bda0bb8837c854a9db2ff2
treef6fa4f1c33e5601154b0efda70873fbac669a20c
parent7bbf0eb78d91361497ce6dbb787cf1625cbaeb1a
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>
lib/strnlen_user.c