mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 05:55:44 +02:00
crypto: ccree - don't attempt 0 len DMA mappings
[ Upstream commit1fb37b5692] Refuse to try mapping zero bytes as this may cause a fault on some configurations / platforms and it seems the prev. attempt is not enough and we need to be more explicit. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Reported-by: Corentin Labbe <clabbe.montjoie@gmail.com> Fixes:ce0fc6db38("crypto: ccree - protect against empty or NULL scatterlists") Tested-by: Corentin Labbe <clabbe.montjoie@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
d788ad472f
commit
55259cb374
|
|
@ -258,6 +258,13 @@ static int cc_map_sg(struct device *dev, struct scatterlist *sg,
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
if (!nbytes) {
|
||||||
|
*mapped_nents = 0;
|
||||||
|
*lbytes = 0;
|
||||||
|
*nents = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
*nents = cc_get_sgl_nents(dev, sg, nbytes, lbytes);
|
*nents = cc_get_sgl_nents(dev, sg, nbytes, lbytes);
|
||||||
if (*nents > max_sg_nents) {
|
if (*nents > max_sg_nents) {
|
||||||
*nents = 0;
|
*nents = 0;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user