]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
NFS4: Only set creation opendata if O_CREAT
authorBenjamin Coddington <bcodding@redhat.com>
Fri, 7 Jun 2019 10:37:30 +0000 (06:37 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 14 Jul 2019 06:09:46 +0000 (08:09 +0200)
commit26fd9ac2120b4d05c5c4c9f6c8981c056cc6d1cd
tree1155add4f86f1b65690191c7094c0d6ebdff05d0
parent7e5cb4da600918a2a2fecfa48771770853c3c0c3
NFS4: Only set creation opendata if O_CREAT

[ Upstream commit 909105199a682cb09c500acd443d34b182846c9c ]

We can end up in nfs4_opendata_alloc during task exit, in which case
current->fs has already been cleaned up.  This leads to a crash in
current_umask().

Fix this by only setting creation opendata if we are actually doing an open
with O_CREAT.  We can drop the check for NULL nfs4_open_createattrs, since
O_CREAT will never be set for the recovery path.

Suggested-by: Trond Myklebust <trondmy@hammerspace.com>
Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/nfs/nfs4proc.c