diff options
author | Dmitry Chagin <dchagin@FreeBSD.org> | 2009-05-16 18:46:51 +0000 |
---|---|---|
committer | Dmitry Chagin <dchagin@FreeBSD.org> | 2009-05-16 18:46:51 +0000 |
commit | eeb63e515f60b0e1bdff8fc25130b8f3e9489582 (patch) | |
tree | e260994c3c79b81f47c5ba6f9e6f7189b596a401 /sys/compat | |
parent | 6994ea543f06af0c76234dae538e8d9759735e12 (diff) | |
download | src-eeb63e515f60b0e1bdff8fc25130b8f3e9489582.tar.gz src-eeb63e515f60b0e1bdff8fc25130b8f3e9489582.zip |
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)
Notes
Notes:
svn path=/head/; revision=192205
Diffstat (limited to 'sys/compat')
-rw-r--r-- | sys/compat/linux/linux_socket.c | 2 | ||||
-rw-r--r-- | sys/compat/linux/linux_socket.h | 10 |
2 files changed, 12 insertions, 0 deletions
diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c index ee7bf184ad05..e99ef84f414e 100644 --- a/sys/compat/linux/linux_socket.c +++ b/sys/compat/linux/linux_socket.c @@ -597,6 +597,8 @@ linux_socket(struct thread *td, struct linux_socket_args *args) 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); diff --git a/sys/compat/linux/linux_socket.h b/sys/compat/linux/linux_socket.h index 311b1524f21e..0730761cfc2b 100644 --- a/sys/compat/linux/linux_socket.h +++ b/sys/compat/linux/linux_socket.h @@ -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; |