powerpc/fscr: Enable interrupts earlier before calling get_user()
authorAnshuman Khandual <khandual@linux.vnet.ibm.com>
Thu, 29 Mar 2018 06:23:37 +0000 (11:53 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 May 2018 05:52:23 +0000 (07:52 +0200)
commit6689a4c7b9ed838821c72c976896eb74457f665f
tree1d96320367d8037eec0bc10e38f8035d01a256a4
parent96fdc64d8eda887ae1a290b4f11f67a4a942d949
powerpc/fscr: Enable interrupts earlier before calling get_user()

[ Upstream commit 709b973c844c0b4d115ac3a227a2e5a68722c912 ]

The function get_user() can sleep while trying to fetch instruction
from user address space and causes the following warning from the
scheduler.

BUG: sleeping function called from invalid context

Though interrupts get enabled back but it happens bit later after
get_user() is called. This change moves enabling these interrupts
earlier covering the function get_user(). While at this, lets check
for kernel mode and crash as this interrupt should not have been
triggered from the kernel context.

Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/kernel/traps.c