From b145781d4986761ace10007642728c9b9e5562d5 Mon Sep 17 00:00:00 2001 From: kib Date: Fri, 19 Mar 2010 10:46:54 +0000 Subject: Properly handle compat32 calls to sctp generic sendmsd/recvmsg functions that take iov. Reviewed by: tuexen MFC after: 2 weeks --- sys/kern/uipc_syscalls.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'sys/kern') diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 4b9eb4e..a14be72 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -69,6 +70,9 @@ __FBSDID("$FreeBSD$"); #ifdef KTRACE #include #endif +#ifdef COMPAT_FREEBSD32 +#include +#endif #include @@ -2513,7 +2517,13 @@ sctp_generic_sendmsg_iov(td, uap) if (error) goto sctp_bad1; - error = copyiniov(uap->iov, uap->iovlen, &iov, EMSGSIZE); +#ifdef COMPAT_FREEBSD32 + if (SV_CURPROC_FLAG(SV_ILP32)) + error = freebsd32_copyiniov((struct iovec32 *)uap->iov, + uap->iovlen, &iov, EMSGSIZE); + else +#endif + error = copyiniov(uap->iov, uap->iovlen, &iov, EMSGSIZE); if (error) goto sctp_bad1; #ifdef KTRACE @@ -2615,10 +2625,15 @@ sctp_generic_recvmsg(td, uap) if (error) { return (error); } - error = copyiniov(uap->iov, uap->iovlen, &iov, EMSGSIZE); - if (error) { +#ifdef COMPAT_FREEBSD32 + if (SV_CURPROC_FLAG(SV_ILP32)) + error = freebsd32_copyiniov((struct iovec32 *)uap->iov, + uap->iovlen, &iov, EMSGSIZE); + else +#endif + error = copyiniov(uap->iov, uap->iovlen, &iov, EMSGSIZE); + if (error) goto out1; - } so = fp->f_data; #ifdef MAC -- cgit v1.1