Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15:Update
parted
libparted-fix-udev-cookie-leak.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File libparted-fix-udev-cookie-leak.patch of Package parted
From: "Brian C. Lane" <bcl@redhat.com> Date: Thu, 25 May 2017 09:42:23 -0700 Subject: libparted: Fix udev cookie leak in _dm_resize_partition References: bsc#1058667 Patch-mainline: v3.3 Git-commit: e7870afe3c13dcc77845d48409daa35e3e42b5fb The function is setting udev cookies, but not using them when waiting for the task. This results in leaked cookies, which can eventually exhaust the available number of semaphores. 'dmsetup udevcookies' will show a cookie remaining afterwards, and 'ipcs -s' will show the semaphores in use. Also simplified the exit so that the task is always destroyed and memory is all freed in the same path. Resolves: rhbz#1455564 Acked-by: Sebastian Parschauer <sparschauer@suse.de> --- libparted/arch/linux.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) --- a/libparted/arch/linux.c +++ b/libparted/arch/linux.c @@ -2964,6 +2964,7 @@ _dm_resize_partition (PedDisk* disk, con char* vol_name = NULL; const char* dev_name = NULL; uint32_t cookie = 0; + int rc = 0; /* Get map name from devicemapper */ struct dm_task *task = dm_task_create (DM_DEVICE_INFO); @@ -3004,8 +3005,9 @@ _dm_resize_partition (PedDisk* disk, con /* device-mapper uses 512b units, not the device's sector size */ dm_task_add_target (task, 0, part->geom.length * (disk->dev->sector_size / PED_SECTOR_SIZE_DEFAULT), "linear", params); - if (!dm_task_set_cookie (task, &cookie, 0)) - goto err; + /* NOTE: DM_DEVICE_RELOAD doesn't generate udev events, so no cookie is needed (it will freeze). + * DM_DEVICE_RESUME does, so get a cookie and synchronize with udev. + */ if (dm_task_run (task)) { dm_task_destroy (task); task = dm_task_create (DM_DEVICE_RESUME); @@ -3014,10 +3016,8 @@ _dm_resize_partition (PedDisk* disk, con dm_task_set_name (task, vol_name); if (!dm_task_set_cookie (task, &cookie, 0)) goto err; - if (dm_task_run (task)) { - free (params); - free (vol_name); - return 1; + if (_dm_task_run_wait (task, cookie)) { + rc = 1; } } err: @@ -3026,7 +3026,7 @@ err: dm_task_destroy (task); free (params); free (vol_name); - return 0; + return rc; } #endif
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor