Skip to content

Commit a85f1a9

Browse files
DemiMarieMike Snitzer
authored andcommitted
dm ioctl: Refuse to create device named "control"
Typical userspace setups create a symlink under /dev/mapper with the name of the device, but /dev/mapper/control is reserved for DM's control device. Therefore, trying to create such a device is almost certain to be a userspace bug. Signed-off-by: Demi Marie Obenour <[email protected]> Signed-off-by: Mike Snitzer <[email protected]>
1 parent 249bed8 commit a85f1a9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/md/dm-ioctl.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,12 @@ static int get_target_version(struct file *filp, struct dm_ioctl *param, size_t
767767
static int check_name(const char *name)
768768
{
769769
if (strchr(name, '/')) {
770-
DMERR("invalid device name");
770+
DMERR("device name cannot contain '/'");
771+
return -EINVAL;
772+
}
773+
774+
if (strcmp(name, DM_CONTROL_NODE) == 0) {
775+
DMERR("device name cannot be \"%s\"", DM_CONTROL_NODE);
771776
return -EINVAL;
772777
}
773778

0 commit comments

Comments
 (0)