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
This commit is contained in:
Michael Tuexen 2018-01-11 20:26:17 +00:00
parent 1b65356b43
commit ce076a1f58
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=327844

View File

@ -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);
}