From 39bcdd8d743b589afed6addc88e88c1f58739b1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Thu, 29 Apr 2021 10:40:39 +0200 Subject: [PATCH] libzutil: fix dm_get_underlying_path() return if not a DM device MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For example, this would happily return "/dev/(null)" for /dev/sda1 Reviewed-by: Tony Hutter Signed-off-by: Ahelenia ZiemiaƄska Closes #11935 --- lib/libzutil/os/linux/zutil_device_path_os.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libzutil/os/linux/zutil_device_path_os.c b/lib/libzutil/os/linux/zutil_device_path_os.c index 1775a45c60..da7ffba764 100644 --- a/lib/libzutil/os/linux/zutil_device_path_os.c +++ b/lib/libzutil/os/linux/zutil_device_path_os.c @@ -346,7 +346,7 @@ end: free(tmp); free(realp); - if (!path) { + if (!path && first_path) { /* * None of the underlying paths had a link back to their * enclosure devices. Throw up out hands and return the first