summaryrefslogtreecommitdiffstats
path: root/net/compat.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2017-09-28 09:22:50 +0200
committerIngo Molnar <mingo@kernel.org>2017-09-28 09:22:50 +0200
commit4f56186ec051033848a669f1b145162d1c53e854 (patch)
treee86aae5e1997d9f3df5f6ba348ab6a4e2137832a /net/compat.c
parentaa469aafddca64d6570d2257b3443359af55ab88 (diff)
parent9cd6681cb1169e815c41af0265165dd1b872f228 (diff)
downloadlinux-4f56186ec051033848a669f1b145162d1c53e854.tar.bz2
Merge branch 'linus' into perf/core, to refresh the branch
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'net/compat.c')
-rw-r--r--net/compat.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/net/compat.c b/net/compat.c
index 6ded6c821d7a..22381719718c 100644
--- a/net/compat.c
+++ b/net/compat.c
@@ -185,6 +185,13 @@ int cmsghdr_from_user_compat_to_kern(struct msghdr *kmsg, struct sock *sk,
ucmsg = cmsg_compat_nxthdr(kmsg, ucmsg, ucmlen);
}
+ /*
+ * check the length of messages copied in is the same as the
+ * what we get from the first loop
+ */
+ if ((char *)kcmsg - (char *)kcmsg_base != kcmlen)
+ goto Einval;
+
/* Ok, looks like we made it. Hook it up and return success. */
kmsg->msg_control = kcmsg_base;
kmsg->msg_controllen = kcmlen;