Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Jul 2005 02:46:08 GMT
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 80729 for review
Message-ID:  <200507220246.j6M2k8eB045876@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=80729

Change 80729 by rwatson@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 */
 
 	/*



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