Trond Myklebust 993dfa8776 [PATCH] fs/locks.c: Fix sys_flock() race
sys_flock() currently has a race which can result in a double free in the
multi-thread case.

Thread 1			Thread 2

sys_flock(file, LOCK_EX)
				sys_flock(file, LOCK_UN)

If Thread 2 removes the lock from inode->i_lock before Thread 1 tests for
list_empty(&lock->fl_link) at the end of sys_flock, then both threads will
end up calling locks_free_lock for the same lock.

Fix is to make flock_lock_file() do the same as posix_lock_file(), namely
to make a copy of the request, so that the caller can always free the lock.

This also has the side-effect of fixing up a reference problem in the
lockd handling of flock.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-31 12:18:56 -08:00
..
2006-03-31 12:18:51 -08:00
2006-03-26 08:56:55 -08:00
2006-03-31 12:18:55 -08:00
2006-03-24 07:33:19 -08:00
2006-03-29 13:24:50 +11:00
2006-03-31 12:18:55 -08:00
2006-01-11 18:42:13 -08:00
2006-01-10 08:01:25 -08:00
2006-01-08 20:12:40 -08:00
2005-10-30 17:37:32 -08:00
2006-03-28 09:16:05 -08:00
2006-01-11 18:42:13 -08:00
2006-01-11 18:42:13 -08:00
2006-03-23 23:44:19 -05:00
2006-03-31 12:18:54 -08:00
2006-03-28 09:16:08 -08:00
2006-03-24 07:33:19 -08:00
2006-03-24 07:33:24 -08:00
2005-11-07 18:18:11 -08:00
2006-03-23 07:38:11 -08:00
2006-03-23 07:38:11 -08:00
2006-03-28 09:16:05 -08:00
2006-03-23 07:38:12 -08:00
2006-03-30 22:16:24 -08:00
2006-02-11 21:41:10 -08:00
2006-03-26 08:56:55 -08:00
2006-03-31 12:18:54 -08:00