From 7ad8c9a12d792fb2d5f48144f714811b9e9e0f5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20=C5=BBenczykowski?= Date: Fri, 7 Aug 2020 11:56:06 -0700 Subject: [PATCH] ANDROID: xfrm: remove in_compat_syscall() checks [v2] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This hack is needed to run 32-bit userspace on 64-bit kernel. This effectively reverts: commit 1a9d91561de246161297005c80bf2cd4f3c8dcaa. 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 Signed-off-by: Greg Kroah-Hartman --- net/xfrm/xfrm_state.c | 2 +- net/xfrm/xfrm_user.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index 69520ad3d83b..d825f4a40b85 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c @@ -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) { diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index 8e4fb35cfc06..cf35d68e97cc 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c @@ -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;