]> git.baikalelectronics.ru Git - kernel.git/commit
sched, signals: fix the racy usage of ->signal in account_group_xxx/run_posix_cpu_timers
authorOleg Nesterov <oleg@redhat.com>
Mon, 17 Nov 2008 14:39:47 +0000 (15:39 +0100)
committerIngo Molnar <mingo@elte.hu>
Mon, 17 Nov 2008 15:49:35 +0000 (16:49 +0100)
commit097dfd5243a495842e4b83fb65900c925e1bd67f
tree4762492d6c564e0ac1ec47122a0d0d49b0d41e90
parentd8ed6fa57f2962d90d53e83fc21e50a118826941
sched, signals: fix the racy usage of ->signal in account_group_xxx/run_posix_cpu_timers

Impact: fix potential NULL dereference

Contrary to b51135e65e4fb68d596d3dc1413435eb0855e2d4 changelog, other
acct_group_xxx() helpers can be called after exit_notify() by timer tick.
Thanks to Roland for pointing out this. Somehow I missed this simple fact
when I read the original patch, and I am afraid I confused Frank during
the discussion. Sorry.

Fortunately, these helpers work with current, we can check ->exit_state
to ensure that ->signal can't go away under us.

Also, add the comment and compiler barrier to account_group_exec_runtime(),
to make sure we load ->signal only once.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/posix-cpu-timers.c
kernel/sched_stats.h