summaryrefslogtreecommitdiffstats
path: root/sys/fs/smbfs
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2003-02-19 11:54:35 +0000
committertjr <tjr@FreeBSD.org>2003-02-19 11:54:35 +0000
commitddfb65b48a8703cb711618247ea2edc7ac2d9ab4 (patch)
tree7a27c59198485185c761016e5b2264bbf6579a5b /sys/fs/smbfs
parent95727dd51398bedc5747291880655c9ad52616b3 (diff)
downloadFreeBSD-src-ddfb65b48a8703cb711618247ea2edc7ac2d9ab4.zip
FreeBSD-src-ddfb65b48a8703cb711618247ea2edc7ac2d9ab4.tar.gz
Do not call smbfs_attr_cacheremove() in the EXDEV case in smbfs_rename().
One of the vnodes is on different mount and is possibly on a different kind of filesystem; treating it as an smbfs vnode then writing to it will probably corrupt it. PR: 48381 MFC after: 1 month
Diffstat (limited to 'sys/fs/smbfs')
-rw-r--r--sys/fs/smbfs/smbfs_vnops.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/sys/fs/smbfs/smbfs_vnops.c b/sys/fs/smbfs/smbfs_vnops.c
index 29ff1d7..ee1bee3 100644
--- a/sys/fs/smbfs/smbfs_vnops.c
+++ b/sys/fs/smbfs/smbfs_vnops.c
@@ -624,8 +624,10 @@ smbfs_rename(ap)
flags |= 2;
} else if (fvp->v_type == VREG) {
flags |= 1;
- } else
- return EINVAL;
+ } else {
+ error = EINVAL;
+ goto out;
+ }
smb_makescred(&scred, tcnp->cn_thread, tcnp->cn_cred);
/*
* It seems that Samba doesn't implement SMB_COM_MOVE call...
@@ -643,7 +645,7 @@ smbfs_rename(ap)
if (tvp && tvp != fvp) {
error = smbfs_smb_delete(VTOSMB(tvp), &scred);
if (error)
- goto out;
+ goto out_cacherem;
}
error = smbfs_smb_rename(VTOSMB(fvp), VTOSMB(tdvp),
tcnp->cn_nameptr, tcnp->cn_namelen, &scred);
@@ -654,6 +656,10 @@ smbfs_rename(ap)
cache_purge(tdvp);
cache_purge(fdvp);
}
+
+out_cacherem:
+ smbfs_attr_cacheremove(fdvp);
+ smbfs_attr_cacheremove(tdvp);
out:
if (tdvp == tvp)
vrele(tdvp);
@@ -663,8 +669,6 @@ out:
vput(tvp);
vrele(fdvp);
vrele(fvp);
- smbfs_attr_cacheremove(fdvp);
- smbfs_attr_cacheremove(tdvp);
#ifdef possible_mistake
vgone(fvp);
if (tvp)
OpenPOWER on IntegriCloud