aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/cryptd.c
diff options
context:
space:
mode:
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 671d4d6d14df..7bdd61b867c8 100644
--- a/crypto/cryptd.c
+++ b/crypto/cryptd.c
@@ -137,13 +137,18 @@ static void cryptd_queue_worker(struct work_struct *work)
137 struct crypto_async_request *req, *backlog; 137 struct crypto_async_request *req, *backlog;
138 138
139 cpu_queue = container_of(work, struct cryptd_cpu_queue, work); 139 cpu_queue = container_of(work, struct cryptd_cpu_queue, work);
140 /* Only handle one request at a time to avoid hogging crypto 140 /*
141 * workqueue. preempt_disable/enable is used to prevent 141 * Only handle one request at a time to avoid hogging crypto workqueue.
142 * being preempted by cryptd_enqueue_request() */ 142 * preempt_disable/enable is used to prevent being preempted by
143 * cryptd_enqueue_request(). local_bh_disable/enable is used to prevent
144 * cryptd_enqueue_request() being accessed from software interrupts.
145 */
146 local_bh_disable();
143 preempt_disable(); 147 preempt_disable();
144 backlog = crypto_get_backlog(&cpu_queue->queue); 148 backlog = crypto_get_backlog(&cpu_queue->queue);
145 req = crypto_dequeue_request(&cpu_queue->queue); 149 req = crypto_dequeue_request(&cpu_queue->queue);
146 preempt_enable(); 150 preempt_enable();
151 local_bh_enable();
147 152
148 if (!req) 153 if (!req)
149 return; 154 return;