Messages in this thread | | | Date | Tue, 28 Aug 2012 19:12:36 +0200 | From | Oleg Nesterov <> | Subject | Re: lockdep trace from posix timers |
| |
On 08/28, Oleg Nesterov wrote: > > On 08/28, Peter Zijlstra wrote: > > > > +again: > > + workp = &task->task_works; > > + work = *workp; > > + while (work) { > > + if (work->func == func) { > > But you can't dereference this pointer. Without some locking this > can race with another task_work_cancel() or task_work_run(), this > work can be free/unmapped/reused. > > > + if (cmpxchg(workp, work, work->next) == work) > > + return work; > > Or this can race with task_work_cancel(work) + task_work_add(work). > cmpxchg() can succeed even if work->func is already different.
Even simpler, this can race with another task_work_cancel() which is going to remove work->next.
Oleg.
| |