libblockdev/0001-lvm-dbus-Show-better-error-for-invalid-LVM-IDs.patch
Vojtech Trefny 4ff3714ca7 lvm-dbus: Show better error for invalid LVM IDs
Resolves: RHEL-123039
2025-10-30 13:26:23 +01:00

31 lines
1.1 KiB
Diff

From a0b00c01a4b55a5f19608767ea452046cd7732c4 Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Tue, 21 Oct 2025 15:34:30 +0200
Subject: [PATCH] lvm-dbus: Show better error for invalid LVM IDs
LVM DBus uses assert to check for empty IDs so it produces error
which isn't easy to decipher.
Resolves: RHEL-123039
---
src/plugins/lvm/lvm-dbus.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/plugins/lvm/lvm-dbus.c b/src/plugins/lvm/lvm-dbus.c
index 197dcd12..877a72a5 100644
--- a/src/plugins/lvm/lvm-dbus.c
+++ b/src/plugins/lvm/lvm-dbus.c
@@ -924,6 +924,12 @@ static GVariant* get_lvm_object_properties (const gchar *obj_id, const gchar *if
GVariant *ret = NULL;
gchar *obj_path = NULL;
+ if (!obj_id || g_strcmp0 (obj_id, "") == 0) {
+ g_set_error (error, BD_LVM_ERROR, BD_LVM_ERROR_NOEXIST,
+ "Invalid LVM ID specified");
+ return NULL;
+ }
+
args = g_variant_new ("(s)", obj_id);
/* consumes (frees) the 'args' parameter */
ret = g_dbus_connection_call_sync (bus, LVM_BUS_NAME, MANAGER_OBJ, MANAGER_INTF,