diff options
Diffstat (limited to 'kernel/kmod.c')
-rw-r--r-- | kernel/kmod.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/kernel/kmod.c b/kernel/kmod.c index 957a7aab8ebc..4079ac1d5e79 100644 --- a/kernel/kmod.c +++ b/kernel/kmod.c | |||
@@ -339,17 +339,24 @@ static DECLARE_WAIT_QUEUE_HEAD(running_helpers_waitq); | |||
339 | */ | 339 | */ |
340 | #define RUNNING_HELPERS_TIMEOUT (5 * HZ) | 340 | #define RUNNING_HELPERS_TIMEOUT (5 * HZ) |
341 | 341 | ||
342 | void read_lock_usermodehelper(void) | 342 | int usermodehelper_read_trylock(void) |
343 | { | 343 | { |
344 | int ret = 0; | ||
345 | |||
344 | down_read(&umhelper_sem); | 346 | down_read(&umhelper_sem); |
347 | if (usermodehelper_disabled) { | ||
348 | up_read(&umhelper_sem); | ||
349 | ret = -EAGAIN; | ||
350 | } | ||
351 | return ret; | ||
345 | } | 352 | } |
346 | EXPORT_SYMBOL_GPL(read_lock_usermodehelper); | 353 | EXPORT_SYMBOL_GPL(usermodehelper_read_trylock); |
347 | 354 | ||
348 | void read_unlock_usermodehelper(void) | 355 | void usermodehelper_read_unlock(void) |
349 | { | 356 | { |
350 | up_read(&umhelper_sem); | 357 | up_read(&umhelper_sem); |
351 | } | 358 | } |
352 | EXPORT_SYMBOL_GPL(read_unlock_usermodehelper); | 359 | EXPORT_SYMBOL_GPL(usermodehelper_read_unlock); |
353 | 360 | ||
354 | /** | 361 | /** |
355 | * usermodehelper_disable - prevent new helpers from being started | 362 | * usermodehelper_disable - prevent new helpers from being started |
@@ -390,15 +397,6 @@ void usermodehelper_enable(void) | |||
390 | up_write(&umhelper_sem); | 397 | up_write(&umhelper_sem); |
391 | } | 398 | } |
392 | 399 | ||
393 | /** | ||
394 | * usermodehelper_is_disabled - check if new helpers are allowed to be started | ||
395 | */ | ||
396 | bool usermodehelper_is_disabled(void) | ||
397 | { | ||
398 | return usermodehelper_disabled; | ||
399 | } | ||
400 | EXPORT_SYMBOL_GPL(usermodehelper_is_disabled); | ||
401 | |||
402 | static void helper_lock(void) | 400 | static void helper_lock(void) |
403 | { | 401 | { |
404 | atomic_inc(&running_helpers); | 402 | atomic_inc(&running_helpers); |