diff options
author | Ingo Tuchscherer <ingo.tuchscherer@de.ibm.com> | 2014-09-16 08:37:25 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2014-09-25 04:52:04 -0400 |
commit | 46b05c7bd51edafb8c8da088b49bddf7f78d48f9 (patch) | |
tree | 8d20b253fd3ddbe544ae9e7df0a86a1388dc7528 | |
parent | 9fc98ad0d2bf3cd71772d1bda75e7a8b4dce261b (diff) |
s390/zcrypt: Fixed possible race condition in zcrypt module handling
Signed-off-by: Ingo Tuchscherer <ingo.tuchscherer@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r-- | drivers/s390/crypto/zcrypt_api.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/s390/crypto/zcrypt_api.c b/drivers/s390/crypto/zcrypt_api.c index 0e18c5dcd91f..08f1830cbfc4 100644 --- a/drivers/s390/crypto/zcrypt_api.c +++ b/drivers/s390/crypto/zcrypt_api.c | |||
@@ -343,10 +343,11 @@ struct zcrypt_ops *__ops_lookup(unsigned char *name, int variant) | |||
343 | break; | 343 | break; |
344 | } | 344 | } |
345 | } | 345 | } |
346 | if (!found || !try_module_get(zops->owner)) | ||
347 | zops = NULL; | ||
348 | |||
346 | spin_unlock_bh(&zcrypt_ops_list_lock); | 349 | spin_unlock_bh(&zcrypt_ops_list_lock); |
347 | 350 | ||
348 | if (!found) | ||
349 | return NULL; | ||
350 | return zops; | 351 | return zops; |
351 | } | 352 | } |
352 | 353 | ||
@@ -359,8 +360,6 @@ struct zcrypt_ops *zcrypt_msgtype_request(unsigned char *name, int variant) | |||
359 | request_module("%s", name); | 360 | request_module("%s", name); |
360 | zops = __ops_lookup(name, variant); | 361 | zops = __ops_lookup(name, variant); |
361 | } | 362 | } |
362 | if ((!zops) || (!try_module_get(zops->owner))) | ||
363 | return NULL; | ||
364 | return zops; | 363 | return zops; |
365 | } | 364 | } |
366 | EXPORT_SYMBOL(zcrypt_msgtype_request); | 365 | EXPORT_SYMBOL(zcrypt_msgtype_request); |