Skip to content

Commit fe680d8

Browse files
author
Mikulas Patocka
committed
dm-verity: fix unreliable memory allocation
GFP_NOWAIT allocation may fail anytime. It needs to be changed to GFP_NOIO. There's no need to handle an error because mempool_alloc with GFP_NOIO can't fail. Signed-off-by: Mikulas Patocka <[email protected]> Cc: [email protected] Reviewed-by: Eric Biggers <[email protected]>
1 parent a612d24 commit fe680d8

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

drivers/md/dm-verity-fec.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -320,11 +320,7 @@ static int fec_alloc_bufs(struct dm_verity *v, struct dm_verity_fec_io *fio)
320320
if (fio->bufs[n])
321321
continue;
322322

323-
fio->bufs[n] = mempool_alloc(&v->fec->prealloc_pool, GFP_NOWAIT);
324-
if (unlikely(!fio->bufs[n])) {
325-
DMERR("failed to allocate FEC buffer");
326-
return -ENOMEM;
327-
}
323+
fio->bufs[n] = mempool_alloc(&v->fec->prealloc_pool, GFP_NOIO);
328324
}
329325

330326
/* try to allocate the maximum number of buffers */

0 commit comments

Comments
 (0)