Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 25 Nov 2018 18:00:50 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r340923 - in stable/11/sys: kern netinet netinet6 ofed/drivers/infiniband/ulp/sdp
Message-ID:  <201811251800.wAPI0ojq084011@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Sun Nov 25 18:00:50 2018
New Revision: 340923
URL: https://svnweb.freebsd.org/changeset/base/340923

Log:
  MFC r340783:
  Plug some networking sysctl leaks.

Modified:
  stable/11/sys/kern/uipc_socket.c
  stable/11/sys/kern/uipc_usrreq.c
  stable/11/sys/netinet/ip_divert.c
  stable/11/sys/netinet/raw_ip.c
  stable/11/sys/netinet/sctp_sysctl.c
  stable/11/sys/netinet/tcp_subr.c
  stable/11/sys/netinet/udp_usrreq.c
  stable/11/sys/netinet6/ip6_mroute.c
  stable/11/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/uipc_socket.c
==============================================================================
--- stable/11/sys/kern/uipc_socket.c	Sun Nov 25 17:56:49 2018	(r340922)
+++ stable/11/sys/kern/uipc_socket.c	Sun Nov 25 18:00:50 2018	(r340923)
@@ -3597,6 +3597,7 @@ void
 sotoxsocket(struct socket *so, struct xsocket *xso)
 {
 
+	bzero(xso, sizeof(*xso));
 	xso->xso_len = sizeof *xso;
 	xso->xso_so = so;
 	xso->so_type = so->so_type;

Modified: stable/11/sys/kern/uipc_usrreq.c
==============================================================================
--- stable/11/sys/kern/uipc_usrreq.c	Sun Nov 25 17:56:49 2018	(r340922)
+++ stable/11/sys/kern/uipc_usrreq.c	Sun Nov 25 18:00:50 2018	(r340923)
@@ -1606,7 +1606,7 @@ unp_pcblist(SYSCTL_HANDLER_ARGS)
 	/*
 	 * OK, now we're committed to doing something.
 	 */
-	xug = malloc(sizeof(*xug), M_TEMP, M_WAITOK);
+	xug = malloc(sizeof(*xug), M_TEMP, M_WAITOK | M_ZERO);
 	UNP_LIST_LOCK();
 	gencnt = unp_gencnt;
 	n = unp_count;

Modified: stable/11/sys/netinet/ip_divert.c
==============================================================================
--- stable/11/sys/netinet/ip_divert.c	Sun Nov 25 17:56:49 2018	(r340922)
+++ stable/11/sys/netinet/ip_divert.c	Sun Nov 25 18:00:50 2018	(r340923)
@@ -667,6 +667,7 @@ div_pcblist(SYSCTL_HANDLER_ARGS)
 	if (error != 0)
 		return (error);
 
+	bzero(&xig, sizeof(xig));
 	xig.xig_len = sizeof xig;
 	xig.xig_count = n;
 	xig.xig_gen = gencnt;

Modified: stable/11/sys/netinet/raw_ip.c
==============================================================================
--- stable/11/sys/netinet/raw_ip.c	Sun Nov 25 17:56:49 2018	(r340922)
+++ stable/11/sys/netinet/raw_ip.c	Sun Nov 25 18:00:50 2018	(r340923)
@@ -1044,6 +1044,7 @@ rip_pcblist(SYSCTL_HANDLER_ARGS)
 	n = V_ripcbinfo.ipi_count;
 	INP_INFO_RUNLOCK(&V_ripcbinfo);
 
+	bzero(&xig, sizeof(xig));
 	xig.xig_len = sizeof xig;
 	xig.xig_count = n;
 	xig.xig_gen = gencnt;

Modified: stable/11/sys/netinet/sctp_sysctl.c
==============================================================================
--- stable/11/sys/netinet/sctp_sysctl.c	Sun Nov 25 17:56:49 2018	(r340922)
+++ stable/11/sys/netinet/sctp_sysctl.c	Sun Nov 25 18:00:50 2018	(r340923)
@@ -393,6 +393,9 @@ sctp_sysctl_handle_assoclist(SYSCTL_HANDLER_ARGS)
 		SCTP_LTRACE_ERR_RET(NULL, NULL, NULL, SCTP_FROM_SCTP_SYSCTL, EPERM);
 		return (EPERM);
 	}
+	memset(&xinpcb, 0, sizeof(xinpcb));
+	memset(&xstcb, 0, sizeof(xstcb));
+	memset(&xraddr, 0, sizeof(xraddr));
 	LIST_FOREACH(inp, &SCTP_BASE_INFO(listhead), sctp_list) {
 		SCTP_INP_RLOCK(inp);
 		if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) {

Modified: stable/11/sys/netinet/tcp_subr.c
==============================================================================
--- stable/11/sys/netinet/tcp_subr.c	Sun Nov 25 17:56:49 2018	(r340922)
+++ stable/11/sys/netinet/tcp_subr.c	Sun Nov 25 18:00:50 2018	(r340923)
@@ -1710,6 +1710,7 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS)
 	if (error != 0)
 		return (error);
 
+	bzero(&xig, sizeof(xig));
 	xig.xig_len = sizeof xig;
 	xig.xig_count = n + m;
 	xig.xig_gen = gencnt;

Modified: stable/11/sys/netinet/udp_usrreq.c
==============================================================================
--- stable/11/sys/netinet/udp_usrreq.c	Sun Nov 25 17:56:49 2018	(r340922)
+++ stable/11/sys/netinet/udp_usrreq.c	Sun Nov 25 18:00:50 2018	(r340923)
@@ -849,6 +849,7 @@ udp_pcblist(SYSCTL_HANDLER_ARGS)
 	if (error != 0)
 		return (error);
 
+	bzero(&xig, sizeof(xig));
 	xig.xig_len = sizeof xig;
 	xig.xig_count = n;
 	xig.xig_gen = gencnt;

Modified: stable/11/sys/netinet6/ip6_mroute.c
==============================================================================
--- stable/11/sys/netinet6/ip6_mroute.c	Sun Nov 25 17:56:49 2018	(r340922)
+++ stable/11/sys/netinet6/ip6_mroute.c	Sun Nov 25 18:00:50 2018	(r340923)
@@ -202,7 +202,8 @@ sysctl_mif6table(SYSCTL_HANDLER_ARGS)
 	struct mif6_sctl *out;
 	int error;
 
-	out = malloc(sizeof(struct mif6_sctl) * MAXMIFS, M_TEMP, M_WAITOK);
+	out = malloc(sizeof(struct mif6_sctl) * MAXMIFS, M_TEMP,
+	    M_WAITOK | M_ZERO);
 	for (int i = 0; i < MAXMIFS; i++) {
 		out[i].m6_flags		= mif6table[i].m6_flags;
 		out[i].m6_rate_limit	= mif6table[i].m6_rate_limit;

Modified: stable/11/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c
==============================================================================
--- stable/11/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c	Sun Nov 25 17:56:49 2018	(r340922)
+++ stable/11/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c	Sun Nov 25 18:00:50 2018	(r340923)
@@ -1810,6 +1810,7 @@ sdp_pcblist(SYSCTL_HANDLER_ARGS)
 	if (error != 0)
 		return (error);
 
+	bzero(&xig, sizeof(xig));
 	xig.xig_len = sizeof xig;
 	xig.xig_count = n;
 	xig.xig_gen = 0;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201811251800.wAPI0ojq084011>