The patch titled Subject: posix-cpu-timers: fix nanosleep task_struct leak has been removed from the -mm tree. Its filename was posix-cpu-timers-fix-nanosleep-task_struct-leak.patch This patch was dropped because it was merged into mainline or a subsystem tree ------------------------------------------------------ From: Stanislaw Gruszka <sgruszka@xxxxxxxxxx> Subject: posix-cpu-timers: fix nanosleep task_struct leak In do_cpu_nanosleep() we do posic_cpu_timer_create(), but forgot corresponding posix_cpu_timer_del() what lead to task_struct leak. This looks like a DoS problem fix, since it's possible to eat kernel memory (very slowly though) by normal user, hence Cc stable. Signed-off-by: Stanislaw Gruszka <sgruszka@xxxxxxxxxx> Reported-by: Tommi Rantala <tt.rantala@xxxxxxxxx> Tested-by: Tommi Rantala <tt.rantala@xxxxxxxxx> Cc: Oleg Nesterov <oleg@xxxxxxxxxx> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Cc: Dave Jones <davej@xxxxxxxxxx> Cc: John Stultz <john.stultz@xxxxxxxxxx> Cc: Ingo Molnar <mingo@xxxxxxx> Cc: <stable@xxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- kernel/posix-cpu-timers.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff -puN kernel/posix-cpu-timers.c~posix-cpu-timers-fix-nanosleep-task_struct-leak kernel/posix-cpu-timers.c --- a/kernel/posix-cpu-timers.c~posix-cpu-timers-fix-nanosleep-task_struct-leak +++ a/kernel/posix-cpu-timers.c @@ -1417,8 +1417,10 @@ static int do_cpu_nanosleep(const clocki while (!signal_pending(current)) { if (timer.it.cpu.expires.sched == 0) { /* - * Our timer fired and was reset. + * Our timer fired and was reset, below + * deletion can not fail. */ + posix_cpu_timer_del(&timer); spin_unlock_irq(&timer.it_lock); return 0; } @@ -1436,9 +1438,26 @@ static int do_cpu_nanosleep(const clocki * We were interrupted by a signal. */ sample_to_timespec(which_clock, timer.it.cpu.expires, rqtp); - posix_cpu_timer_set(&timer, 0, &zero_it, it); + error = posix_cpu_timer_set(&timer, 0, &zero_it, it); + if (!error) { + /* + * Timer is now unarmed, deletion can not fail. + */ + posix_cpu_timer_del(&timer); + } spin_unlock_irq(&timer.it_lock); + while (error == TIMER_RETRY) { + /* + * We need to handle case when timer was or is in the + * middle of firing. In other cases we already freed + * resources. + */ + spin_lock_irq(&timer.it_lock); + error = posix_cpu_timer_del(&timer); + spin_unlock_irq(&timer.it_lock); + } + if ((it->it_value.tv_sec | it->it_value.tv_nsec) == 0) { /* * It actually did fire already. _ Patches currently in -mm which might be from sgruszka@xxxxxxxxxx are linux-next.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html