summaryrefslogtreecommitdiff
path: root/fs/nfs/nfs4proc.c
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2008-10-16 03:15:16 (GMT)
committerTrond Myklebust <Trond.Myklebust@netapp.com>2008-10-17 17:06:45 (GMT)
commit504e518953a330c8d44a95bdd65a5c9f50f1012e (patch)
tree383df8cd12bebecd9bcf7714b6d8b07324a6353f /fs/nfs/nfs4proc.c
parent18de9735300756e3ca9c361ef58409d8561dfe0d (diff)
downloadlinux-504e518953a330c8d44a95bdd65a5c9f50f1012e.tar.xz
Make nfs_file_cred more robust.
As not all files have an associated open_context (e.g. device special files), it is safest to test for the existence of the open context before de-referencing it. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r--fs/nfs/nfs4proc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index c910413..83e700a 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -1659,8 +1659,10 @@ nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
struct nfs_open_context *ctx;
ctx = nfs_file_open_context(sattr->ia_file);
- cred = ctx->cred;
- state = ctx->state;
+ if (ctx) {
+ cred = ctx->cred;
+ state = ctx->state;
+ }
}
status = nfs4_do_setattr(inode, cred, fattr, sattr, state);