Skip to content

Commit

Permalink
[PATCH] VFS: Fix memory leak with file leases
Browse files Browse the repository at this point in the history
 The patch
 http://linux.bkbits.net:8080/linux-2.6/diffs/fs/[email protected]??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 <[email protected]>
 Signed-off-by: Trond Myklebust <[email protected]>
  • Loading branch information
bfields authored and Trond Myklebust committed Nov 13, 2005
1 parent 9e6c67f commit dc15ae1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/locks.c
Original file line number Diff line number Diff line change
Expand Up @@ -1430,7 +1430,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);
Expand Down

0 comments on commit dc15ae1

Please sign in to comment.