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
This commit is contained in:
@@ -137,13 +137,18 @@ static void cryptd_queue_worker(struct work_struct *work)
|
|||||||
struct crypto_async_request *req, *backlog;
|
struct crypto_async_request *req, *backlog;
|
||||||
|
|
||||||
cpu_queue = container_of(work, struct cryptd_cpu_queue, work);
|
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
|
* Only handle one request at a time to avoid hogging crypto workqueue.
|
||||||
* being preempted by cryptd_enqueue_request() */
|
* 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();
|
preempt_disable();
|
||||||
backlog = crypto_get_backlog(&cpu_queue->queue);
|
backlog = crypto_get_backlog(&cpu_queue->queue);
|
||||||
req = crypto_dequeue_request(&cpu_queue->queue);
|
req = crypto_dequeue_request(&cpu_queue->queue);
|
||||||
preempt_enable();
|
preempt_enable();
|
||||||
|
local_bh_enable();
|
||||||
|
|
||||||
if (!req)
|
if (!req)
|
||||||
return;
|
return;
|
||||||
|
Reference in New Issue
Block a user