svn commit: r192205 - head/sys/compat/linux
Dmitry Chagin
dchagin at FreeBSD.org
Sat May 16 18:46:52 UTC 2009
Author: dchagin
Date: Sat May 16 18:46:51 2009
New Revision: 192205
URL: http://svn.freebsd.org/changeset/base/192205
Log:
Return EINVAL in case when the incorrect or unsupported
type argument is specified.
Do not map type argument value as its Linux values are
identical to FreeBSD values.
Approved by: kib (mentor)
Modified:
head/sys/compat/linux/linux_socket.c
head/sys/compat/linux/linux_socket.h
Modified: head/sys/compat/linux/linux_socket.c
==============================================================================
--- head/sys/compat/linux/linux_socket.c Sat May 16 18:44:56 2009 (r192204)
+++ head/sys/compat/linux/linux_socket.c Sat May 16 18:46:51 2009 (r192205)
@@ -597,6 +597,8 @@ linux_socket(struct thread *td, struct l
bsd_args.protocol = args->protocol;
bsd_args.type = args->type;
+ if (bsd_args.type < 0 || bsd_args.type > LINUX_SOCK_MAX)
+ return (EINVAL);
bsd_args.domain = linux_to_bsd_domain(args->domain);
if (bsd_args.domain == -1)
return (EAFNOSUPPORT);
Modified: head/sys/compat/linux/linux_socket.h
==============================================================================
--- head/sys/compat/linux/linux_socket.h Sat May 16 18:44:56 2009 (r192204)
+++ head/sys/compat/linux/linux_socket.h Sat May 16 18:46:51 2009 (r192205)
@@ -90,6 +90,16 @@
#define LINUX_AF_APPLETALK 5
#define LINUX_AF_INET6 10
+/* Supported socket types */
+
+#define LINUX_SOCK_STREAM 1
+#define LINUX_SOCK_DGRAM 2
+#define LINUX_SOCK_RAW 3
+#define LINUX_SOCK_RDM 4
+#define LINUX_SOCK_SEQPACKET 5
+
+#define LINUX_SOCK_MAX LINUX_SOCK_SEQPACKET
+
struct l_ucred {
uint32_t pid;
uint32_t uid;
More information about the svn-src-head
mailing list