Skip to content

Commit 81ca2db

Browse files
DemiMarieMike Snitzer
authored andcommitted
dm ioctl: Refuse to create device named "." or ".."
Using either of these is going to greatly confuse userspace, as they are not valid symlink names and so creating the usual /dev/mapper/NAME symlink will not be possible. As creating a device with either of these names is almost certainly a userspace bug, just error out. Signed-off-by: Demi Marie Obenour <[email protected]> Signed-off-by: Mike Snitzer <[email protected]>
1 parent a85f1a9 commit 81ca2db

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/md/dm-ioctl.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -771,8 +771,10 @@ static int check_name(const char *name)
771771
return -EINVAL;
772772
}
773773

774-
if (strcmp(name, DM_CONTROL_NODE) == 0) {
775-
DMERR("device name cannot be \"%s\"", DM_CONTROL_NODE);
774+
if (strcmp(name, DM_CONTROL_NODE) == 0 ||
775+
strcmp(name, ".") == 0 ||
776+
strcmp(name, "..") == 0) {
777+
DMERR("device name cannot be \"%s\", \".\", or \"..\"", DM_CONTROL_NODE);
776778
return -EINVAL;
777779
}
778780

0 commit comments

Comments
 (0)