diff options
author | msmith <msmith@FreeBSD.org> | 1998-11-13 22:58:48 +0000 |
---|---|---|
committer | msmith <msmith@FreeBSD.org> | 1998-11-13 22:58:48 +0000 |
commit | 5a28cf02837de734aa430222b15124cfab8db5b7 (patch) | |
tree | 8405802e6ba7a412035d6de8c67e84cb610d2a37 | |
parent | 0784b75a47132859d84d6e61b79f0eb902bb9988 (diff) | |
download | FreeBSD-src-5a28cf02837de734aa430222b15124cfab8db5b7.zip FreeBSD-src-5a28cf02837de734aa430222b15124cfab8db5b7.tar.gz |
Avoid a null pointer reference if the target of an NFS rename has been
sillrenamed, or if the source vnode doesn't have an associated nfsnode.
Bug report from Andrew Gallatin <gallatin@cs.duke.edu>
-rw-r--r-- | sys/nfs/nfs_vnops.c | 17 | ||||
-rw-r--r-- | sys/nfsclient/nfs_vnops.c | 17 |
2 files changed, 20 insertions, 14 deletions
diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c index f9830ba..c2c20d7 100644 --- a/sys/nfs/nfs_vnops.c +++ b/sys/nfs/nfs_vnops.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_vnops.c 8.16 (Berkeley) 5/27/95 - * $Id: nfs_vnops.c,v 1.111 1998/11/09 07:00:14 peter Exp $ + * $Id: nfs_vnops.c,v 1.112 1998/11/13 02:39:09 msmith Exp $ */ @@ -1668,13 +1668,16 @@ nfs_rename(ap) } /* - * We can't presume too much on the server's access control method(s), and - * it may use rules based on filenames or locations. Moving to a more - * restrictive location would be harmless, but moving to a less restrictive - * location you would be forced to wait for the cache entry to time out. + * We can't presume too much on the server's access control method(s), + * and it may use rules based on filenames or locations. Moving to a + * more restrictive location would be harmless, but moving to a less + * restrictive location you would be forced to wait for the cache + * entry to time out. */ - VTONFS(fvp)->n_modestamp = 0; - VTONFS(tvp)->n_modestamp = 0; + if (fvp->v_data) + VTONFS(fvp)->n_modestamp = 0; + if (tvp != NULL) + VTONFS(tvp)->n_modestamp = 0; out: if (tdvp == tvp) diff --git a/sys/nfsclient/nfs_vnops.c b/sys/nfsclient/nfs_vnops.c index f9830ba..c2c20d7 100644 --- a/sys/nfsclient/nfs_vnops.c +++ b/sys/nfsclient/nfs_vnops.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_vnops.c 8.16 (Berkeley) 5/27/95 - * $Id: nfs_vnops.c,v 1.111 1998/11/09 07:00:14 peter Exp $ + * $Id: nfs_vnops.c,v 1.112 1998/11/13 02:39:09 msmith Exp $ */ @@ -1668,13 +1668,16 @@ nfs_rename(ap) } /* - * We can't presume too much on the server's access control method(s), and - * it may use rules based on filenames or locations. Moving to a more - * restrictive location would be harmless, but moving to a less restrictive - * location you would be forced to wait for the cache entry to time out. + * We can't presume too much on the server's access control method(s), + * and it may use rules based on filenames or locations. Moving to a + * more restrictive location would be harmless, but moving to a less + * restrictive location you would be forced to wait for the cache + * entry to time out. */ - VTONFS(fvp)->n_modestamp = 0; - VTONFS(tvp)->n_modestamp = 0; + if (fvp->v_data) + VTONFS(fvp)->n_modestamp = 0; + if (tvp != NULL) + VTONFS(tvp)->n_modestamp = 0; out: if (tdvp == tvp) |