From owner-freebsd-hackers Tue Jun 15 2:37:56 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from ns.oeno.com (ns.oeno.com [194.100.99.145]) by hub.freebsd.org (Postfix) with SMTP id 54CBD14D8C for ; Tue, 15 Jun 1999 02:37:53 -0700 (PDT) (envelope-from will@ns.oeno.com) Received: (qmail 6163 invoked by uid 1001); 15 Jun 1999 09:37:52 -0000 To: dillon@apollo.backplane.com (Matthew Dillon) Cc: hackers@freebsd.org Subject: Re: oops, here's the patch References: <199906142007.QAA62362@wobble.cs.rpi.edu> <199906142350.QAA12993@apollo.backplane.com> From: Ville-Pertti Keinonen Date: 15 Jun 1999 12:35:33 +0300 In-Reply-To: dillon@apollo.backplane.com's message of "15 Jun 1999 02:50:57 +0300" Message-ID: <86909lolga.fsf@not.demophon.com> Lines: 38 X-Mailer: Gnus v5.5/XEmacs 20.4 - "Emerald" Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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