NFS: Fix use after free in write error path
authorFred Isaman <fred.isaman@gmail.com>
Fri, 14 Apr 2017 18:24:28 +0000 (14:24 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 May 2017 13:44:48 +0000 (15:44 +0200)
commit 1f84ccdf37d0db3a70714d02d51b0b6d45887fb8 upstream.

Signed-off-by: Fred Isaman <fred.isaman@gmail.com>
Fixes: 0bcbf039f6b2b ("nfs: handle request add failure properly")
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/nfs/write.c

index 5321183..e4772a8 100644 (file)
@@ -548,9 +548,9 @@ static void nfs_write_error_remove_page(struct nfs_page *req)
 {
        nfs_unlock_request(req);
        nfs_end_page_writeback(req);
-       nfs_release_request(req);
        generic_error_remove_page(page_file_mapping(req->wb_page),
                                  req->wb_page);
+       nfs_release_request(req);
 }
 
 /*