diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2007-09-20 10:45:02 +0200 |
---|---|---|
committer | J. Bruce Fields <bfields@citi.umich.edu> | 2007-10-10 00:32:45 +0200 |
commit | 85c59580b30c82aa771aa33b37217a6b6851bc14 (patch) | |
tree | 02e96b437a63908ad3791021d352ad2aefff9936 /include/asm-m68k/atari_stdma.h | |
parent | Use list_first_entry in locks_wake_up_blocks (diff) | |
download | linux-85c59580b30c82aa771aa33b37217a6b6851bc14.tar.xz linux-85c59580b30c82aa771aa33b37217a6b6851bc14.zip |
locks: Fix potential OOPS in generic_setlease()
This code is run under lock_kernel(), which is dropped during
sleeping operations, so the following race is possible:
CPU1: CPU2:
vfs_setlease(); vfs_setlease();
lock_kernel();
lock_kernel(); /* spin */
generic_setlease():
...
for (before = ...)
/* here we found some lease after
* which we will insert the new one
*/
fl = locks_alloc_lock();
/* go to sleep in this allocation and
* drop the BKL
*/
generic_setlease():
...
for (before = ...)
/* here we find the "before" pointing
* at the one we found on CPU1
*/
->fl_change(my_before, arg);
lease_modify();
locks_free_lock();
/* and we freed it */
...
unlock_kernel();
locks_insert_lock(before, fl);
/* OOPS! We have just tried to add the lease
* at the tail of already removed one
*/
The similar races are already handled in other code - all the
allocations are performed before any checks/updates.
Thanks to Kamalesh Babulal for testing and for a bug report on an
earlier version.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Cc: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
Diffstat (limited to 'include/asm-m68k/atari_stdma.h')
0 files changed, 0 insertions, 0 deletions