From: Mikulas Patocka Date: Mon, 10 Feb 2025 15:14:22 +0000 (+0100) Subject: dm-integrity: set ti->error on memory allocation failure X-Git-Tag: v5.10.237~198 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=14743860e81f8076c0372465482526abe3871b3b;p=thirdparty%2Fkernel%2Fstable.git dm-integrity: set ti->error on memory allocation failure commit 00204ae3d6712ee053353920e3ce2b00c35ef75b upstream. The dm-integrity target didn't set the error string when memory allocation failed. This patch fixes it. Signed-off-by: Mikulas Patocka Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c index 067be1d9f51cb..934887f8a855f 100644 --- a/drivers/md/dm-integrity.c +++ b/drivers/md/dm-integrity.c @@ -4303,16 +4303,19 @@ try_smaller_buffer: ic->recalc_bitmap = dm_integrity_alloc_page_list(n_bitmap_pages); if (!ic->recalc_bitmap) { + ti->error = "Could not allocate memory for bitmap"; r = -ENOMEM; goto bad; } ic->may_write_bitmap = dm_integrity_alloc_page_list(n_bitmap_pages); if (!ic->may_write_bitmap) { + ti->error = "Could not allocate memory for bitmap"; r = -ENOMEM; goto bad; } ic->bbs = kvmalloc_array(ic->n_bitmap_blocks, sizeof(struct bitmap_block_status), GFP_KERNEL); if (!ic->bbs) { + ti->error = "Could not allocate memory for bitmap"; r = -ENOMEM; goto bad; }