]>
Commit | Line | Data |
---|---|---|
00e5a55c BS |
1 | From: NeilBrown <neilb@suse.de> |
2 | Subject: nfs_file_cred should cope if 'file' hasn't been opened properly | |
3 | Patch-mainline: Not relevant | |
4 | References: bnc#431785 | |
5 | ||
6 | ||
7 | .. and so doesn't have a 'context'. This can happen when e.g. | |
8 | a chmod on a device-special-file happens. The object isn't opened over | |
9 | NFS so there is no open context, but we currently look for one when | |
10 | doing a setattr. | |
11 | ||
12 | Signed-off-by: Neil Brown <neilb@suse.de> | |
13 | ||
14 | --- | |
15 | include/linux/nfs_fs.h | 7 +++++-- | |
16 | 1 file changed, 5 insertions(+), 2 deletions(-) | |
17 | ||
18 | --- linux-2.6.27-neilb.orig/include/linux/nfs_fs.h | |
19 | +++ linux-2.6.27-neilb/include/linux/nfs_fs.h | |
20 | @@ -372,8 +372,11 @@ static inline struct nfs_open_context *n | |
21 | ||
22 | static inline struct rpc_cred *nfs_file_cred(struct file *file) | |
23 | { | |
24 | - if (file != NULL) | |
25 | - return nfs_file_open_context(file)->cred; | |
26 | + if (file != NULL) { | |
27 | + struct nfs_open_context *ctx = nfs_file_open_context(file); | |
28 | + if (ctx) | |
29 | + return ctx->cred; | |
30 | + } | |
31 | return NULL; | |
32 | } | |
33 |