Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Nov 2015 23:53:13 +0000 (UTC)
From:      "Conrad E. Meyer" <cem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r291040 - head/sys/netinet
Message-ID:  <201511182353.tAINrDD2013511@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 <rlibby@gmail.com>
  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;



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