Skip to contentSkip to conversation

data race in remove_proc_entry()

DISCUSSION 홍신 shin hong 1 participant 1 message Feb 3, 2009 VFS

lore
Share & tools
lore
#0 lore raw

Hi. I found a suspected bug in proc file system

At proc/generic.c line 806, de->subdir is not protected by spin_lock(&proc_subdir_lock)
so that data races might occur.

Line 806 must be protected by spin_lock(&proc_subdir_lock) to avoid data race.

WARN(condition , stmt) is translated into if (condition) { stmt }. At line 806, a context switching can happen right after the condition checking and another thread may set 'de->subdir' as a null.
In this case, the execution of 'stmt' would occur null pointer dereference error since it has 'de->subdir->name'.

Sincerely,
Shin Hong
M.S. Candidate
Computer Science Div., EECS Dept.,
Korea Advanced Institute of Sci. & Tech.,
Republic of Korea