anitazha / rpms / systemd

Forked from rpms/systemd 3 years ago
Clone

Blame SOURCES/0374-udev-path_id-correct-segmentation-fault-due-to-missi.patch

1abbee
From fb9a50a0ad64f28c00c7d0bbc4ee8908d4233593 Mon Sep 17 00:00:00 2001
1abbee
From: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
1abbee
Date: Fri, 19 Feb 2016 15:21:18 +0100
1abbee
Subject: [PATCH] udev/path_id: correct segmentation fault due to missing NULL
1abbee
 check
1abbee
1abbee
Running "udevadm test-builtin path_id /sys/devices/platform/" results
1abbee
in a segmentation fault.
1abbee
1abbee
The problem is that udev_device_get_subsystem(dev) might return NULL
1abbee
in a streq() call.  Solve this problem by using streq_ptr() instead.
1abbee
1abbee
Cherry-picked from: 5181ab917d6407cb57043e98955f0de1614366ea
1abbee
Resolves: #1365556
1abbee
---
1abbee
 src/udev/udev-builtin-path_id.c | 2 +-
1abbee
 1 file changed, 1 insertion(+), 1 deletion(-)
1abbee
1abbee
diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c
181b3f
index 8359e236a..a3b019bfc 100644
1abbee
--- a/src/udev/udev-builtin-path_id.c
1abbee
+++ b/src/udev/udev-builtin-path_id.c
1abbee
@@ -729,7 +729,7 @@ restart:
1abbee
          * devices do not expose their buses and do not provide a unique
1abbee
          * and predictable name that way.
1abbee
          */
1abbee
-        if (streq(udev_device_get_subsystem(dev), "block") && !supported_transport) {
1abbee
+        if (streq_ptr(udev_device_get_subsystem(dev), "block") && !supported_transport) {
1abbee
                 free(path);
1abbee
                 path = NULL;
1abbee
         }