device-mapper-multipath/0103-libmultipath-fix-NULL-dereference-in-find_path_by_de.patch
Benjamin Marzinski b05147c356 device-mapper-multipath-0.8.5-6
Change patch format to remove Git version
  * Patches 0001-0122 only have the patch format modified
Update to the head of the upstream staging branch plus redhat patches
  * Patches 0123-0134 & 1036-0142 are from the upstream staging branch
  * Patches 0143-1046 have been submitted upstream
  * Patch 0156 is a Red Hat only patch. Red Hat udev rules set ID_SERIAL
    from 60-persistent-storage.rules instead of 55-scsi-sg3_id.rules.
    Multipath's parse_vpd_pg83() function needs to match the ID_SERIAL
    value from udev.
Rename files
  * Previous patches 0123-0132 are now patches 1035 & 0147-0155
2021-03-26 13:33:56 -05:00

44 lines
1.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: lixiaokeng <lixiaokeng@huawei.com>
Date: Sat, 23 Jan 2021 16:19:28 +0800
Subject: [PATCH] libmultipath: fix NULL dereference in find_path_by_dev
When I test the 0.8.5 code with iscsi login/out, multipathd command
and multipath command concurrently, there is a multipathd coredump.
The stack is shown:
uxlsnrloop
->cli_list_devices
->show_devices
->snprint_devices
->find_path_by_dev
The reason is that devname is NULL in snprint_devices, then it will
be dereference. Here we check dev in find_path_by_dev.
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/structs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libmultipath/structs.c b/libmultipath/structs.c
index 464596fc..a3f27fd6 100644
--- a/libmultipath/structs.c
+++ b/libmultipath/structs.c
@@ -453,12 +453,12 @@ find_mp_by_str (const struct _vector *mpvec, const char * str)
}
struct path *
-find_path_by_dev (const struct _vector *pathvec, const char * dev)
+find_path_by_dev (const struct _vector *pathvec, const char *dev)
{
int i;
struct path * pp;
- if (!pathvec)
+ if (!pathvec || !dev)
return NULL;
vector_foreach_slot (pathvec, pp, i)