summaryrefslogtreecommitdiff
path: root/sys/compat/linux
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2018-03-16 17:25:04 +0000
committerchristos <christos@NetBSD.org>2018-03-16 17:25:04 +0000
commitcd81eded9f4f5d91df8536d06ddcbc85d78b1c82 (patch)
tree0a13b67225d17dc649b284827a0fce832ec78fcc /sys/compat/linux
parent8c3f691180463cf475f8ae02eb034232fd7b6c1c (diff)
PR/53103: Timo Buhrmester: linux emulation of sendto(2) broken
The sockargs refactoring broke it, because sockargs only works with a user address. Added an argument to sockargs to indicate where the address is coming from. Welcome to 8.99.14.
Diffstat (limited to 'sys/compat/linux')
-rw-r--r--sys/compat/linux/common/linux_socket.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/sys/compat/linux/common/linux_socket.c b/sys/compat/linux/common/linux_socket.c
index ca39738ffd7..20f2b0918cd 100644
--- a/sys/compat/linux/common/linux_socket.c
+++ b/sys/compat/linux/common/linux_socket.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_socket.c,v 1.139 2017/11/22 10:19:14 ozaki-r Exp $ */
+/* $NetBSD: linux_socket.c,v 1.140 2018/03/16 17:25:04 christos Exp $ */
/*-
* Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.139 2017/11/22 10:19:14 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.140 2018/03/16 17:25:04 christos Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@@ -401,6 +401,7 @@ linux_sys_sendto(struct lwp *l, const struct linux_sys_sendto_args *uap, registe
struct msghdr msg;
struct iovec aiov;
struct sockaddr_big nam;
+ struct mbuf *m;
int bflags;
int error;
@@ -419,9 +420,13 @@ linux_sys_sendto(struct lwp *l, const struct linux_sys_sendto_args *uap, registe
error = linux_get_sa(l, SCARG(uap, s), &nam, SCARG(uap, to),
SCARG(uap, tolen));
if (error)
- return (error);
- msg.msg_name = &nam;
- msg.msg_namelen = SCARG(uap, tolen);
+ return error;
+ error = sockargs(&m, &nam, nam.sb_len, UIO_SYSSPACE, MT_SONAME);
+ if (error)
+ return error;
+ msg.msg_flags |= MSG_NAMEMBUF;
+ msg.msg_name = m;
+ msg.msg_namelen = nam.sb_len;
}
msg.msg_iov = &aiov;