public inbox for dm-devel@redhat.com
 help / color / mirror / Atom feed
* [PATCH] dm-verity: fix unreliable memory allocation
@ 2025-11-17 20:42 Mikulas Patocka
  2025-11-21  1:46 ` Eric Biggers
  0 siblings, 1 reply; 2+ messages in thread
From: Mikulas Patocka @ 2025-11-17 20:42 UTC (permalink / raw)
  To: Sami Tolvanen, Alasdair Kergon, Mike Snitzer
  Cc: dm-devel, Ondrej Kozina, Milan Broz

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

---
 drivers/md/dm-verity-fec.c |    6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Index: linux-2.6/drivers/md/dm-verity-fec.c
===================================================================
--- linux-2.6.orig/drivers/md/dm-verity-fec.c	2025-11-15 15:59:23.000000000 +0100
+++ linux-2.6/drivers/md/dm-verity-fec.c	2025-11-15 16:01:23.000000000 +0100
@@ -320,11 +320,7 @@ static int fec_alloc_bufs(struct dm_veri
 		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 */


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-11-21  1:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-17 20:42 [PATCH] dm-verity: fix unreliable memory allocation Mikulas Patocka
2025-11-21  1:46 ` Eric Biggers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox