ANDROID: xfrm: remove in_compat_syscall() checks [v2]

This hack is needed to run 32-bit userspace on 64-bit kernel.

This effectively reverts:
  commit 1a9d91561d.
  ANDROID: xfrm: remove in_compat_syscall() checks

and then re-implements the same functionality as a two liner
which should be easier to understand across merge conflicts.

Bug: 138147164
Bug: 163141236
Test: kernel_net_tests
Change-Id: Ic7839c20e832781ac908d2779419d66e87e2b48c
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
Maciej Żenczykowski 2020-08-07 11:56:06 -07:00 committed by Greg Kroah-Hartman
parent aa9752dec8
commit 7ad8c9a12d
2 changed files with 4 additions and 1 deletions

View File

@ -2271,7 +2271,7 @@ int xfrm_user_policy(struct sock *sk, int optname, sockptr_t optval, int optlen)
struct xfrm_mgr *km;
struct xfrm_policy *pol = NULL;
if (in_compat_syscall())
if (!IS_ENABLED(CONFIG_ANDROID) && in_compat_syscall())
return -EOPNOTSUPP;
if (sockptr_is_null(optval) && !optlen) {

View File

@ -2642,6 +2642,9 @@ static int xfrm_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh,
const struct xfrm_link *link;
int type, err;
if (!IS_ENABLED(CONFIG_ANDROID) && in_compat_syscall())
return -EOPNOTSUPP;
type = nlh->nlmsg_type;
if (type > XFRM_MSG_MAX)
return -EINVAL;