fs/signalfd.c: fix inconsistent return codes for signalfd4
authorHelge Deller <deller@gmx.de>
Wed, 12 Aug 2020 01:36:04 +0000 (18:36 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Aug 2020 09:42:13 +0000 (11:42 +0200)
commit46c9e8a040f0a87c57d07fea968176dda11c56fb
treec2cc293fb640780f913c84e4ceff08a9dcf2eb87
parent5dff40bf9dea12f12a0003c84130b494c0533baa
fs/signalfd.c: fix inconsistent return codes for signalfd4

[ Upstream commit a089e3fd5a82aea20f3d9ec4caa5f4c65cc2cfcc ]

The kernel signalfd4() syscall returns different error codes when called
either in compat or native mode.  This behaviour makes correct emulation
in qemu and testing programs like LTP more complicated.

Fix the code to always return -in both modes- EFAULT for unaccessible user
memory, and EINVAL when called with an invalid signal mask.

Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Laurent Vivier <laurent@vivier.eu>
Link: http://lkml.kernel.org/r/20200530100707.GA10159@ls3530.fritz.box
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/signalfd.c