Author: tuexen
Date: Sat Apr  7 20:34:03 2018
New Revision: 332230
URL: https://svnweb.freebsd.org/changeset/base/332230

Log:
  MFC r327844:
  
  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.

Modified:
  stable/11/sys/kern/sys_socket.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/sys_socket.c
==============================================================================
--- stable/11/sys/kern/sys_socket.c     Sat Apr  7 20:27:11 2018        
(r332229)
+++ stable/11/sys/kern/sys_socket.c     Sat Apr  7 20:34:03 2018        
(r332230)
@@ -346,6 +346,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_sock_domain = so->so_proto->pr_domain->dom_family;
        kif->kf_sock_type = so->so_type;
        kif->kf_sock_protocol = so->so_proto->pr_protocol;
@@ -387,6 +388,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