Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1356876rwd; Thu, 1 Jun 2023 14:27:50 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ67i0QEZBByRoEEfaOWsFpqgjF8TCQf4W7lwsKbwPtGUBNhhw74ozJccrAgapAmvhYl6jfG X-Received: by 2002:a92:d0c3:0:b0:33b:16e9:bba5 with SMTP id y3-20020a92d0c3000000b0033b16e9bba5mr6920358ila.28.1685654870374; Thu, 01 Jun 2023 14:27:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685654870; cv=none; d=google.com; s=arc-20160816; b=gFoyLwYoY/nUK/PM9wUFI435xSuEFFGZsUTymiqyqfoAgo15wEBxHFRQN+Bf/SPUMG 85L1CbMO2Ds/rG01tg2rk2Bj5kUy80AcvX9xMxhzeaZxl7Pv7z4lDSMlOA6UeeucWEZ+ emdNoSV7YWK0ASZopli1QOm0sYuv29+eRht5TxsmUEyu0wb52F2xOZvBhkOEmQfG+Kf2 gb/pKuMBofhrc77BPG9mZcGJ0JTTFlCeuflavqeVe/G1O1zKmsyyOSYUcs6JRq7vPMoq o70aIQ20tSSHsTJ2+uAi6IYyZq+iIl/Bm6ldkjJ+irCrSz2ZIl9qMgs3rme0j24kWB1c H+3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :feedback-id:dkim-signature:dkim-signature; bh=ffgts7SPxxBHaUW6ToONfIVOqBLR5Qtq9BQQd24YCS0=; b=PIqlZsulu0ZJs6yAHyRE98KVnQNCfuwcHKxu+5lUDHgJG6PT7GaPZFQ6JxhdHZXawO asQWgAhQmt5hflEMZ1cZ3SFUaEFA0gtlatGpmTPSFDtoslgg3zDEPXmaIP2CRjoPgWFh 3nD237YRVkr9nX9lUGwCtCcIgz7keSaWFYS9uygUU3W13MpnRj6EkrebcVNLk7j5Zwl1 b9urFxzYhLTlKLetoVhwauWvBiqi1qmIUODiejHjwRM9rAYtaYYpnEPTYTik3//mo6lc 4cIHV3uOtzMO10YllRZSUQJZZBseGXQcNeagKMPRRbioD+1gQIEZgGnc2oVrnvi/FTOx KSTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@invisiblethingslab.com header.s=fm1 header.b=mFKpWD+b; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=Dv1sD4ns; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e9-20020a636909000000b0050bd71e8618si783194pgc.848.2023.06.01.14.27.35; Thu, 01 Jun 2023 14:27:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@invisiblethingslab.com header.s=fm1 header.b=mFKpWD+b; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=Dv1sD4ns; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232042AbjFAVZf (ORCPT + 99 others); Thu, 1 Jun 2023 17:25:35 -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: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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..b12592bcb4b2b8513f5da6208fb545203534d7ff 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