diff options
| -rw-r--r-- | fs/nfs/nfs4proc.c | 6 | ||||
| -rw-r--r-- | include/linux/nfs_fs.h | 8 |
2 files changed, 10 insertions, 4 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index c910413eaeca..83e700a2b0c0 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, | |||
| 1659 | struct nfs_open_context *ctx; | 1659 | struct nfs_open_context *ctx; |
| 1660 | 1660 | ||
| 1661 | ctx = nfs_file_open_context(sattr->ia_file); | 1661 | ctx = nfs_file_open_context(sattr->ia_file); |
| 1662 | cred = ctx->cred; | 1662 | if (ctx) { |
| 1663 | state = ctx->state; | 1663 | cred = ctx->cred; |
| 1664 | state = ctx->state; | ||
| 1665 | } | ||
| 1664 | } | 1666 | } |
| 1665 | 1667 | ||
| 1666 | status = nfs4_do_setattr(inode, cred, fattr, sattr, state); | 1668 | status = nfs4_do_setattr(inode, cred, fattr, sattr, state); |
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index ac8d0233b05c..4eaa8347a0d9 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
| @@ -367,8 +367,12 @@ static inline struct nfs_open_context *nfs_file_open_context(struct file *filp) | |||
| 367 | 367 | ||
| 368 | static inline struct rpc_cred *nfs_file_cred(struct file *file) | 368 | static inline struct rpc_cred *nfs_file_cred(struct file *file) |
| 369 | { | 369 | { |
| 370 | if (file != NULL) | 370 | if (file != NULL) { |
| 371 | return nfs_file_open_context(file)->cred; | 371 | struct nfs_open_context *ctx = |
| 372 | nfs_file_open_context(file); | ||
| 373 | if (ctx) | ||
| 374 | return ctx->cred; | ||
| 375 | } | ||
| 372 | return NULL; | 376 | return NULL; |
| 373 | } | 377 | } |
| 374 | 378 | ||
