Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp287888lqr; Wed, 5 Jun 2024 06:16:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUYbp4AO90KJYbjEOp9b0pSDoFAe6mk8kixICTcx6VtgHiYwCLORofoODdgq6FeycLCQFKsGmi4J3PuxQx/DVdm4n2UnrKzPfBJuvNo2A== X-Google-Smtp-Source: AGHT+IEScZW9Aa+6pYspmIyj0BrzEC65vilG6gAUYZ7bEjVSYUBCgUSu7yZWxlPwHLonlVIzqXdI X-Received: by 2002:a50:9ee2:0:b0:57a:2e6c:c089 with SMTP id 4fb4d7f45d1cf-57a8b6f23e0mr2464153a12.19.1717593395267; Wed, 05 Jun 2024 06:16:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717593395; cv=pass; d=google.com; s=arc-20160816; b=FRkr01hNQQOd2M9X6OywmQCmiUoeWQc0sU+itA+QrPqRAG3CY3YSvdPldtq1YUNxme H6PAcLVgdM22bfiWejGJDiI9JJspxb5saXbgr6AlpqASdke0MqHwqmruwElM+DnTgxsl 0X8eJWb96wJpkScSDPL6dxTy9XpiDZO6rLWtvVhP/VoAzi87BwNp7jQJ15HTyvBrKPwz 7/7VYeDBxih2Y2WQEzyJK1YtZ2hnQ4pbc/TTVwAVQpWb6xp4cSiMsYkm7sn2P8BSypNu nJWxvaPjX0YKI+WwEJTW247jWiMy+Kg0PpBEj6ObFAQ6Ly7pUCV4nLIOyM2DOFFylAmz V4TA== 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=ugvYmXLBh3cf+IKDIR8DaAxTrchlRaRKjPoAJ/2iX8o=; fh=no2D3E2HkF6we223b26kpootOGOgh+k0KjYu09ICWqI=; b=z78SugzGaCn3zd5MphDe4s0BcnRLSvL9oFsbfPiRu++DwqErAJyBXnYQLh4+uzsRuj u4Q08iRyYlMaF8RDOkaB+tsj9ZaMsXVsNbp30SKe/TTOWccD1kDTp1dskmdNLdhKtjtO vBYCcl04Vf6Y+C0ee9JW3eoNeA+KCVNVdU083rcJRYOjlycWOpKNhnd2mwMGpYMwuKgs 6LSW4toRlWaaODCjqNIa6v2sGnwq7a98Nc0szBvUJmFcJKKo4CovbyE/wCGcGjZ3iN5f h3/UWNU4Fso9y63CGCTPs/tXGWigQbXL7pQQODHyZYXOaqyXfI2DmRYhdk37B0JxaatV VQaQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JpNG6NiI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202531-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202531-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. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57a31c75a47si6141425a12.354.2024.06.05.06.16.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 06:16:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202531-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JpNG6NiI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202531-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202531-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 6D2DB1F292B1 for ; Wed, 5 Jun 2024 12:48:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7159B1ABE4E; Wed, 5 Jun 2024 12:05:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JpNG6NiI" 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 990051ABE32; Wed, 5 Jun 2024 12:05:35 +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=1717589135; cv=none; b=JN+EU9Zj+vVaAtOW3DLchxpqZFXtks28OULFXJny7dYx+VZTs+DLMUQU92mTZwUX8oMRcaEjLaRb3KxhWMcYU/EekRT2hUzhj2+MTHAsPO7c71nn4CO9P5UO+o2R5VljgkUtSwpbKb9TSySI/kLtL8MnzKa7XofF2VjHrr2afSM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717589135; c=relaxed/simple; bh=6ghHQ4oFDM/MuZh0bso4VZhlvZ9ZWfi1y9gl6T3Gy0E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nz6Bzoby87mTkdxbRaQnvlPNkZBX6Bxvh53wAbBZ8tVjV8CVipWuxgzB0SkwX9tRvkFFI6M75Lm7kcEDXF+WnrAaPlLUSztyTLX3EujCRdPKPpWZQe14K76XiRQr7saiBK97igGsko8pZqKQm9b1RDp8GrBcWUKR9xj68GlvTjU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JpNG6NiI; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2989AC3277B; Wed, 5 Jun 2024 12:05:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717589135; bh=6ghHQ4oFDM/MuZh0bso4VZhlvZ9ZWfi1y9gl6T3Gy0E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JpNG6NiIamTTsdzX7MwFOxMsyxzfsO9xxBJwfRVcJsGf5+/nsdxcfWGKnv+Qc6JNb Ou1U19gk7Vt6jpNUqdbqfRM4TbUkMil8JvKbOmhgNJkJz8pjH7XC7FqHxOBdK9nTd/ nRMS5oAU8iIFB4vyizoEKejLaW1q4hMcP4yKeb9aj5oTK04WuM1/q4ZFzn0NbGGgpE IOLrPwX2gJWyO+6S3ynEJpjV62UeRRF3+r3UN6OSkYZCqKDibqd1cFqnKHeBcnkIAf ItBIfh7EAuNsfDG5/+9Haob77AkVHp2IbD5VhRc1PCDRnWYO9W/Ircluifkg5ASOZU cE0oSf6PFt2+g== 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.15 04/12] afs: Don't cross .backup mountpoint from backup volume Date: Wed, 5 Jun 2024 08:05:14 -0400 Message-ID: <20240605120528.2967750-4-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240605120528.2967750-1-sashal@kernel.org> References: <20240605120528.2967750-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.15.160 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 bbb2c210d139d..fa8a6543142d5 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