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  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 25 Dec 2020 14:48:46 +0800
From:   Defang Bo <bodefang@....com>
To:     agk@...hat.com, snitzer@...hat.com
Cc:     linux-kernel@...r.kernel.org, Defang Bo <bodefang@....com>
Subject: [PATCH] dm snap : add sanity checks to snapshot_ctr

Similar to commit<70de2cbd>,there should be a check for argc and argv to prevent Null pointer dereferencing
when the dm_get_device invoked twice on the same device path with differnt mode.

Signed-off-by: Defang Bo <bodefang@....com>
---
 drivers/md/dm-snap.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index 4668b2c..dccce8b 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -1258,6 +1258,13 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 
 	as.argc = argc;
 	as.argv = argv;
+
+	if (!strcmp(argv[0], argv[1])) {
+		ti->error = "Error setting metadata or data device";
+		r = -EINVAL;
+		goto bad;
+	}
+
 	dm_consume_args(&as, 4);
 	r = parse_snapshot_features(&as, s, ti);
 	if (r)
-- 
2.7.4

Powered by blists - more mailing lists