diff options
Diffstat (limited to 'kernel/user.c')
-rw-r--r-- | kernel/user.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/kernel/user.c b/kernel/user.c index 3551ac742395..6a9b696128c8 100644 --- a/kernel/user.c +++ b/kernel/user.c | |||
@@ -362,6 +362,24 @@ static void free_user(struct user_struct *up, unsigned long flags) | |||
362 | 362 | ||
363 | #endif | 363 | #endif |
364 | 364 | ||
365 | #if defined(CONFIG_RT_GROUP_SCHED) && defined(CONFIG_USER_SCHED) | ||
366 | /* | ||
367 | * We need to check if a setuid can take place. This function should be called | ||
368 | * before successfully completing the setuid. | ||
369 | */ | ||
370 | int task_can_switch_user(struct user_struct *up, struct task_struct *tsk) | ||
371 | { | ||
372 | |||
373 | return sched_rt_can_attach(up->tg, tsk); | ||
374 | |||
375 | } | ||
376 | #else | ||
377 | int task_can_switch_user(struct user_struct *up, struct task_struct *tsk) | ||
378 | { | ||
379 | return 1; | ||
380 | } | ||
381 | #endif | ||
382 | |||
365 | /* | 383 | /* |
366 | * Locate the user_struct for the passed UID. If found, take a ref on it. The | 384 | * Locate the user_struct for the passed UID. If found, take a ref on it. The |
367 | * caller must undo that ref with free_uid(). | 385 | * caller must undo that ref with free_uid(). |