From: Demi Marie Obenour <demi@invisiblethingslab.com>
To: Alasdair Kergon <agk@redhat.com>,
Mike Snitzer <snitzer@kernel.org>,
dm-devel@redhat.com
Cc: Demi Marie Obenour <demi@invisiblethingslab.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH v2 5/6] device-mapper: Refuse to create device named "control"
Date: Sat, 3 Jun 2023 10:52:43 -0400 [thread overview]
Message-ID: <20230603145244.1538-6-demi@invisiblethingslab.com> (raw)
In-Reply-To: <20230603145244.1538-1-demi@invisiblethingslab.com>
Typical userspace setups create a symlink under /dev/mapper with the
name of the device, but /dev/mapper/control is reserved for the 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>
---
drivers/md/dm-ioctl.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
index 7510afe237d979a5ee71afe87a20d49f631de1aa..5b647ab044e44b0c9d0961b5a336b41f50408f88 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;
}
--
Sincerely,
Demi Marie Obenour (she/her/hers)
Invisible Things Lab
next prev parent reply other threads:[~2023-06-03 14:53 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-01 21:24 [PATCH 0/6] Several device-mapper fixes Demi Marie Obenour
2023-06-01 21:24 ` [PATCH 1/6] device-mapper: Check that target specs are sufficiently aligned Demi Marie Obenour
2023-06-01 21:24 ` [PATCH 2/6] device-mapper: Avoid pointer arithmetic overflow Demi Marie Obenour
2023-06-01 21:24 ` [PATCH 3/6] device-mapper: structs and parameter strings must not overlap Demi Marie Obenour
2023-06-01 21:24 ` [PATCH 4/6] device-mapper: Avoid double-fetch of version Demi Marie Obenour
2023-06-03 7:40 ` kernel test robot
2023-06-03 14:21 ` Demi Marie Obenour
2023-06-01 21:24 ` [PATCH 5/6] device-mapper: Refuse to create device named "control" Demi Marie Obenour
2023-06-01 21:24 ` [PATCH 6/6] device-mapper: "." and ".." are not valid symlink names Demi Marie Obenour
2023-06-03 14:52 ` [PATCH v2 0/6] Several device-mapper fixes Demi Marie Obenour
2023-06-03 14:52 ` [PATCH v2 1/6] device-mapper: Check that target specs are sufficiently aligned Demi Marie Obenour
2023-06-22 16:28 ` Mike Snitzer
2023-06-22 19:51 ` Demi Marie Obenour
2023-06-22 22:54 ` Mike Snitzer
2023-06-22 17:29 ` [dm-devel] " Mikulas Patocka
2023-06-22 20:27 ` Demi Marie Obenour
2023-06-03 14:52 ` [PATCH v2 2/6] device-mapper: Avoid pointer arithmetic overflow Demi Marie Obenour
2023-06-22 17:30 ` [dm-devel] " Mikulas Patocka
2023-06-22 22:50 ` Mike Snitzer
2023-06-03 14:52 ` [PATCH v2 3/6] device-mapper: structs and parameter strings must not overlap Demi Marie Obenour
2023-06-22 17:31 ` [dm-devel] " Mikulas Patocka
2023-06-03 14:52 ` [PATCH v2 4/6] device-mapper: Avoid double-fetch of version Demi Marie Obenour
2023-06-22 16:20 ` Mike Snitzer
2023-06-22 18:43 ` Demi Marie Obenour
2023-06-03 14:52 ` Demi Marie Obenour [this message]
2023-06-03 14:52 ` [PATCH v2 6/6] device-mapper: "." and ".." are not valid symlink names Demi Marie Obenour
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230603145244.1538-6-demi@invisiblethingslab.com \
--to=demi@invisiblethingslab.com \
--cc=agk@redhat.com \
--cc=dm-devel@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=snitzer@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®