Date: 15 Jun 1999 12:35:33 +0300 From: Ville-Pertti Keinonen <will@iki.fi> To: dillon@apollo.backplane.com (Matthew Dillon) Cc: hackers@freebsd.org Subject: Re: oops, here's the patch Message-ID: <86909lolga.fsf@not.demophon.com> In-Reply-To: dillon@apollo.backplane.com's message of "15 Jun 1999 02:50:57 %2B0300" References: <199906142007.QAA62362@wobble.cs.rpi.edu> <199906142350.QAA12993@apollo.backplane.com>
next in thread | previous in thread | raw e-mail | index | archive | help
dillon@apollo.backplane.com (Matthew Dillon) writes: > However, if the inside of the first conditional generates an error, the vp > may be vput twice. What I recommend is this for the last bit: That can't happen (the attributes are straight from VATTR_NULL along that path) - if it could, the file could also be truncated... > if (vap->va_size != -1) { > ... > if (error) { > vput(vp); > vp = NULL; <<<<<<< my addition > } > } > if (eexistdebug && vp) <<<<<<< also check vp != NULL > vput(vp); > It would be good if someone else could look over this routine and > double-check David's find and his solution with my modification. Have > we handled all the cases? Yes, for that code path. Here's a simpler virtual unified diff that does the same thing as David's patch. (You don't need an 'eexistdebug' variable.) if (vap->va_size != -1) { ... - if (error) - vput(vp); } + if (error) + vput(vp); You can add a check for 'error == 0' in addition to 'vap->va_size != -1' but that shouldn't have any effect. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86909lolga.fsf>