diff options
author | Michael Tuexen <tuexen@FreeBSD.org> | 2018-01-11 20:26:17 +0000 |
---|---|---|
committer | Michael Tuexen <tuexen@FreeBSD.org> | 2018-01-11 20:26:17 +0000 |
commit | ce076a1f58946e5f1c882e80cdd3091d01510329 (patch) | |
tree | 8004f4d19bd13c61ae8cd64d876d1dc4bdbc4c08 /sys/kern | |
parent | 1b65356b437a8752a56647fdea417b8db20e6e20 (diff) | |
download | src-ce076a1f58946e5f1c882e80cdd3091d01510329.tar.gz src-ce076a1f58946e5f1c882e80cdd3091d01510329.zip |
Ensure that the vnet is set when calling pru_sockaddr() and
pru_peeraddr().
This is already true when called via kern_getsockname() and
kern_getpeername(). This patch sets it also, when they arecalled
via soo_fill_kinfo(). This is necessary, since the corresponding
functions for SCTP require the vnet to be set. Without this,
if a process having an wildcard bound SCTP socket is
terminated and a core is written, the kernel panics.
Reviewed by: bz
Differential Revision: https://reviews.freebsd.org/D13652
Notes
Notes:
svn path=/head/; revision=327844
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/sys_socket.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/kern/sys_socket.c b/sys/kern/sys_socket.c index 0824fbe299de..b0f6f99ce448 100644 --- a/sys/kern/sys_socket.c +++ b/sys/kern/sys_socket.c @@ -355,6 +355,7 @@ soo_fill_kinfo(struct file *fp, struct kinfo_file *kif, struct filedesc *fdp) kif->kf_type = KF_TYPE_SOCKET; so = fp->f_data; + CURVNET_SET(so->so_vnet); kif->kf_un.kf_sock.kf_sock_domain0 = so->so_proto->pr_domain->dom_family; kif->kf_un.kf_sock.kf_sock_type0 = so->so_type; @@ -407,6 +408,7 @@ soo_fill_kinfo(struct file *fp, struct kinfo_file *kif, struct filedesc *fdp) } strncpy(kif->kf_path, so->so_proto->pr_domain->dom_name, sizeof(kif->kf_path)); + CURVNET_RESTORE(); return (0); } |