Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 01 Dec 2000 15:26:19 -0800
From:      David Greenman <dg@root.com>
To:        Andrew Gallatin <gallatin@cs.duke.edu>
Cc:        Bosko Milekic <bmilekic@technokratis.com>, "Kenneth D. Merry" <ken@kdm.org>, arch@FreeBSD.ORG, alfred@FreeBSD.ORG
Subject:   Re: zero copy code review 
Message-ID:  <200012012326.PAA14154@implode.root.com>
In-Reply-To: Your message of "Fri, 01 Dec 2000 17:51:14 EST." <14888.9802.415926.434956@grasshopper.cs.duke.edu> 

next in thread | previous in thread | raw e-mail | index | archive | help
> > 	In your code, you do deal with the possibility of the MGETHDR
> >   returning NULL (you check for it) and you set ENOBUFS in that case and
> >   jump to the "errorpath" label. But, before using MGETHDR, you allocate an
> >   sf_buf (in sf) and it just so happens that the code beyond "errorpath"
> >   does not take care of freeing the sf_buf you allocated before even
> >   trying to allocate the mbuf.
>
>I see your point.  This was copied, (bug for bug ;-), from sendfile itself.
>Look at line 1700 or so of kern/uipc_syscalls.c..  This bug should
>probaby be fixed there too..

   Oops. The original assumption (and code that I wrote) was that M_WAIT
_cannot_ return a NULL pointer. This was changed in FreeBSD recently, and
as you mentioned, the code added in rev 1.65 that now checks for it in
sendfile doesn't do complete cleanup in this case. It definately should
be fixed so that the sf_buf is freed as well.

-DG

David Greenman
Co-founder, The FreeBSD Project - http://www.freebsd.org
President, TeraSolutions, Inc. - http://www.terasolutions.com
Pave the road of life with opportunities.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




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