diff options
Diffstat (limited to 'Documentation/credentials.txt')
-rw-r--r-- | Documentation/credentials.txt | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/Documentation/credentials.txt b/Documentation/credentials.txt index df03169782ea..a2db35287003 100644 --- a/Documentation/credentials.txt +++ b/Documentation/credentials.txt | |||
@@ -408,9 +408,6 @@ This should be used inside the RCU read lock, as in the following example: | |||
408 | ... | 408 | ... |
409 | } | 409 | } |
410 | 410 | ||
411 | A function need not get RCU read lock to use __task_cred() if it is holding a | ||
412 | spinlock at the time as this implicitly holds the RCU read lock. | ||
413 | |||
414 | Should it be necessary to hold another task's credentials for a long period of | 411 | Should it be necessary to hold another task's credentials for a long period of |
415 | time, and possibly to sleep whilst doing so, then the caller should get a | 412 | time, and possibly to sleep whilst doing so, then the caller should get a |
416 | reference on them using: | 413 | reference on them using: |
@@ -426,17 +423,16 @@ credentials, hiding the RCU magic from the caller: | |||
426 | uid_t task_uid(task) Task's real UID | 423 | uid_t task_uid(task) Task's real UID |
427 | uid_t task_euid(task) Task's effective UID | 424 | uid_t task_euid(task) Task's effective UID |
428 | 425 | ||
429 | If the caller is holding a spinlock or the RCU read lock at the time anyway, | 426 | If the caller is holding the RCU read lock at the time anyway, then: |
430 | then: | ||
431 | 427 | ||
432 | __task_cred(task)->uid | 428 | __task_cred(task)->uid |
433 | __task_cred(task)->euid | 429 | __task_cred(task)->euid |
434 | 430 | ||
435 | should be used instead. Similarly, if multiple aspects of a task's credentials | 431 | should be used instead. Similarly, if multiple aspects of a task's credentials |
436 | need to be accessed, RCU read lock or a spinlock should be used, __task_cred() | 432 | need to be accessed, RCU read lock should be used, __task_cred() called, the |
437 | called, the result stored in a temporary pointer and then the credential | 433 | result stored in a temporary pointer and then the credential aspects called |
438 | aspects called from that before dropping the lock. This prevents the | 434 | from that before dropping the lock. This prevents the potentially expensive |
439 | potentially expensive RCU magic from being invoked multiple times. | 435 | RCU magic from being invoked multiple times. |
440 | 436 | ||
441 | Should some other single aspect of another task's credentials need to be | 437 | Should some other single aspect of another task's credentials need to be |
442 | accessed, then this can be used: | 438 | accessed, then this can be used: |