summaryrefslogtreecommitdiff
path: root/crypto/cryptd.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-11-09 18:10:20 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2012-11-09 18:10:20 +0100
commite5f34c7602d7c442e530b3eaff8fb44784ca26ac (patch)
treeb53397adbb312a49d579e43be61e7b470f719152 /crypto/cryptd.c
parente648d1393463b72830a1c352143b31164ab1a696 (diff)
parentf365c76a699cce6238232259f559e9fc639763d2 (diff)
downloadlinux-crypto-e5f34c7602d7c442e530b3eaff8fb44784ca26ac.tar.gz
linux-crypto-e5f34c7602d7c442e530b3eaff8fb44784ca26ac.zip
Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Pull crypto fix from Herbert Xu: "This push fixes a potential panic in cryptd which may occur with crypto drivers such as aesni-intel." * git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: crypto: cryptd - disable softirqs in cryptd_queue_worker to prevent data corruption
Diffstat (limited to 'crypto/cryptd.c')
-rw-r--r--crypto/cryptd.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/crypto/cryptd.c b/crypto/cryptd.c
index 671d4d6d..7bdd61b8 100644
--- a/crypto/cryptd.c
+++ b/crypto/cryptd.c
@@ -137,13 +137,18 @@ static void cryptd_queue_worker(struct work_struct *work)
struct crypto_async_request *req, *backlog;
cpu_queue = container_of(work, struct cryptd_cpu_queue, work);
- /* Only handle one request at a time to avoid hogging crypto
- * workqueue. preempt_disable/enable is used to prevent
- * being preempted by cryptd_enqueue_request() */
+ /*
+ * Only handle one request at a time to avoid hogging crypto workqueue.
+ * preempt_disable/enable is used to prevent being preempted by
+ * cryptd_enqueue_request(). local_bh_disable/enable is used to prevent
+ * cryptd_enqueue_request() being accessed from software interrupts.
+ */
+ local_bh_disable();
preempt_disable();
backlog = crypto_get_backlog(&cpu_queue->queue);
req = crypto_dequeue_request(&cpu_queue->queue);
preempt_enable();
+ local_bh_enable();
if (!req)
return;