NFS: Fix 2 use after free issues in the I/O code
authorTrond Myklebust <trond.myklebust@primarydata.com>
Sat, 9 Sep 2017 01:28:11 +0000 (21:28 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Sep 2017 21:13:37 +0000 (14:13 -0700)
commita70912a6bfff1289a2461e6b99a97f462fd14756
tree9b6007b83581ebe32801c5a69d1d0af0c6aa833b
parent301d91e03c9d76e9ae6442844f6c186030d01941
NFS: Fix 2 use after free issues in the I/O code

commit 196639ebbe63a037fe9a80669140bd292d8bcd80 upstream.

The writeback code wants to send a commit after processing the pages,
which is why we want to delay releasing the struct path until after
that's done.

Also, the layout code expects that we do not free the inode before
we've put the layout segments in pnfs_writehdr_free() and
pnfs_readhdr_free()

Fixes: 919e3bd9a875 ("NFS: Ensure we commit after writeback is complete")
Fixes: 4714fb51fd03 ("nfs: remove pgio_header refcount, related cleanup")
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/nfs/internal.h
fs/nfs/pagelist.c
fs/nfs/pnfs.c