From owner-freebsd-current Sun Jul 15 10:31:12 2001 Delivered-To: freebsd-current@freebsd.org Received: from peace.mahoroba.org (peace.calm.imasy.or.jp [202.227.26.34]) by hub.freebsd.org (Postfix) with ESMTP id 3DEC437B401; Sun, 15 Jul 2001 10:31:04 -0700 (PDT) (envelope-from ume@mahoroba.org) Received: from localhost (IDENT:KDGClK7a+52EuQvJR80VQaf99FNJoc1zyOjYd+cAUNj1xi/oQcCHgLI5f1K70omw@localhost [::1]) (authenticated as ume with CRAM-MD5) by peace.mahoroba.org (8.11.4/8.11.4/peace) with ESMTP/inet6 id f6FHUkJ60741; Mon, 16 Jul 2001 02:30:46 +0900 (JST) (envelope-from ume@mahoroba.org) Date: Mon, 16 Jul 2001 02:30:43 +0900 (JST) Message-Id: <20010716.023043.130171162.ume@mahoroba.org> To: julian@elischer.org Cc: net@FreeBSD.org, current@FreeBSD.org Subject: Re: Use of M_WAITOK in if_addmulti(). From: Hajimu UMEMOTO In-Reply-To: <20010716.022439.74683611.ume@mahoroba.org> References: <20010716.001314.59549708.ume@mahoroba.org> <3B51C28F.7A56D8D8@elischer.org> <20010716.022439.74683611.ume@mahoroba.org> X-Mailer: xcite1.38> Mew version 1.95b119 on Emacs 20.7 / Mule 4.0 =?iso-2022-jp?B?KBskQjJWMWMbKEIp?= X-PGP-Public-Key: http://www.imasy.org/~ume/publickey.asc X-PGP-Fingerprint: 6B 0C 53 FC 5D D0 37 91 05 D0 B3 EF 36 9B 6A BC X-URL: http://www.imasy.org/~ume/ X-Operating-System: FreeBSD 5.0-CURRENT Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG ume> Index: sys/net/if.c ume> diff -u sys/net/if.c.orig sys/net/if.c ume> --- sys/net/if.c.orig Mon Jul 16 01:39:34 2001 ume> +++ sys/net/if.c Mon Jul 16 01:51:49 2001 Oops, it was wrong version. Index: sys/net/if.c diff -u sys/net/if.c.orig sys/net/if.c --- sys/net/if.c.orig Mon Jul 16 01:39:34 2001 +++ sys/net/if.c Mon Jul 16 01:51:49 2001 @@ -1412,8 +1412,14 @@ llsa = 0; } - MALLOC(ifma, struct ifmultiaddr *, sizeof *ifma, M_IFMADDR, M_WAITOK); - MALLOC(dupsa, struct sockaddr *, sa->sa_len, M_IFMADDR, M_WAITOK); + MALLOC(ifma, struct ifmultiaddr *, sizeof *ifma, M_IFMADDR, M_NOWAIT); + if (ifma == NULL) + return (ENOBUFS); + MALLOC(dupsa, struct sockaddr *, sa->sa_len, M_IFMADDR, M_NOWAIT); + if (dupsa == NULL) { + FREE(ifma, M_IFMADDR); + return (ENOBUFS); + } bcopy(sa, dupsa, sa->sa_len); ifma->ifma_addr = dupsa; @@ -1441,9 +1447,15 @@ ifma->ifma_refcount++; } else { MALLOC(ifma, struct ifmultiaddr *, sizeof *ifma, - M_IFMADDR, M_WAITOK); + M_IFMADDR, M_NOWAIT); + if (ifma == NULL) + return (ENOBUFS); MALLOC(dupsa, struct sockaddr *, llsa->sa_len, - M_IFMADDR, M_WAITOK); + M_IFMADDR, M_NOWAIT); + if (dupsa == NULL) { + FREE(ifma, M_IFMADDR); + return (ENOBUFS); + } bcopy(llsa, dupsa, llsa->sa_len); ifma->ifma_addr = dupsa; ifma->ifma_ifp = ifp; -- Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan ume@mahoroba.org ume@bisd.hitachi.co.jp ume@{,jp.}FreeBSD.org http://www.imasy.org/~ume/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message