Re: [PATCH] protect remove_proc_entry
From: Steven Rostedt
Date: Tue Jan 10 2006 - 08:26:13 EST
Andrew, here's a better explanation of the patch as well as my
Signed-off.
Description:
It has been discovered that the remove_proc_entry has a race in the
removing of entries in the proc file system that are siblings. There's
no protection around the traversing and removing of elements that belong
in the same subdirectory.
This subdirectory list is protected in other areas by the BKL. So the
BKL was at first used to protect this area too, but unfortunately,
remove_proc_entry may be called with spinlocks held. The BKL may
schedule, so this was not a solution.
The final solution was to add a new global spin lock to protect this
list, called proc_subdir_lock. This lock now protects the list in
remove_proc_entry, and I also went around looking for other areas that
this list is modified and added this protection there too. Care must be
taken since these locations call several functions that may also
schedule.
Since I don't see any location that these functions that modify the
subdirectory list are called by interrupts, the irqsave/restore versions
of the spin lock was _not_ used.
Signed-off-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
-- Steve
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/