PERFORCE change 122475 for review
Roman Divacky
rdivacky at FreeBSD.org
Thu Jun 28 11:15:26 UTC 2007
http://perforce.freebsd.org/chv.cgi?CH=122475
Change 122475 by rdivacky at rdivacky_witten on 2007/06/28 11:14:41
Vrele previously vref-ed vnode in a case of failure of the second kern_get_at.
Pointed out by: rwatson
Affected files ...
.. //depot/projects/soc2007/rdivacky/linux_at/sys/kern/vfs_syscalls.c#36 edit
Differences ...
==== //depot/projects/soc2007/rdivacky/linux_at/sys/kern/vfs_syscalls.c#36 (text+ko) ====
@@ -951,7 +951,6 @@
int mode;
} */ *uap;
{
-
return kern_open(td, uap->path, UIO_USERSPACE, uap->flags, uap->mode);
}
@@ -1011,7 +1010,7 @@
} else {
error = copyin(path, buf, 1);
if (error)
- return 0; /* we want to fail */
+ return 0; /* We want to fail. */
return (buf[0] == '/');
}
}
@@ -1050,7 +1049,6 @@
goto out;
}
flags = FFLAGS(flags);
-
error = falloc(td, &nfp, &indx);
if (error)
goto out;
@@ -1570,12 +1568,12 @@
enum uio_seg segflg, int follow)
{
struct nameidata ndp, ndl;
- int error;
struct vnode *pdvp, *ldvp;
struct vnode *vp;
struct mount *mp;
int vfslocked;
int lvfslocked;
+ int error;
error = kern_get_at(td, fd1, &pdvp);
if (error && !kern_absolute_path(path1, segflg))
@@ -1585,8 +1583,11 @@
AUDITVNODE1, segflg, path1, td, pdvp);
error = kern_get_at(td, fd2, &ldvp);
- if (error && !kern_absolute_path(path2, segflg))
+ if (error && !kern_absolute_path(path2, segflg)) {
+ if (pdvp)
+ vrele(pdvp);
return (error);
+ }
NDINIT_AT(&ndl, CREATE, ((error) ? ATBADF : 0) | LOCKPARENT |
SAVENAME | MPSAFE | AUDITVNODE1, segflg, path2, td, ldvp);
@@ -3769,9 +3770,13 @@
error = kern_get_at(td, oldfd, &frdvp);
if (error && !kern_absolute_path(old, pathseg))
return (error);
+
error = kern_get_at(td, newfd, &todvp);
- if (error && !kern_absolute_path(new, pathseg))
+ if (error && !kern_absolute_path(new, pathseg)) {
+ if (frdvp)
+ vrele(frdvp);
return (error);
+ }
#ifdef MAC
NDINIT_AT(&fromnd, DELETE, ((error) ? ATBADF : 0) | LOCKPARENT |
More information about the p4-projects
mailing list