From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="stmN3Oyx" 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: stable@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