dil...@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 majord...@freebsd.org
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to