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 <[email protected]>
  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;
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to