Searched hist:"993 dfa8776308dcfd311cf77a3bbed4aa11e9868" (Results 1 – 1 of 1) sorted by relevance
/linux/fs/ |
H A D | locks.c | diff 993dfa8776308dcfd311cf77a3bbed4aa11e9868 Fri Mar 31 12:30:55 CEST 2006 Trond Myklebust <Trond.Myklebust@netapp.com> [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>
|