Author: tuexen
Date: Thu Jan 11 20:26:17 2018
New Revision: 327844
URL: https://svnweb.freebsd.org/changeset/base/327844

Log:
  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

Modified:
  head/sys/kern/sys_socket.c

Modified: head/sys/kern/sys_socket.c
==============================================================================
--- head/sys/kern/sys_socket.c  Thu Jan 11 19:41:00 2018        (r327843)
+++ head/sys/kern/sys_socket.c  Thu Jan 11 20:26:17 2018        (r327844)
@@ -355,6 +355,7 @@ soo_fill_kinfo(struct file *fp, struct kinfo_file *kif
 
        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
        }
        strncpy(kif->kf_path, so->so_proto->pr_domain->dom_name,
            sizeof(kif->kf_path));
+       CURVNET_RESTORE();
        return (0);     
 }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to