a suspected data race in /driver/mtd/ubi/build.c

홍신 shin hong hongshin at gmail.com
Tue May 19 07:34:17 EDT 2009


Hi. I am reporting a susptected data race bug at
ubi_attach_mtd_dev() in /driver/mtd/ubi/build.c .

This function creates a kernel thread by calling
kthread_create(ubi_thread, ubi .. ). and then
it assigns ubi->thread_enabled = 1.

However, ubi_thread() also reads ubi->thread_enabled.
This may cause data race since the execution results
would be differ depending on the scheduling.

I think, ubi_attach_mtd_dev() should be modified to protect
the writing aceess to ubi->thread_enabled
by spin_lock(&ubi->wl_lock).

But I do not have much background on the code.
So please check this code and let me know your opinions.
Thanks.

Sincerely
Shin Hong



More information about the linux-mtd mailing list