!49 修复空指针导致coredump的问题
From: @cenhuilin Reviewed-by: @swf504 Signed-off-by: @swf504
This commit is contained in:
commit
d78b6bd1de
75
0004-udisksctl-Guard-object-lookup.patch
Normal file
75
0004-udisksctl-Guard-object-lookup.patch
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
From ad83cfb26c2dd8d4532a634e105baaee76441c8f Mon Sep 17 00:00:00 2001
|
||||||
|
From: Tomas Bzatek <tbzatek@redhat.com>
|
||||||
|
Date: Mon, 3 Jun 2024 17:50:38 +0800
|
||||||
|
Subject: [PATCH] udisksctl: Guard object lookup
|
||||||
|
|
||||||
|
Added extra checks for object validity when looking up physical
|
||||||
|
device through a drive. Reproducible e.g. by calling 'power-off'
|
||||||
|
over a LUKS container.
|
||||||
|
---
|
||||||
|
tools/udisksctl.c | 26 ++++++++++++++++++++++++++
|
||||||
|
1 file changed, 26 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/tools/udisksctl.c b/tools/udisksctl.c
|
||||||
|
index 3b0a48e..c020879 100644
|
||||||
|
--- a/tools/udisksctl.c
|
||||||
|
+++ b/tools/udisksctl.c
|
||||||
|
@@ -2002,6 +2002,7 @@ handle_command_smart_simulate (gint *argc,
|
||||||
|
{
|
||||||
|
UDisksObject *block_object;
|
||||||
|
UDisksDrive *drive;
|
||||||
|
+
|
||||||
|
block_object = lookup_object_by_device (opt_smart_simulate_device);
|
||||||
|
if (block_object == NULL)
|
||||||
|
{
|
||||||
|
@@ -2009,7 +2010,19 @@ handle_command_smart_simulate (gint *argc,
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
drive = udisks_client_get_drive_for_block (client, udisks_object_peek_block (block_object));
|
||||||
|
+ if (drive == NULL)
|
||||||
|
+ {
|
||||||
|
+ g_printerr ("Error looking up drive for device %s\n", opt_smart_simulate_device);
|
||||||
|
+ g_object_unref (block_object);
|
||||||
|
+ goto out;
|
||||||
|
+ }
|
||||||
|
object = (UDisksObject *) g_dbus_interface_dup_object (G_DBUS_INTERFACE (drive));
|
||||||
|
+ if (object == NULL)
|
||||||
|
+ {
|
||||||
|
+ g_printerr ("Error looking up object for device %s\n", opt_smart_simulate_device);
|
||||||
|
+ g_object_unref (block_object);
|
||||||
|
+ goto out;
|
||||||
|
+ }
|
||||||
|
g_object_unref (block_object);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
@@ -2243,6 +2256,7 @@ handle_command_power_off (gint *argc,
|
||||||
|
{
|
||||||
|
UDisksObject *block_object;
|
||||||
|
UDisksDrive *drive;
|
||||||
|
+
|
||||||
|
block_object = lookup_object_by_device (opt_power_off_device);
|
||||||
|
if (block_object == NULL)
|
||||||
|
{
|
||||||
|
@@ -2250,7 +2264,19 @@ handle_command_power_off (gint *argc,
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
drive = udisks_client_get_drive_for_block (client, udisks_object_peek_block (block_object));
|
||||||
|
+ if (drive == NULL)
|
||||||
|
+ {
|
||||||
|
+ g_printerr ("Error looking up drive for device %s\n", opt_power_off_device);
|
||||||
|
+ g_object_unref (block_object);
|
||||||
|
+ goto out;
|
||||||
|
+ }
|
||||||
|
object = (UDisksObject *) g_dbus_interface_dup_object (G_DBUS_INTERFACE (drive));
|
||||||
|
+ if (object == NULL)
|
||||||
|
+ {
|
||||||
|
+ g_printerr ("Error looking up object for device %s\n", opt_power_off_device);
|
||||||
|
+ g_object_unref (block_object);
|
||||||
|
+ goto out;
|
||||||
|
+ }
|
||||||
|
g_object_unref (block_object);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
@ -59,7 +59,7 @@
|
|||||||
Name: udisks2
|
Name: udisks2
|
||||||
Summary: Disk Manager
|
Summary: Disk Manager
|
||||||
Version: 2.9.0
|
Version: 2.9.0
|
||||||
Release: 5
|
Release: 6
|
||||||
License: GPL-2.0+ and LGPL-2.0+
|
License: GPL-2.0+ and LGPL-2.0+
|
||||||
Group: System Environment/Libraries
|
Group: System Environment/Libraries
|
||||||
URL: https://github.com/storaged-project/udisks
|
URL: https://github.com/storaged-project/udisks
|
||||||
@ -68,6 +68,7 @@ Source0: https://github.com/storaged-project/udisks/releases/download/udisks-%{v
|
|||||||
Patch1: 0001-udiskslinuxmountoptions-Prevent-a-memory-leak.patch
|
Patch1: 0001-udiskslinuxmountoptions-Prevent-a-memory-leak.patch
|
||||||
Patch2: 0002-CVE-2021-3802.patch
|
Patch2: 0002-CVE-2021-3802.patch
|
||||||
Patch3: 0003-udiskslinuxmountoptions-Do-not-free-static-daemon-resources.patch
|
Patch3: 0003-udiskslinuxmountoptions-Do-not-free-static-daemon-resources.patch
|
||||||
|
Patch4: 0004-udisksctl-Guard-object-lookup.patch
|
||||||
|
|
||||||
BuildRequires: glib2-devel >= %{glib2_version}
|
BuildRequires: glib2-devel >= %{glib2_version}
|
||||||
BuildRequires: gobject-introspection-devel >= %{gobject_introspection_version}
|
BuildRequires: gobject-introspection-devel >= %{gobject_introspection_version}
|
||||||
@ -439,6 +440,9 @@ udevadm trigger
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Jun 03 2024 cenhuilin <cenhuilin@kylinos.cn> - 2.9.0-6
|
||||||
|
- udisksctl: Guard object lookup
|
||||||
|
|
||||||
* Wed Feb 22 2023 miaoguanqin <miaoguanqin@huawei.com> - 2.9.0-5
|
* Wed Feb 22 2023 miaoguanqin <miaoguanqin@huawei.com> - 2.9.0-5
|
||||||
- fix coredump with stop udisks2
|
- fix coredump with stop udisks2
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user