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)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Thu, 20 Apr 2017 17:51:52 +0000 (13:51 -0400)
Signed-off-by: Fred Isaman <fred.isaman@gmail.com>
Fixes: 0bcbf039f6b2b ("nfs: handle request add failure properly")
Cc: stable@vger.kernel.org # v4.5+
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
fs/nfs/write.c

index bdfe5a7c58743e3b3429081bc0f3ee74fca15c5e..e0bccbefbc9ea21605dd922c4648ffd1a809ed68 100644 (file)
@@ -561,9 +561,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);
 }
 
 /*