Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
74a6ef7
lvm: Fix buffer overrun in _vgcfgbackup_restore
vojtechtrefny Mar 10, 2026
a613b6b
lvm-dbus: Fix duplicate feature index for VDO and writecache
vojtechtrefny Mar 10, 2026
cac5f0f
lvm-dbus: Fix NULL dereferences on failed D-Bus calls
vojtechtrefny Mar 10, 2026
4829a23
lvm: Route pvmove through call_lvm_and_report_progress
vojtechtrefny Mar 10, 2026
776cc40
lvm-dbus: Free and copy data_lvs, metadata_lvs, and segs in LVdata
vojtechtrefny Mar 10, 2026
d9be439
crypto: Add BD_CRYPTO_TECH_MODE_MODIFY to LUKS supported modes
vojtechtrefny Mar 10, 2026
55b0999
fs: Guard against division by zero in f2fs and xfs resize
vojtechtrefny Mar 10, 2026
5a32a96
dm: Move sys_path construction after NULL check in bd_dm_name_from_node
vojtechtrefny Mar 10, 2026
81997d5
python: Fix exact exception type matching in ErrorProxy
vojtechtrefny Mar 10, 2026
b78e96b
crypto: Check ioctl return value when getting entropy level
vojtechtrefny Mar 10, 2026
b3a6f7c
utils: Fix memory leak of args in exec error paths
vojtechtrefny Mar 10, 2026
65ea3cd
utils: Check WIFEXITED before calling WEXITSTATUS in exec
vojtechtrefny Mar 10, 2026
a939b23
fs: Close pipe fds on fork failure in run_as_user
vojtechtrefny Mar 10, 2026
c4010b7
utils: Close fds and reap child on stdin write failure
vojtechtrefny Mar 10, 2026
15fa75a
lvm: Copy missing fields in pvdata and vgdata copy functions
vojtechtrefny Mar 10, 2026
c8217f4
lvm-dbus: Fix multiple memory leaks
vojtechtrefny Mar 10, 2026
40e508a
tests: Fix device path check in clean_scsi_debug
vojtechtrefny Mar 10, 2026
fa68c6d
s390: Close file descriptor on fputs failure in bd_s390_zfcp_offline
vojtechtrefny Mar 10, 2026
26354dc
part: Add lower bound check in get_part_num backward scan
vojtechtrefny Mar 10, 2026
e6cdbb3
blockdev: Use zero-initializer for plugins_sonames array
vojtechtrefny Mar 10, 2026
5a7802c
crypto: Add missing crypt_free(cd) on error paths
vojtechtrefny Mar 10, 2026
215491a
lvm-dbus: Add NULL checks after get_object_property in get_lv_data_fr…
vojtechtrefny Mar 10, 2026
c6c41c5
nvdimm: Add missing ndctl_unref on error paths
vojtechtrefny Mar 10, 2026
1792658
fs: Remove unreachable code in bd_fs_unmount and bd_fs_mount
vojtechtrefny Mar 10, 2026
a667339
lvm: Move data copy and free functions to lvm-common.c
vojtechtrefny Mar 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/lib/blockdev.c.in
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,7 @@ static gboolean load_plugins (BDPluginSpec **require_plugins, gboolean reload, g
gboolean requested_loaded = TRUE;
GError *error = NULL;
GSequence *config_files = NULL;
GSList *plugins_sonames[BD_PLUGIN_UNDEF] = {NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL,
NULL, NULL};
GSList *plugins_sonames[BD_PLUGIN_UNDEF] = {0};
BDPlugin plugin_name = BD_PLUGIN_UNDEF;
guint64 required_plugins_mask = 0;

Expand Down
35 changes: 31 additions & 4 deletions src/plugins/crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,10 +381,10 @@ gboolean bd_crypto_is_tech_avail (BDCryptoTech tech, guint64 mode, GError **erro
case BD_CRYPTO_TECH_LUKS:
ret = mode & (BD_CRYPTO_TECH_MODE_CREATE|BD_CRYPTO_TECH_MODE_OPEN_CLOSE|BD_CRYPTO_TECH_MODE_QUERY|
BD_CRYPTO_TECH_MODE_ADD_KEY|BD_CRYPTO_TECH_MODE_REMOVE_KEY|BD_CRYPTO_TECH_MODE_RESIZE|
BD_CRYPTO_TECH_MODE_SUSPEND_RESUME|BD_CRYPTO_TECH_MODE_BACKUP_RESTORE);
BD_CRYPTO_TECH_MODE_SUSPEND_RESUME|BD_CRYPTO_TECH_MODE_BACKUP_RESTORE|BD_CRYPTO_TECH_MODE_MODIFY);
if (ret != mode) {
g_set_error_literal (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_TECH_UNAVAIL,
"Only 'create', 'open', 'query', 'add-key', 'remove-key', 'resize', 'suspend-resume', 'backup-restore' supported for LUKS");
"Only 'create', 'open', 'query', 'add-key', 'remove-key', 'resize', 'suspend-resume', 'backup-restore', 'modify' supported for LUKS");
return FALSE;
} else
return TRUE;
Expand Down Expand Up @@ -1023,11 +1023,31 @@ gboolean _crypto_luks_format (const gchar *device,
if (min_entropy > 0) {
dev_random_fd = open ("/dev/random", O_RDONLY);
if (dev_random_fd >= 0) {
ioctl (dev_random_fd, RNDGETENTCNT, &current_entropy);
if (ioctl (dev_random_fd, RNDGETENTCNT, &current_entropy) < 0) {
g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_FORMAT_FAILED,
"Failed to get random data entropy level: %s",
strerror_l (errno, c_locale));
close (dev_random_fd);
crypt_free (cd);
g_strfreev (cipher_specs);
bd_utils_report_finished (progress_id, l_error->message);
g_propagate_error (error, l_error);
return FALSE;
}
while (current_entropy < min_entropy) {
bd_utils_report_progress (progress_id, 0, "Waiting for enough random data entropy");
sleep (1);
ioctl (dev_random_fd, RNDGETENTCNT, &current_entropy);
if (ioctl (dev_random_fd, RNDGETENTCNT, &current_entropy) < 0) {
g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_FORMAT_FAILED,
"Failed to get random data entropy level: %s",
strerror_l (errno, c_locale));
close (dev_random_fd);
crypt_free (cd);
g_strfreev (cipher_specs);
bd_utils_report_finished (progress_id, l_error->message);
g_propagate_error (error, l_error);
return FALSE;
}
}
close (dev_random_fd);
} else {
Expand Down Expand Up @@ -1422,6 +1442,7 @@ static gboolean _crypto_close (const gchar *device, const gchar *tech_name, GErr
if (ret != 0) {
g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_DEVICE,
"Failed to initialize device: %s", strerror_l (-ret, c_locale));
crypt_free (cd);
bd_utils_report_finished (progress_id, l_error->message);
g_propagate_error (error, l_error);
return FALSE;
Expand Down Expand Up @@ -1828,6 +1849,7 @@ gboolean bd_crypto_luks_resize (const gchar *luks_device, guint64 size, BDCrypto
if (ret != 0) {
g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_DEVICE,
"Failed to initialize device: %s", strerror_l (-ret, c_locale));
crypt_free (cd);
bd_utils_report_finished (progress_id, l_error->message);
g_propagate_error (error, l_error);
return FALSE;
Expand Down Expand Up @@ -1937,6 +1959,7 @@ gboolean bd_crypto_luks_suspend (const gchar *luks_device, GError **error) {
if (ret != 0) {
g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_DEVICE,
"Failed to initialize device: %s", strerror_l (-ret, c_locale));
crypt_free (cd);
bd_utils_report_finished (progress_id, l_error->message);
g_propagate_error (error, l_error);
return FALSE;
Expand Down Expand Up @@ -1986,6 +2009,7 @@ gboolean bd_crypto_luks_resume (const gchar *luks_device, BDCryptoKeyslotContext
if (ret != 0) {
g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_DEVICE,
"Failed to initialize device: %s", strerror_l (-ret, c_locale));
crypt_free (cd);
bd_utils_report_finished (progress_id, l_error->message);
g_propagate_error (error, l_error);
return FALSE;
Expand Down Expand Up @@ -2587,6 +2611,7 @@ BDCryptoLUKSInfo* bd_crypto_luks_info (const gchar *device, GError **error) {
if (ret != 0) {
g_set_error (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_DEVICE,
"Failed to initialize device: %s", strerror_l (-ret, c_locale));
crypt_free (cd);
return NULL;
}

Expand Down Expand Up @@ -2742,6 +2767,7 @@ BDCryptoIntegrityInfo* bd_crypto_integrity_info (const gchar *device, GError **e
if (ret != 0) {
g_set_error (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_DEVICE,
"Failed to initialize device: %s", strerror_l (-ret, c_locale));
crypt_free (cd);
return NULL;
}

Expand Down Expand Up @@ -2811,6 +2837,7 @@ BDCryptoLUKSTokenInfo** bd_crypto_luks_token_info (const gchar *device, GError *
if (ret != 0) {
g_set_error (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_DEVICE,
"Failed to initialize device: %s", strerror_l (-ret, c_locale));
crypt_free (cd);
return NULL;
}

Expand Down
4 changes: 3 additions & 1 deletion src/plugins/dm.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,16 @@ gboolean bd_dm_remove (const gchar *map_name, GError **error) {
gchar* bd_dm_name_from_node (const gchar *dm_node, GError **error) {
gchar *ret = NULL;
gboolean success = FALSE;
g_autofree gchar *sys_path = g_strdup_printf ("/sys/class/block/%s/dm/name", dm_node);
g_autofree gchar *sys_path = NULL;

if (!dm_node || strlen (dm_node) == 0) {
g_set_error_literal (error, BD_DM_ERROR, BD_DM_ERROR_DEVICE_NOEXIST,
"No DM node specified");
return NULL;
}

sys_path = g_strdup_printf ("/sys/class/block/%s/dm/name", dm_node);

if (access (sys_path, R_OK) != 0) {
g_set_error_literal (error, BD_DM_ERROR, BD_DM_ERROR_SYS,
"Failed to access dm node's parameters under /sys");
Expand Down
18 changes: 17 additions & 1 deletion src/plugins/fs/generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -820,9 +820,18 @@ static gboolean xfs_resize_device (const gchar *device, guint64 new_size, const
return FALSE;
}

if (xfs_info->block_size == 0) {
g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_FAIL,
"Failed to get block size for device '%s'", device);
bd_fs_xfs_info_free (xfs_info);
return FALSE;
}

mountpoint = fs_mount (device, "xfs", FALSE, &unmount, error);
if (!mountpoint)
if (!mountpoint) {
bd_fs_xfs_info_free (xfs_info);
return FALSE;
}

new_size = (new_size + xfs_info->block_size - 1) / xfs_info->block_size;
bd_fs_xfs_info_free (xfs_info);
Expand Down Expand Up @@ -857,6 +866,13 @@ static gboolean f2fs_resize_device (const gchar *device, guint64 new_size, GErro
return FALSE;
}

if (info->sector_size == 0) {
g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_FAIL,
"Failed to get sector size for device '%s'", device);
bd_fs_f2fs_info_free (info);
return FALSE;
}

/* round to nearest sector_size multiple */
new_size = (new_size + info->sector_size - 1) / info->sector_size;

Expand Down
6 changes: 2 additions & 4 deletions src/plugins/fs/mount.c
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,8 @@ static gboolean run_as_user (MountFunc func, MountArgs *args, uid_t run_as_uid,
pid = fork ();

if (pid == -1) {
close (pipefd[0]);
close (pipefd[1]);
g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_FAIL,
"Error forking.");
return FALSE;
Expand Down Expand Up @@ -694,8 +696,6 @@ gboolean bd_fs_unmount (const gchar *spec, gboolean lazy, gboolean force, const
return ret;
} else
return do_unmount (&args, error);

return TRUE;
}

/**
Expand Down Expand Up @@ -777,8 +777,6 @@ gboolean bd_fs_mount (const gchar *device, const gchar *mountpoint, const gchar
return ret;
} else
return do_mount (&args, error);

return TRUE;
}

/**
Expand Down
Loading