]> git.baikalelectronics.ru Git - kernel.git/commit
lib: Reduce user_access_begin() boundaries in strncpy_from_user() and strnlen_user()
authorChristophe Leroy <christophe.leroy@c-s.fr>
Thu, 23 Jan 2020 08:34:18 +0000 (08:34 +0000)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 24 Jan 2020 17:27:34 +0000 (09:27 -0800)
commitbfe34543ea0d99900cabe75a2cddd7974362b7b5
tree20ae31e0a7fcbbbe516fbba8aeacf43c0ea37205
parent9adaf2d6801f95d03c42031cd55d83b0a2fa9423
lib: Reduce user_access_begin() boundaries in strncpy_from_user() and strnlen_user()

The range passed to user_access_begin() by strncpy_from_user() and
strnlen_user() starts at 'src' and goes up to the limit of userspace
although reads will be limited by the 'count' param.

On 32 bits powerpc (book3s/32) access has to be granted for each
256Mbytes segment and the cost increases with the number of segments to
unlock.

Limit the range with 'count' param.

Fixes: e111b200d102 ("make 'user_access_begin()' do 'access_ok()'")
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
lib/strncpy_from_user.c
lib/strnlen_user.c