Revision 993dfa8776308dcfd311cf77a3bbed4aa11e9868 authored by Trond Myklebust on 31 March 2006, 10:30:55 UTC, committed by Linus Torvalds on 31 March 2006, 20:18:56 UTC
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>
1 parent 7a2bd3f
History
File Mode Size
Documentation
arch
block
crypto
drivers
fs
include
init
ipc
kernel
lib
mm
net
scripts
security
sound
usr
.gitignore -rw-r--r-- 462 bytes
COPYING -rw-r--r-- 18.3 KB
CREDITS -rw-r--r-- 87.7 KB
Kbuild -rw-r--r-- 1.2 KB
MAINTAINERS -rw-r--r-- 67.2 KB
Makefile -rw-r--r-- 43.8 KB
README -rw-r--r-- 15.1 KB
REPORTING-BUGS -rw-r--r-- 3.0 KB

README

back to top