Skip to content

Commit 1628739

Browse files
WOnder93herbertx
authored andcommitted
crypto: qcom-rng - fix infinite loop on requests not multiple of WORD_SZ
The commit referenced in the Fixes tag removed the 'break' from the else branch in qcom_rng_read(), causing an infinite loop whenever 'max' is not a multiple of WORD_SZ. This can be reproduced e.g. by running: kcapi-rng -b 67 >/dev/null There are many ways to fix this without adding back the 'break', but they all seem more awkward than simply adding it back, so do just that. Tested on a machine with Qualcomm Amberwing processor. Fixes: a680b18 ("crypto: qcom-rng - ensure buffer for generate is completely filled") Cc: [email protected] Signed-off-by: Ondrej Mosnacek <[email protected]> Reviewed-by: Brian Masney <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 3123109 commit 1628739

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/crypto/qcom-rng.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ static int qcom_rng_read(struct qcom_rng *rng, u8 *data, unsigned int max)
6565
} else {
6666
/* copy only remaining bytes */
6767
memcpy(data, &val, max - currsize);
68+
break;
6869
}
6970
} while (currsize < max);
7071

0 commit comments

Comments
 (0)