Date: Sun, 15 Jul 2001 09:19:27 -0700 From: Julian Elischer <julian@elischer.org> To: Hajimu UMEMOTO <ume@mahoroba.org> Cc: net@FreeBSD.org, current@FreeBSD.org Subject: Re: Use of M_WAITOK in if_addmulti(). Message-ID: <3B51C28F.7A56D8D8@elischer.org> References: <20010715120317.A99869@fump.kawo2.rwth-aachen.de> <20010716.001314.59549708.ume@mahoroba.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Hajimu UMEMOTO wrote: NOWAIT MAY return. you have not handled the case for when it returns with a NULL allocation so if it returns NULL you continue, and page-fault immediatly. > > Hi, > > Current if_addmulti() calls MALLOC() with M_WAITOK. However, > if_addmulti() can be called from in[6]_addmulti() with splnet(). It > may lead kernel panic. So, I wish to change to use M_NOWAIT. > Any comment? > > Index: sys/net/if.c > diff -u sys/net/if.c.orig sys/net/if.c > --- sys/net/if.c.orig Wed Jul 4 20:28:47 2001 > +++ sys/net/if.c Sun Jul 15 23:47:15 2001 > @@ -1412,8 +1412,8 @@ > 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); > + MALLOC(dupsa, struct sockaddr *, sa->sa_len, M_IFMADDR, M_NOWAIT); > bcopy(sa, dupsa, sa->sa_len); > > ifma->ifma_addr = dupsa; > @@ -1441,9 +1441,9 @@ > ifma->ifma_refcount++; > } else { > MALLOC(ifma, struct ifmultiaddr *, sizeof *ifma, > - M_IFMADDR, M_WAITOK); > + M_IFMADDR, M_NOWAIT); > MALLOC(dupsa, struct sockaddr *, llsa->sa_len, > - M_IFMADDR, M_WAITOK); > + M_IFMADDR, M_NOWAIT); > 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 WAIT____ -- +------------------------------------+ ______ _ __ | __--_|\ Julian Elischer | \ U \/ / hard at work in | / \ julian@elischer.org +------>x USA \ a very strange | ( OZ ) \___ ___ | country ! +- X_.---._/ presently in San Francisco \_/ \\ v To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3B51C28F.7A56D8D8>