lib: Add might_fault() to strncpy_from_user.
authorKP Singh <kpsingh@chromium.org>
Thu, 4 Jun 2020 23:50:11 +0000 (16:50 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 5 Jun 2020 02:06:25 +0000 (19:06 -0700)
commit07887358993d48571f0f3a25cfce715564b35587
tree963fa448037023b18a406a6965d8b898a8743980
parent9ac17575804024fb3d5692cad7afc08929bab981
lib: Add might_fault() to strncpy_from_user.

When updating a piece of broken logic from using get_user to
strncpy_from_user, we noticed that a warning which is expected when
calling a function that might fault from an atomic context with
pagefaults enabled disappeared.

Not having this warning in place can lead to calling strncpy_from_user
from an atomic context and eventually kernel crashes/stack corruption.

Signed-off-by: KP Singh <kpsingh@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Jann Horn <jannh@google.com>
Cc: Christophe Leroy <christophe.leroy@c-s.fr>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20200414225705.255711-1-kpsingh@chromium.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
lib/strncpy_from_user.c