Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Mar 2010 10:46:54 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r205318 - head/sys/kern
Message-ID:  <201003191046.o2JAksqH024267@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Fri Mar 19 10:46:54 2010
New Revision: 205318
URL: http://svn.freebsd.org/changeset/base/205318

Log:
  Properly handle compat32 calls to sctp generic sendmsd/recvmsg functions that
  take iov.
  
  Reviewed by:	tuexen
  MFC after:	2 weeks

Modified:
  head/sys/kern/uipc_syscalls.c

Modified: head/sys/kern/uipc_syscalls.c
==============================================================================
--- head/sys/kern/uipc_syscalls.c	Fri Mar 19 10:44:02 2010	(r205317)
+++ head/sys/kern/uipc_syscalls.c	Fri Mar 19 10:46:54 2010	(r205318)
@@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/mbuf.h>
 #include <sys/protosw.h>
 #include <sys/sf_buf.h>
+#include <sys/sysent.h>
 #include <sys/socket.h>
 #include <sys/socketvar.h>
 #include <sys/signalvar.h>
@@ -69,6 +70,9 @@ __FBSDID("$FreeBSD$");
 #ifdef KTRACE
 #include <sys/ktrace.h>
 #endif
+#ifdef COMPAT_FREEBSD32
+#include <compat/freebsd32/freebsd32_util.h>
+#endif
 
 #include <net/vnet.h>
 
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201003191046.o2JAksqH024267>