From owner-svn-src-all@freebsd.org Tue Nov 22 17:43:00 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B0E92C5025E; Tue, 22 Nov 2016 17:43:00 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 82324849; Tue, 22 Nov 2016 17:43:00 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAMHgxW4059024; Tue, 22 Nov 2016 17:42:59 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAMHgxsp059023; Tue, 22 Nov 2016 17:42:59 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201611221742.uAMHgxsp059023@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 22 Nov 2016 17:42:59 +0000 (UTC) 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 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Nov 2016 17:43:00 -0000 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); }