Skip to content

Commit 350cf79

Browse files
author
Zdenek Kabelac
committed
libdm: new name can't be empty
Do not allow passing '' names to kernel. This test was missing also in kernel, so it has allowed to create device with '' name. This then confused dmsetup tool, since such name is unexpected and unsupported. To remove such name from table, user has to use -j -m to specify which device should be removed. This patch fixes the posibility to run this operation: dmsetup rename existingdev '' after this operation commands like 'dmsetup table' are failing. This patch prohibits to use such name.
1 parent eee3aee commit 350cf79

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

WHATS_NEW_DM

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
Version 1.02.80 -
22
==================================
3+
Do not allow passing empty new name for dmsetup rename.
34
Display any output returned by 'dmsetup message'.
45
Add dm_task_get_message_response to libdevmapper.
56

libdm/libdm-common.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,11 @@ int dm_task_set_newname(struct dm_task *dmt, const char *newname)
698698
return 0;
699699
}
700700

701+
if (!*newname) {
702+
log_error("Non empty new name is required.");
703+
return 0;
704+
}
705+
701706
if (!check_multiple_mangled_string_allowed(newname, "new name", mangling_mode))
702707
return_0;
703708

0 commit comments

Comments
 (0)