lvm-dbus: Show better error for invalid LVM IDs

Resolves: RHEL-123039
This commit is contained in:
Vojtech Trefny 2025-10-30 13:25:43 +01:00
parent 465e0968b9
commit 4ff3714ca7
2 changed files with 37 additions and 1 deletions

View File

@ -0,0 +1,30 @@
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,

View File

@ -86,12 +86,14 @@
Name: libblockdev
Version: 3.4.0
Release: 1%{?dist}
Release: 2%{?dist}
Summary: A library for low-level manipulation with block devices
License: LGPL-2.1-or-later
URL: https://github.com/storaged-project/libblockdev
Source0: https://github.com/storaged-project/libblockdev/releases/download/%{version}/%{name}-%{version}.tar.gz
Patch0: 0001-lvm-dbus-Show-better-error-for-invalid-LVM-IDs.patch
BuildRequires: make
BuildRequires: glib2-devel
%if %{with_gi}
@ -946,6 +948,10 @@ find %{buildroot} -type f -name "*.la" | xargs %{__rm}
%files plugins-all
%changelog
* Thu Oct 30 2025 Vojtech Trefny <vtrefny@redhat.com> - 3.4.0-2
- lvm-dbus: Show better error for invalid LVM IDs
Resolves: RHEL-123039
* Thu Sep 25 2025 Vojtech Trefny <vtrefny@redhat.com> - 3.4.0-1
- Update to 3.4.0
Resolves: RHEL-114971