Re: [RFC PATCH 4/12 v2] ptrace: introduce the empty "structptrace_context"
From: Roland McGrath
Date: Thu May 28 2009 - 17:16:19 EST
> + 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/