Re: PATCH [1/1]: audit: acquire creds selectively to reduce atomic op overhead

From: David Howells
Date: Tue Mar 15 2011 - 16:05:06 EST


Tony Jones <tonyj@xxxxxxx> wrote:

> Agree. Also I believe it is safe to use tsk->cred directly as tsk == current
> or tsk is being created by copy_process.

You can't quite access it like that without sparse throwing a warning. The
pointer is marked with an __rcu attribute, so you need to use something like
this:

cred = rcu_dereference_check(tsk->cred, (tsk == current ||
called_from_copy_process());

David
--
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/