From b3834f71cb794d4dba1f9ed2fec8bc7ee2f40b7e Mon Sep 17 00:00:00 2001 From: "J. Bruce Fields" Date: Thu, 10 Nov 2005 19:08:00 -0500 Subject: [PATCH] [PATCH] VFS: Fix memory leak with file leases The patch http://linux.bkbits.net:8080/linux-2.6/diffs/fs/locks.c@1.70??nav=index.html introduced a pretty nasty memory leak in the lease code. When freeing the lease, the code in locks_delete_lock() will correctly clean up the fasync queue, but when we return to fcntl_setlease(), the freed fasync entry will be reinstated. This patch ensures that we skip the call to fasync_helper() when we're freeing up the lease. Signed-off-by: J. Bruce Fields Signed-off-by: Trond Myklebust Signed-off-by: Chris Wright Signed-off-by: Greg Kroah-Hartman --- fs/locks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/locks.c b/fs/locks.c index f7daa5f48949..accbc3c0506f 100644 --- a/fs/locks.c +++ b/fs/locks.c @@ -1418,7 +1418,7 @@ int fcntl_setlease(unsigned int fd, struct file *filp, long arg) lock_kernel(); error = __setlease(filp, arg, &flp); - if (error) + if (error || arg == F_UNLCK) goto out_unlock; error = fasync_helper(fd, filp, 1, &flp->fl_fasync); -- 2.39.5