Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp272879lqr; Wed, 5 Jun 2024 05:55:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXGkoJTRtkZnyikBR/cb4ZqZlrpV6hvIYIUvXHx1NKW237XAgpon1smwg+/duZfZb1nspgoliOc81u+KfntatuJRM/R0M3fmKv4JxC+RA== X-Google-Smtp-Source: AGHT+IHyVRsuULo4l26qEsRbseLd/pPhDg+CjEjV0W93qCw4VnNc8Zog+f2KAsTYzArj3lnndxbF X-Received: by 2002:a17:906:f9d7:b0:a68:e8a6:842e with SMTP id a640c23a62f3a-a699f68229emr171555566b.11.1717592111043; Wed, 05 Jun 2024 05:55:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717592111; cv=pass; d=google.com; s=arc-20160816; b=ZYx7TQO48XBxvsKa4PuCthL4KlWkeC04yJa2/H9tsDLw4aNZ3Grd+86if1MIWn2va2 ZI1XykwqteaCDz7wQo+f8Bri13IfiqPrUAofjA7N4zmOcpT9Uxc0lW0WhWofP0MZmE5C cW3XlDaKsNdcbJYnKfB1KX0xGkg5CIrehTLgtlGhe06FP91Sx9O3auvOzvR8SJs7Q9Qq Jz5MtWGO+NULgaWtU1tg5d7gTvAewPlm06kZz0V+87E4bEQyilZHcrltz2uQ84BITqY8 +hj42UJqpuGrkUFMwNN8LR9oyguQ5E7/XSV4UUTl0lgtimx48OUH5GuNRlXimv5SQ2Vg g7Hg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=JLV70xE5guqjEZM2K31BYMybmjyTRv8OSY0hXXKKXqk=; fh=no2D3E2HkF6we223b26kpootOGOgh+k0KjYu09ICWqI=; b=I3jiNCaebkWb0UVJiz36VypiIh812JXsFHjsuBj3M/yhUTI9xvRunTWWxb8pPhH5Db InkHDRDXpuA7JutdNTwS0zR1SKb3q+k8eAM2bF3jxxdat/a15xj29Yl939jrVGonJW/I UT4ehAuX0enjRTFGQ6RToPf+9oIdewvq8fVi4+hpsDP/GM2AnPDcUajiXj9EbyLjwX0u nX0Sm/d/cjySi1YDU6q+L3y0qMrFlreB3MtdkF96I5mierStiHSva8sA94pv08aFJ3Ny ldCaVJQb9+XOwRpoLCBrOiSVUDh1++SxTmrFPaOCb6nHBHsW93jVL1TKIn+Igjp7Jgaz 5uHQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=stmN3Oyx; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202550-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202550-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a68f654dca3si360500166b.77.2024.06.05.05.55.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 05:55:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202550-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=stmN3Oyx; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202550-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202550-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 5D3381F24A51 for ; Wed, 5 Jun 2024 12:54:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 29EDB1D24C4; Wed, 5 Jun 2024 12:06:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="stmN3Oyx" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 51EA61AC435; Wed, 5 Jun 2024 12:06:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717589173; cv=none; b=YBgupLtW3tYpj0ddB7adkuT2T0ULI+5+sOA58m/fuSEhRXN8CBxk51Iu3CPsV34yeEDBunpH9zTMNN1xwiV4SkzC7OT1MR6JU49Js0LirRFInurknoq48HfpcUIcU0zvVJLfu/ufWdCzCOsfaU8HIkPlWtNGjOSj9HRHP6O0Law= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717589173; c=relaxed/simple; bh=R29LqU2cniAUz/kGbg1F0YEvp5KIJWiG+IKrW2IFu+g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jubW8fYS1WkgLiLmzt0S+GTMmf2aO7twias3HzxueA0bVyo7FN5KXpxrVhXJeV2zdnmha1Mg78txihBGN5+p8BorMqsIjOeTWWdqqILhZ9crtVYow8M4WWMG/GYE3/zmitoDjnAN5cuuYW/ImT64wVmejkJ5zmvAFarUlxn7/e8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=stmN3Oyx; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18B3BC4AF07; Wed, 5 Jun 2024 12:06:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717589173; bh=R29LqU2cniAUz/kGbg1F0YEvp5KIJWiG+IKrW2IFu+g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=stmN3OyxfhGG2rxYCCtnmvpCKC3ZJIRAkTwyOCzxBCLmr3FhHcgRivLEwrgiuvGp7 AHHJZyS9QqDOdkiZCz99CMWstJ1MIMpck2Iu7s6qXaLo8DvoH9pMintTamGEaecKHk CnWQjs9JmB90vXGlYw13RUeV6zbmYeyd7w03GdZO3i5cJtZOmWmtSLphAT+gKMBSSr 9ke9fO+MPgDqgS+5k6YNqoCRp5ZNiV6F6FxsSRBONocOmG/q3aLF8W8triuY0vj/C0 s869/PLGr6mT4ap0A8N7LXxTBZC9e7NwH5WGle0eScVWwE5mTqrS2oVe9Jvkmdg9nN Yg4zN/ztGDPOw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Marc Dionne , Jan Henrik Sylvester , Markus Suvanto , David Howells , Jeffrey Altman , linux-afs@lists.infradead.org, Christian Brauner , Sasha Levin Subject: [PATCH AUTOSEL 5.4 2/2] afs: Don't cross .backup mountpoint from backup volume Date: Wed, 5 Jun 2024 08:06:09 -0400 Message-ID: <20240605120609.2968188-2-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240605120609.2968188-1-sashal@kernel.org> References: <20240605120609.2968188-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 5.4.277 Content-Transfer-Encoding: 8bit From: Marc Dionne [ Upstream commit 29be9100aca2915fab54b5693309bc42956542e5 ] Don't cross a mountpoint that explicitly specifies a backup volume (target is .backup) when starting from a backup volume. It it not uncommon to mount a volume's backup directly in the volume itself. This can cause tools that are not paying attention to get into a loop mounting the volume onto itself as they attempt to traverse the tree, leading to a variety of problems. This doesn't prevent the general case of loops in a sequence of mountpoints, but addresses a common special case in the same way as other afs clients. Reported-by: Jan Henrik Sylvester Link: http://lists.infradead.org/pipermail/linux-afs/2024-May/008454.html Reported-by: Markus Suvanto Link: http://lists.infradead.org/pipermail/linux-afs/2024-February/008074.html Signed-off-by: Marc Dionne Signed-off-by: David Howells Link: https://lore.kernel.org/r/768760.1716567475@warthog.procyon.org.uk Reviewed-by: Jeffrey Altman cc: linux-afs@lists.infradead.org Signed-off-by: Christian Brauner Signed-off-by: Sasha Levin --- fs/afs/mntpt.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/afs/mntpt.c b/fs/afs/mntpt.c index f105f061e89bb..eeb2b4b11e323 100644 --- a/fs/afs/mntpt.c +++ b/fs/afs/mntpt.c @@ -146,6 +146,11 @@ static int afs_mntpt_set_params(struct fs_context *fc, struct dentry *mntpt) put_page(page); if (ret < 0) return ret; + + /* Don't cross a backup volume mountpoint from a backup volume */ + if (src_as->volume && src_as->volume->type == AFSVL_BACKVOL && + ctx->type == AFSVL_BACKVOL) + return -ENODEV; } return 0; -- 2.43.0