From: NeilBrown <neilb@suse.de>
Subject: don't call utsname() after ->nsproxy is NULL.
References: bsc#1201196
Patch-mainline: Never, not needed
Our patch 0001-NFS-flush-out-dirty-data-on-file-fput.patch calls fsync()
from nfs_file_release(). This can be called late in do_exit()
when the final delayed fput() is called.
At this point ->nsproxy is already NULL, so utsname() cannot safely
be used.
The string constucted with utsname() calls is optional - it is present
in the protocol for debugging only. It is perfectly safe not to include
it.
So if current->nsproxy is NULL, skip generation of this string.
Signed-off-by: NeilBrown <neilb@suse.de>
---
fs/nfs/nfs4xdr.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -1785,7 +1785,10 @@ static void encode_exchange_id(struct xd
break;
}
- if (send_implementation_id &&
+ /* ->nsproxy is null during final fput() in do_exit(),
+ * in which case utsname() is not usable.
+ */
+ if (send_implementation_id && current->nsproxy &&
sizeof(CONFIG_NFS_V4_1_IMPLEMENTATION_ID_DOMAIN) > 1 &&
sizeof(CONFIG_NFS_V4_1_IMPLEMENTATION_ID_DOMAIN)
<= sizeof(impl_name) + 1)