PERFORCE change 80729 for review

Robert Watson rwatson at FreeBSD.org
Fri Jul 22 02:46:35 GMT 2005


http://perforce.freebsd.org/chv.cgi?CH=80729

Change 80729 by rwatson at rwatson_zoo on 2005/07/22 02:45:09

	In if_addmulti(), use M_NOWAIT and fail rather than sleeping, since
	we may be called with mutexes.  The assumption of failure is already
	handled by the callers, who also use M_NOWAIT.

Affected files ...

.. //depot/projects/netsmp/src/sys/net/if.c#4 edit

Differences ...

==== //depot/projects/netsmp/src/sys/net/if.c#4 (text+ko) ====

@@ -1980,10 +1980,21 @@
 	} else
 		llsa = NULL;
 
-	new_ifma = if_allocmulti(ifp, sa, llsa, M_WAITOK);
-	if (llsa != NULL)
-		new_ll_ifma = if_allocmulti(ifp, llsa, NULL, M_WAITOK);
-	else
+	new_ifma = if_allocmulti(ifp, sa, llsa, M_NOWAIT);
+	if (new_ifma == NULL) {
+		if (llsa != NULL)
+			free(llsa, M_IFMADDR);
+		return (ENOMEM);
+	}
+	if (llsa != NULL) {
+		new_ll_ifma = if_allocmulti(ifp, llsa, NULL, M_NOWAIT);
+		if (new_ll_ifma == NULL) {
+			if_freemulti(new_ifma);
+			if (llsa != NULL)
+				free(llsa, M_IFMADDR);
+			return (ENOMEM);
+		}
+	} else
 		new_ll_ifma = NULL;	/* gcc */
 
 	/*


More information about the p4-projects mailing list