lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date: Mon, 26 Feb 2024 06:41:35 -0800
From: Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com>
To: Matthew Sakai <msakai@...hat.com>, dm-devel@...ts.linux.dev,
        Mike Snitzer <snitzer@...nel.org>, Ken Raeburn <raeburn@...hat.com>,
        Chung Chung <cchung@...hat.com>, Thomas Jaskiewicz <tom@...kiewicz.us>,
        Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com>,
        John Wiele <jwiele@...hat.com>,
        "J. corwin Coburn" <corwin@...lbutnet.net>,
        linux-kernel@...r.kernel.org
Cc: kernel-janitors@...r.kernel.org, dan.carpenter@...aro.org
Subject: [PATCH] dm vdo: Fix a use-after-free in load_index_save()

Smatch warns:
	drivers/md/dm-vdo/indexer/index-layout.c:1570
	load_index_save() warn: 'table' was already freed.

Store the error value in result and then free the table before
returning.

Fixes: b46d79bdb82a ("dm vdo: add deduplication index storage interface")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com>
---
This is based on static analysis and only compile tested.
---
 drivers/md/dm-vdo/indexer/index-layout.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/md/dm-vdo/indexer/index-layout.c b/drivers/md/dm-vdo/indexer/index-layout.c
index 1453fddaa656..18fac999e3e4 100644
--- a/drivers/md/dm-vdo/indexer/index-layout.c
+++ b/drivers/md/dm-vdo/indexer/index-layout.c
@@ -1566,10 +1566,11 @@ static int __must_check load_index_save(struct index_save_layout *isl,
 
 
 	if (table->header.type != RH_TYPE_SAVE) {
+		result = vdo_log_error_strerror(UDS_CORRUPT_DATA,
+						"unexpected index save %u header type %u",
+						instance, table->header.type);
 		vdo_free(table);
-		return vdo_log_error_strerror(UDS_CORRUPT_DATA,
-					      "unexpected index save %u header type %u",
-					      instance, table->header.type);
+		return result;
 	}
 
 	result = read_index_save_data(reader, isl, table->header.payload);
-- 
2.39.3


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ