Skip to content

Commit a5dfefb

Browse files
Gilad Ben-Yossefherbertx
authored andcommitted
crypto: drbg - wait for crypto op not signal safe
drbg_kcapi_sym_ctr() was using wait_for_completion_interruptible() to wait for completion of async crypto op but if a signal occurs it may return before DMA ops of HW crypto provider finish, thus corrupting the output buffer. Resolve this by using wait_for_completion() instead. Reported-by: Eric Biggers <[email protected]> Signed-off-by: Gilad Ben-Yossef <[email protected]> CC: [email protected] Signed-off-by: Herbert Xu <[email protected]>
1 parent e68368a commit a5dfefb

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

crypto/drbg.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1767,9 +1767,8 @@ static int drbg_kcapi_sym_ctr(struct drbg_state *drbg,
17671767
break;
17681768
case -EINPROGRESS:
17691769
case -EBUSY:
1770-
ret = wait_for_completion_interruptible(
1771-
&drbg->ctr_completion);
1772-
if (!ret && !drbg->ctr_async_err) {
1770+
wait_for_completion(&drbg->ctr_completion);
1771+
if (!drbg->ctr_async_err) {
17731772
reinit_completion(&drbg->ctr_completion);
17741773
break;
17751774
}

0 commit comments

Comments
 (0)