summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorSteffen Klassert <steffen.klassert@secunet.com>2018-02-01 08:49:23 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-04-08 12:12:49 +0200
commit02a5b414bf929922d84bb2289c7ef78eb060a426 (patch)
tree3a86c37608a5d637adbf3f6cf96cde08f3def6cf /net
parent30df7fb50d323c05ae7913c404753047335cf0fa (diff)
downloadlinux-stable-02a5b414bf929922d84bb2289c7ef78eb060a426.tar.gz
linux-stable-02a5b414bf929922d84bb2289c7ef78eb060a426.tar.bz2
linux-stable-02a5b414bf929922d84bb2289c7ef78eb060a426.zip
xfrm: Refuse to insert 32 bit userspace socket policies on 64 bit systems
commit 19d7df69fdb2636856dc8919de72fc1bf8f79598 upstream. We don't have a compat layer for xfrm, so userspace and kernel structures have different sizes in this case. This results in a broken configuration, so refuse to configure socket policies when trying to insert from 32 bit userspace as we do it already with policies inserted via netlink. Reported-and-tested-by: syzbot+e1a1577ca8bcb47b769a@syzkaller.appspotmail.com Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r--net/xfrm/xfrm_state.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 13e0611a9085..fdb9742d934e 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -1883,6 +1883,11 @@ int xfrm_user_policy(struct sock *sk, int optname, u8 __user *optval, int optlen
struct xfrm_mgr *km;
struct xfrm_policy *pol = NULL;
+#ifdef CONFIG_COMPAT
+ if (in_compat_syscall())
+ return -EOPNOTSUPP;
+#endif
+
if (!optval && !optlen) {
xfrm_sk_policy_insert(sk, XFRM_POLICY_IN, NULL);
xfrm_sk_policy_insert(sk, XFRM_POLICY_OUT, NULL);