lkml.org 
[lkml]   [2009]   [May]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [RFC PATCH 4/12 v2] ptrace: introduce the empty "struct ptrace_context"
Date
> +	task_lock(tsk);
> + if (likely(!tsk->ptrace_ctx))
> + tsk->ptrace_ctx = ptrace_ctx;
> + else
> + kfree(ptrace_ctx);
> + task_unlock(tsk);

I don't think it's kosher call kfree with task_lock() held.
The kfree case is a very unlikely path, so it can be:

task_lock(tsk);
if (likely(!tsk->ptrace_ctx)) {
tsk->ptrace_ctx = ptrace_ctx;
task_unlock(tsk);
return 0;
}

task_unlock(tsk);
kfree(ptrace_ctx);

Thanks,
Roland


\
 
 \ /
  Last update: 2009-05-28 23:19    [W:0.064 / U:0.412 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site