From owner-cvs-all Sun Dec 15 7:37:50 2002 Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A773D37B401; Sun, 15 Dec 2002 07:37:42 -0800 (PST) Received: from angelica.unixdaemons.com (angelica.unixdaemons.com [209.148.64.135]) by mx1.FreeBSD.org (Postfix) with ESMTP id C778D43EA9; Sun, 15 Dec 2002 07:37:41 -0800 (PST) (envelope-from hiten@angelica.unixdaemons.com) Received: from angelica.unixdaemons.com (hiten@localhost.unixdaemons.com [127.0.0.1]) by angelica.unixdaemons.com (8.12.6/8.12.1) with ESMTP id gBFFbLek030467; Sun, 15 Dec 2002 10:37:21 -0500 (EST) Received: (from hiten@localhost) by angelica.unixdaemons.com (8.12.6/8.12.1/Submit) id gBFFbLkb030466; Sun, 15 Dec 2002 10:37:21 -0500 (EST) (envelope-from hiten) Date: Sun, 15 Dec 2002 10:37:21 -0500 From: Hiten Pandya To: Robert Watson Cc: Maxim Konovalov , cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG Subject: Re: cvs commit: src/sys/netinet ip_dummynet.c Message-ID: <20021215153721.GA26021@angelica.unixdaemons.com> References: <200212151021.gBFALV1Y040756@repoman.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4i X-Operating-System: FreeBSD i386 X-Public-Key: http://www.pittgoth.com/~hiten/pubkey.asc X-URL: http://www.unixdaemons.com/~hiten X-PGP: http://pgp.mit.edu:11371/pks/lookup?search=Hiten+Pandya&op=index Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sun, Dec 15, 2002 at 10:04:42AM -0500, Robert Watson wrote the words in effect of: > I've noticed this in some other places in the code, and was confused about > it myself for a bit. Part of the problem is that the flags appear to come > from the same namespace. It should be easy enough to catch this though by > temporarily diverging the values of the flags and making sure there are > asserts in the appropriate calls that consume the flags. Alternatively, > would could combine the flags... :-) > > Robert N M Watson FreeBSD Core Team, TrustedBSD Projects > robert@fledge.watson.org Network Associates Laboratories > > On Sun, 15 Dec 2002, Maxim Konovalov wrote: > > > maxim 2002/12/15 02:21:31 PST > > > > Modified files: > > sys/netinet ip_dummynet.c > > Log: > > o M_DONTWAIT is mbuf(9) flag: malloc(M_DONTWAIT) -> malloc(M_NOWAIT). > > The bug does not affect anything because M_NOWAIT == M_DONTWAIT. > > > > Reviewed by: luigi > > MFC after: 1 week > > > > Revision Changes Path > > 1.57 +7 -7 src/sys/netinet/ip_dummynet.c > > Untested, but hopefully harmless patches: (more to come later on) Also, it is not only M_DONTWAIT which is affected, people are using M_WAITOK, where M_TRYWAIT should be used. A patch for the mbuf(9) manual page will follow. NOTE: patch for ip_fw.c has been purposely nuked from here, because it is a no-op in -current, according to Maxim K. Index: net/bridge.c =================================================================== RCS file: /home/hiten/ncvs/src/sys/net/bridge.c,v retrieving revision 1.59 diff -u -r1.59 bridge.c --- net/bridge.c 14 Nov 2002 23:57:09 -0000 1.59 +++ net/bridge.c 15 Dec 2002 04:40:40 -0000 @@ -239,7 +239,7 @@ goto found; /* Not found, need to reallocate */ - c = malloc((1+n_clusters) * sizeof (*c), M_IFADDR, M_DONTWAIT | M_ZERO); + c = malloc((1+n_clusters) * sizeof (*c), M_IFADDR, M_NOWAIT | M_ZERO); if (c == NULL) {/* malloc failure */ printf("-- bridge: cannot add new cluster\n"); return NULL; Index: net/radix.h =================================================================== RCS file: /home/hiten/ncvs/src/sys/net/radix.h,v retrieving revision 1.18 diff -u -r1.18 radix.h --- net/radix.h 19 Mar 2002 21:54:18 -0000 1.18 +++ net/radix.h 15 Dec 2002 04:43:56 -0000 @@ -150,7 +150,7 @@ #define Bcmp(a, b, n) bcmp(((caddr_t)(a)), ((caddr_t)(b)), (unsigned)(n)) #define Bcopy(a, b, n) bcopy(((caddr_t)(a)), ((caddr_t)(b)), (unsigned)(n)) #define Bzero(p, n) bzero((caddr_t)(p), (unsigned)(n)); -#define R_Malloc(p, t, n) (p = (t) malloc((unsigned long)(n), M_RTABLE, M_DONTWAIT)) +#define R_Malloc(p, t, n) (p = (t) malloc((unsigned long)(n), M_RTABLE, M_NOWAIT)) #define Free(p) free((caddr_t)p, M_RTABLE); #endif /* _KERNEL */ Index: net/raw_cb.c =================================================================== RCS file: /home/hiten/ncvs/src/sys/net/raw_cb.c,v retrieving revision 1.22 diff -u -r1.22 raw_cb.c --- net/raw_cb.c 20 Nov 2002 19:00:53 -0000 1.22 +++ net/raw_cb.c 15 Dec 2002 05:05:52 -0000 @@ -139,7 +139,7 @@ if (ifnet == 0) return (EADDRNOTAVAIL); rp = sotorawcb(so); - nam = m_copym(nam, 0, M_COPYALL, M_WAITOK); + nam = m_copym(nam, 0, M_COPYALL, M_TRYWAIT); rp->rcb_laddr = mtod(nam, struct sockaddr *); return (0); } Index: netgraph/ng_bridge.c =================================================================== RCS file: /home/hiten/ncvs/src/sys/netgraph/ng_bridge.c,v retrieving revision 1.15 diff -u -r1.15 ng_bridge.c --- netgraph/ng_bridge.c 8 Nov 2002 21:13:18 -0000 1.15 +++ netgraph/ng_bridge.c 15 Dec 2002 05:18:01 -0000 @@ -713,7 +713,7 @@ * It's usable link but not the reserved (first) one. * Copy mbuf and meta info for sending. */ - m2 = m_dup(m, M_NOWAIT); /* XXX m_copypacket() */ + m2 = m_dup(m, M_DONTWAIT); /* XXX m_copypacket() */ if (m2 == NULL) { link->stats.memoryFailures++; NG_FREE_ITEM(item); Index: netgraph/ng_one2many.c =================================================================== RCS file: /home/hiten/ncvs/src/sys/netgraph/ng_one2many.c,v retrieving revision 1.10 diff -u -r1.10 ng_one2many.c --- netgraph/ng_one2many.c 8 Nov 2002 21:13:18 -0000 1.10 +++ netgraph/ng_one2many.c 15 Dec 2002 05:18:55 -0000 @@ -427,7 +427,7 @@ struct ng_one2many_link *mdst; mdst = &priv->many[priv->activeMany[i]]; - m2 = m_dup(m, M_NOWAIT); /* XXX m_copypacket() */ + m2 = m_dup(m, M_DONTWAIT); /* XXX m_copypacket() */ if (m2 == NULL) { mdst->stats.memoryFailures++; NG_FREE_ITEM(item); Index: netgraph/ng_ppp.c =================================================================== RCS file: /home/hiten/ncvs/src/sys/netgraph/ng_ppp.c,v retrieving revision 1.41 diff -u -r1.41 ng_ppp.c --- netgraph/ng_ppp.c 8 Nov 2002 21:13:18 -0000 1.41 +++ netgraph/ng_ppp.c 15 Dec 2002 05:19:22 -0000 @@ -1595,7 +1595,7 @@ /* Split off next fragment as "m2" */ m2 = m; if (!lastFragment) { - struct mbuf *n = m_split(m, len, M_NOWAIT); + struct mbuf *n = m_split(m, len, M_DONTWAIT); if (n == NULL) { NG_FREE_M(m); Index: netgraph/ng_source.c =================================================================== RCS file: /home/hiten/ncvs/src/sys/netgraph/ng_source.c,v retrieving revision 1.4 diff -u -r1.4 ng_source.c --- netgraph/ng_source.c 5 Nov 2002 01:08:11 -0000 1.4 +++ netgraph/ng_source.c 15 Dec 2002 05:19:39 -0000 @@ -638,7 +638,7 @@ break; /* duplicate the packet */ - m2 = m_copypacket(m, M_NOWAIT); + m2 = m_copypacket(m, M_DONTWAIT); if (m2 == NULL) { s = splnet(); IF_PREPEND(&sc->snd_queue, m); Index: netgraph/ng_tee.c =================================================================== RCS file: /home/hiten/ncvs/src/sys/netgraph/ng_tee.c,v retrieving revision 1.20 diff -u -r1.20 ng_tee.c --- netgraph/ng_tee.c 31 May 2002 23:48:03 -0000 1.20 +++ netgraph/ng_tee.c 15 Dec 2002 05:20:05 -0000 @@ -334,7 +334,7 @@ meta_p meta2; /* Copy packet (failure will not stop the original)*/ - m2 = m_dup(m, M_NOWAIT); + m2 = m_dup(m, M_DONTWAIT); if (m2) { /* Copy meta info */ Index: netgraph/bluetooth/socket/ng_btsocket_hci_raw.c =================================================================== RCS file: /home/hiten/ncvs/src/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c,v retrieving revision 1.1 diff -u -r1.1 ng_btsocket_hci_raw.c --- netgraph/bluetooth/socket/ng_btsocket_hci_raw.c 20 Nov 2002 23:01:57 -0000 1.1 +++ netgraph/bluetooth/socket/ng_btsocket_hci_raw.c 15 Dec 2002 05:39:04 -0000 @@ -1271,7 +1271,7 @@ sa = (struct sockaddr *) &pcb->addr; } - MGET(nam, M_WAITOK, MT_SONAME); + MGET(nam, M_TRYWAIT, MT_SONAME); if (nam == NULL) { error = ENOBUFS; goto drop; Index: netgraph/bluetooth/socket/ng_btsocket_l2cap.c =================================================================== RCS file: /home/hiten/ncvs/src/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c,v retrieving revision 1.1 diff -u -r1.1 ng_btsocket_l2cap.c --- netgraph/bluetooth/socket/ng_btsocket_l2cap.c 20 Nov 2002 23:01:57 -0000 1.1 +++ netgraph/bluetooth/socket/ng_btsocket_l2cap.c 15 Dec 2002 05:17:27 -0000 @@ -1464,7 +1464,7 @@ * it is a broadcast traffic after all */ - copy = m_dup(m, M_NOWAIT); + copy = m_dup(m, M_DONTWAIT); if (copy != NULL) { sbappendrecord(&pcb->so->so_rcv, copy); sorwakeup(pcb->so); @@ -2384,7 +2384,7 @@ if (pcb->so->so_snd.sb_cc == 0) return (EINVAL); /* XXX */ - m = m_dup(pcb->so->so_snd.sb_mb, M_NOWAIT); + m = m_dup(pcb->so->so_snd.sb_mb, M_DONTWAIT); if (m == NULL) return (ENOBUFS); Index: netinet/ip_encap.c =================================================================== RCS file: /home/hiten/ncvs/src/sys/netinet/ip_encap.c,v retrieving revision 1.13 diff -u -r1.13 ip_encap.c --- netinet/ip_encap.c 16 Oct 2002 01:54:44 -0000 1.13 +++ netinet/ip_encap.c 15 Dec 2002 05:20:42 -0000 @@ -487,7 +487,7 @@ { struct m_tag *tag; - tag = m_tag_get(PACKET_TAG_ENCAP, sizeof (void*), M_NOWAIT); + tag = m_tag_get(PACKET_TAG_ENCAP, sizeof (void*), M_DONTWAIT); if (tag) { *(void**)(tag+1) = ep->arg; m_tag_prepend(m, tag); Index: netinet6/esp_core.c =================================================================== RCS file: /home/hiten/ncvs/src/sys/netinet6/esp_core.c,v retrieving revision 1.10 diff -u -r1.10 esp_core.c --- netinet6/esp_core.c 5 Mar 2002 21:12:41 -0000 1.10 +++ netinet6/esp_core.c 15 Dec 2002 04:47:32 -0000 @@ -219,7 +219,7 @@ sav->schedlen = (*algo->schedlen)(algo); if (sav->schedlen < 0) return EINVAL; - sav->sched = malloc(sav->schedlen, M_SECA, M_DONTWAIT); + sav->sched = malloc(sav->schedlen, M_SECA, M_NOWAIT); if (!sav->sched) { sav->schedlen = 0; return ENOBUFS; Index: netinet6/ip6_fw.c =================================================================== RCS file: /home/hiten/ncvs/src/sys/netinet6/ip6_fw.c,v retrieving revision 1.19 diff -u -r1.19 ip6_fw.c --- netinet6/ip6_fw.c 25 Aug 2002 03:50:29 -0000 1.19 +++ netinet6/ip6_fw.c 15 Dec 2002 04:48:02 -0000 @@ -845,8 +845,8 @@ u_short nbr = 0; int s; - fwc = malloc(sizeof *fwc, M_IP6FW, M_DONTWAIT); - ftmp = malloc(sizeof *ftmp, M_IP6FW, M_DONTWAIT); + fwc = malloc(sizeof *fwc, M_IP6FW, M_NOWAIT); + ftmp = malloc(sizeof *ftmp, M_IP6FW, M_NOWAIT); if (!fwc || !ftmp) { dprintf(("%s malloc said no\n", err_prefix)); if (fwc) free(fwc, M_IP6FW); Index: netinet6/ipcomp_output.c =================================================================== RCS file: /home/hiten/ncvs/src/sys/netinet6/ipcomp_output.c,v retrieving revision 1.3 diff -u -r1.3 ipcomp_output.c --- netinet6/ipcomp_output.c 19 Apr 2002 04:46:23 -0000 1.3 +++ netinet6/ipcomp_output.c 15 Dec 2002 05:21:14 -0000 @@ -171,12 +171,12 @@ * compromise two m_copym(). we will be going through every byte of * the payload during compression process anyways. */ - mcopy = m_copym(m, 0, M_COPYALL, M_NOWAIT); + mcopy = m_copym(m, 0, M_COPYALL, M_DONTWAIT); if (mcopy == NULL) { error = ENOBUFS; return 0; } - md0 = m_copym(md, 0, M_COPYALL, M_NOWAIT); + md0 = m_copym(md, 0, M_COPYALL, M_DONTWAIT); if (md0 == NULL) { m_freem(mcopy); error = ENOBUFS; Index: netipsec/xform_ah.c =================================================================== RCS file: /home/hiten/ncvs/src/sys/netipsec/xform_ah.c,v retrieving revision 1.1 diff -u -r1.1 xform_ah.c --- netipsec/xform_ah.c 16 Oct 2002 02:10:07 -0000 1.1 +++ netipsec/xform_ah.c 15 Dec 2002 05:22:31 -0000 @@ -431,7 +431,7 @@ if (m->m_len <= skip) { ptr = (unsigned char *) malloc( skip - sizeof(struct ip6_hdr), - M_XDATA, M_NOWAIT); + M_XDATA, M_DONTWAIT); if (ptr == NULL) { DPRINTF(("ah_massage_headers: failed " "to allocate memory for IPv6 " Index: netsmb/smb_trantcp.c =================================================================== RCS file: /home/hiten/ncvs/src/sys/netsmb/smb_trantcp.c,v retrieving revision 1.14 diff -u -r1.14 smb_trantcp.c --- netsmb/smb_trantcp.c 26 Nov 2002 23:53:28 -0000 1.14 +++ netsmb/smb_trantcp.c 15 Dec 2002 05:38:26 -0000 @@ -648,7 +648,7 @@ error = ENOTCONN; goto abort; } - M_PREPEND(m0, 4, M_WAITOK); + M_PREPEND(m0, 4, M_TRYWAIT); if (m0 == NULL) return ENOBUFS; nb_sethdr(m0, NB_SSN_MESSAGE, m_fixhdr(m0) - 4); Cheers. -- Hiten Pandya (hiten@unixdaemons.com, hiten@uk.FreeBSD.org) http://www.unixdaemons.com/~hiten/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message