Date: Tue, 22 Nov 2016 17:42:59 +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: r309015 - stable/11/sys/net Message-ID: <201611221742.uAMHgxsp059023@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: markj Date: Tue Nov 22 17:42:59 2016 New Revision: 309015 URL: https://svnweb.freebsd.org/changeset/base/309015 Log: MFC r308694: Plug a lock leak in sysctl_ifmalist(). PR: 214542 Modified: stable/11/sys/net/rtsock.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/rtsock.c ============================================================================== --- stable/11/sys/net/rtsock.c Tue Nov 22 17:36:16 2016 (r309014) +++ stable/11/sys/net/rtsock.c Tue Nov 22 17:42:59 2016 (r309015) @@ -1768,13 +1768,15 @@ done: static int sysctl_ifmalist(int af, struct walkarg *w) { - struct ifnet *ifp; - struct ifmultiaddr *ifma; - struct rt_addrinfo info; - int len, error = 0; + struct rt_addrinfo info; struct ifaddr *ifa; + struct ifmultiaddr *ifma; + struct ifnet *ifp; + int error, len; + error = 0; bzero((caddr_t)&info, sizeof(info)); + IFNET_RLOCK_NOSLEEP(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { if (w->w_arg && w->w_arg != ifp->if_index) @@ -1794,7 +1796,7 @@ sysctl_ifmalist(int af, struct walkarg * ifma->ifma_lladdr : NULL; error = rtsock_msg_buffer(RTM_NEWMADDR, &info, w, &len); if (error != 0) - goto done; + break; if (w->w_req && w->w_tmem) { struct ifma_msghdr *ifmam; @@ -1803,15 +1805,14 @@ sysctl_ifmalist(int af, struct walkarg * ifmam->ifmam_flags = 0; ifmam->ifmam_addrs = info.rti_addrs; error = SYSCTL_OUT(w->w_req, w->w_tmem, len); - if (error) { - IF_ADDR_RUNLOCK(ifp); - goto done; - } + if (error != 0) + break; } } IF_ADDR_RUNLOCK(ifp); + if (error != 0) + break; } -done: IFNET_RUNLOCK_NOSLEEP(); return (error); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201611221742.uAMHgxsp059023>