svn commit: r291040 - head/sys/netinet
Conrad E. Meyer
cem at FreeBSD.org
Wed Nov 18 23:53:14 UTC 2015
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 at 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;
More information about the svn-src-all
mailing list