
From: Miklos Szeredi <miklos@szeredi.hu>

This patch fixes a use after free bug, which could in theory cause memory
corruption.  It was actually found with DEBUG_PAGEALLOC by Magnus
Johansson.  

Signed-off-by: Miklos Szeredi <miklos@szeredi.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/fs/fuse/dev.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff -puN fs/fuse/dev.c~fuse-device-functions-use-after-free-fix fs/fuse/dev.c
--- 25/fs/fuse/dev.c~fuse-device-functions-use-after-free-fix	Fri Mar  4 15:34:45 2005
+++ 25-akpm/fs/fuse/dev.c	Fri Mar  4 15:34:45 2005
@@ -121,12 +121,11 @@ struct fuse_req *fuse_get_request_nonint
 
 static void fuse_putback_request(struct fuse_conn *fc, struct fuse_req *req)
 {
-	if (!req->preallocated)
-		fuse_request_free(req);
-
 	spin_lock(&fuse_lock);
 	if (req->preallocated)
 		list_add(&req->list, &fc->unused_list);
+	else
+		fuse_request_free(req);
 
 	if (fc->outstanding_debt)
 		fc->outstanding_debt--;
_
