Commit fe680d8c authored by Mikulas Patocka's avatar Mikulas Patocka
Browse files

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: default avatarMikulas Patocka <mpatocka@redhat.com>
Cc: stable@vger.kernel.org
Reviewed-by: default avatarEric Biggers <ebiggers@kernel.org>
parent a612d24e
Loading
Loading
Loading
Loading
+1 −5
Original line number Diff line number Diff line
@@ -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 */