From nobody Sun Feb 8 21:28:04 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5540C77B7E for ; Thu, 1 Jun 2023 21:25:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231890AbjFAVZh (ORCPT ); Thu, 1 Jun 2023 17:25:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231600AbjFAVZX (ORCPT ); Thu, 1 Jun 2023 17:25:23 -0400 Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A4D5196 for ; Thu, 1 Jun 2023 14:25:22 -0700 (PDT) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id B76685C01DE; Thu, 1 Jun 2023 17:25:21 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Thu, 01 Jun 2023 17:25:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= invisiblethingslab.com; h=cc:cc:content-transfer-encoding :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm1; t=1685654721; x=1685741121; bh=ffgts7SPxx BHaUW6ToONfIVOqBLR5Qtq9BQQd24YCS0=; b=mFKpWD+bo1BnXnUNmn90TseJTH zB9LGzQOGIh2TdQeK8B4IUEUfDF0SktjtFEtA5ePrda1NpjZR/OWEegZq46Lc2Tx w9risN2HGDpnmYc0FyA5eRbK90QtjwceqjOTzLOBmnS8FnF2zVFRK4DHXMd7ogmG UaDAPC9L6iE5jRk6jbJqkMdISXqJ3p1Z5xQ5QbHrhAfAqK1TKi4xtoNKbY6ZTP/X PlHWYTzzhJmHy30vAlPWfRKK0lR7bPzTNe0v0ySH0lp7LqikNZJjRoqwlICptW75 YuI858CCZgLiAOACOjRT3+WnM1DjUUxW24JwIrEKW4mmcAV+0jsjm3hOxc/Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1685654721; x= 1685741121; bh=ffgts7SPxxBHaUW6ToONfIVOqBLR5Qtq9BQQd24YCS0=; b=D v1sD4nspvJagskYKVDs0ENPh6b8ojw+Ac8rHiSgpnl84ZrmcOX0ABHdxZKeqipFd O3xTLaS0oR9pkOiX+6xywMA19bL4h84r+KiB3I5H/W8KCvoBVl8yKh2+PdtmGUm5 TV5GbSRMChEqlOfoxStcaimCgk0LNFqDezwsrLD+g1J51Si/RONSDMAlvQS/Hqcj XUpUH1EvfgMnjPfkdXU5IIlpfNCarZJyz8DdCK6QmZvnWPodu/KW6i3NWJRD7vlF RhWNHYgOwNDsKkrskbgwLo4+lLypJvSTm0JLYsVxdgQRaR9uJvi0pr+gv7gSurQ/ bDectfKORAJ6kZ+qVuoSw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeeluddgudeitdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeffvghm ihcuofgrrhhivgcuqfgsvghnohhurhcuoeguvghmihesihhnvhhishhisghlvghthhhinh hgshhlrggsrdgtohhmqeenucggtffrrghtthgvrhhnpeejffejgffgueegudevvdejkefg hefghffhffejteekleeufeffteffhfdtudehteenucevlhhushhtvghrufhiiigvpedune curfgrrhgrmhepmhgrihhlfhhrohhmpeguvghmihesihhnvhhishhisghlvghthhhinhhg shhlrggsrdgtohhm X-ME-Proxy: Feedback-ID: iac594737:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 1 Jun 2023 17:25:21 -0400 (EDT) From: Demi Marie Obenour To: Alasdair Kergon , Mike Snitzer , dm-devel@redhat.com Cc: Demi Marie Obenour , linux-kernel@vger.kernel.org Subject: [PATCH 5/6] device-mapper: Refuse to create device named "control" Date: Thu, 1 Jun 2023 17:24:54 -0400 Message-Id: <20230601212456.1533-6-demi@invisiblethingslab.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230601212456.1533-1-demi@invisiblethingslab.com> References: <20230601212456.1533-1-demi@invisiblethingslab.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 --- 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 fd46b249f6f856c49752063fc49d720e95df0525..b12592bcb4b2b8513f5da6208fb= 545203534d7ff 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, struc= t 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) =3D=3D 0) { + DMERR("device name cannot be \"%s\"", DM_CONTROL_NODE); return -EINVAL; } =20 --=20 Sincerely, Demi Marie Obenour (she/her/hers) Invisible Things Lab