From owner-svn-src-head@freebsd.org Wed Nov 18 23:53:14 2015 Return-Path: Delivered-To: svn-src-head@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 98A8DA32045; Wed, 18 Nov 2015 23:53:14 +0000 (UTC) (envelope-from cem@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 6046C1B0E; Wed, 18 Nov 2015 23:53:14 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tAINrDZA013512; Wed, 18 Nov 2015 23:53:13 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tAINrDD2013511; Wed, 18 Nov 2015 23:53:13 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201511182353.tAINrDD2013511@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Wed, 18 Nov 2015 23:53:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r291040 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Nov 2015 23:53:14 -0000 Author: cem Date: Wed Nov 18 23:53:13 2015 New Revision: 291040 URL: https://svnweb.freebsd.org/changeset/base/291040 Log: in_getmulti: Fix recursion on if_addr_lock on malloc failure When the M_NOWAIT allocation fails, we recurse the if_addr_lock trying to clean up. Reorder the cleanup after dropping the if_addr_lock. The obvious race is already possible between if_addmulti and IF_ADDR_WLOCK above, so it must be ok. Submitted by: Ryan Libby Reviewed by: jhb Found with: M_NOWAIT failure injection testing Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D4138 Modified: head/sys/netinet/in_mcast.c Modified: head/sys/netinet/in_mcast.c ============================================================================== --- head/sys/netinet/in_mcast.c Wed Nov 18 23:45:09 2015 (r291039) +++ head/sys/netinet/in_mcast.c Wed Nov 18 23:53:13 2015 (r291040) @@ -515,8 +515,8 @@ in_getmulti(struct ifnet *ifp, const str */ inm = malloc(sizeof(*inm), M_IPMADDR, M_NOWAIT | M_ZERO); if (inm == NULL) { - if_delmulti_ifma(ifma); IF_ADDR_WUNLOCK(ifp); + if_delmulti_ifma(ifma); return (ENOMEM); } inm->inm_addr = *group;