diff options
author | Demi Marie Obenour <demi@invisiblethingslab.com> | 2023-06-03 17:52:43 +0300 |
---|---|---|
committer | Mike Snitzer <snitzer@kernel.org> | 2023-06-23 17:31:51 +0300 |
commit | a85f1a9de91a59cd9b12d60f631cbda9c56a1c3c (patch) | |
tree | db34913f6f8dbc5cb2eb2712d6b2728507f7a72f /drivers/md | |
parent | 249bed821b4db6d95a99160f7d6d236ea5fe6362 (diff) | |
download | linux-a85f1a9de91a59cd9b12d60f631cbda9c56a1c3c.tar.xz |
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 <demi@invisiblethingslab.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/dm-ioctl.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c index bfaebc02833a..e172a91e88dc 100644 --- a/drivers/md/dm-ioctl.c +++ b/drivers/md/dm-ioctl.c @@ -767,7 +767,12 @@ static int get_target_version(struct file *filp, struct dm_ioctl *param, size_t static int check_name(const char *name) { if (strchr(name, '/')) { - DMERR("invalid device name"); + DMERR("device name cannot contain '/'"); + return -EINVAL; + } + + if (strcmp(name, DM_CONTROL_NODE) == 0) { + DMERR("device name cannot be \"%s\"", DM_CONTROL_NODE); return -EINVAL; } |