From 5a28cf02837de734aa430222b15124cfab8db5b7 Mon Sep 17 00:00:00 2001 From: msmith Date: Fri, 13 Nov 1998 22:58:48 +0000 Subject: 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 --- sys/nfs/nfs_vnops.c | 17 ++++++++++------- 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) -- cgit v1.1