]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
dm-verity: fix unreliable memory allocation
authorMikulas Patocka <mpatocka@redhat.com>
Mon, 17 Nov 2025 20:42:02 +0000 (21:42 +0100)
committerMikulas Patocka <mpatocka@redhat.com>
Fri, 21 Nov 2025 11:51:41 +0000 (12:51 +0100)
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 <mpatocka@redhat.com>
Cc: stable@vger.kernel.org
Reviewed-by: Eric Biggers <ebiggers@kernel.org>
drivers/md/dm-verity-fec.c

index d382a390d39ab8e827bae086a46a5e278cbc70ec..72047b47a7a0a3cbdb5c0f5a4fcfa38b7bc05ec3 100644 (file)
@@ -320,11 +320,7 @@ static int fec_alloc_bufs(struct dm_verity *v, struct dm_verity_fec_io *fio)
                if (fio->bufs[n])
                        continue;
 
-               fio->bufs[n] = mempool_alloc(&v->fec->prealloc_pool, GFP_NOWAIT);
-               if (unlikely(!fio->bufs[n])) {
-                       DMERR("failed to allocate FEC buffer");
-                       return -ENOMEM;
-               }
+               fio->bufs[n] = mempool_alloc(&v->fec->prealloc_pool, GFP_NOIO);
        }
 
        /* try to allocate the maximum number of buffers */