Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp271387lqr; Wed, 5 Jun 2024 05:52:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUT2camqi4ssZRz4B0JRc6LVtjQESAf/evfMkxbZa5zRVpGr3S3+TFES8UYEzgWr6M3YM9LAMLvP2ZuzG1lCJ8XZcRbP8RYDPdZ1M0fwQ== X-Google-Smtp-Source: AGHT+IGMDixKNr2Fq+UR2NGtCAD5Ze7mfLiq77dkIQEA1W7p17240yjlbYz9D9JISkOK0LAjdpvz X-Received: by 2002:a17:903:8cb:b0:1f2:fcc0:66f with SMTP id d9443c01a7336-1f6a5705779mr29567995ad.31.1717591925868; Wed, 05 Jun 2024 05:52:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717591925; cv=pass; d=google.com; s=arc-20160816; b=Ho4MMMpB47nqrIYSRBrBqx3RKAI4Wfvos7He3KaXxVeoxBRvdJaTmuEUOhTcdNfvzl WaNXGiQncPeoKxSytCqqz7PgMh7wApDfD8uBYRsE1ckcOJhaFc34FoeR5J+Ji13HVO08 132ekAsoK5Xv+iDOvLURLMsC9i5xcNHh7C90Cjo3ko8GC677HbknoeySI8V7MvyIZB4Z XwIxI6E/oLfEykUjxmv3HLY/sZD0NjTEBr1wIrZ+XQlcBY2v+bEfSmtVascJ7oG4MOvu hkM/cNJ8474rKLzQGYdZ4T3hV6Ac3FJSH6+jzdpAQhXCnJfFEKg54Zk8KbjP9VBoEG5s LuIQ== 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=W3jx9fB+VD5rQWbTnYlk0LK6hV7mLqy4/SpfC9KYEhM=; fh=no2D3E2HkF6we223b26kpootOGOgh+k0KjYu09ICWqI=; b=LI5aA+j/c2QKvQ0uYUCKIrD3t2/anKm06OmcyjDIazzRPwcLIOKzq8EpGDff+nh8rG 2FtJ9JXvSXY6t+HURtzWiI0qvjvaNrGKVAzMBAoFuxy8hakIbVlmr7fz+dCrmKWb7Jxu uAn3YdqUYXzIr6YcFW/fKW0LrYa2rZsuXUe9u9RiWw7Ak2b31lUzsQiunjpyagdQtGo3 DYCoe4K3BQgUgMHm8pTIGZE+jnRghCYU19q/1l9wiSDa86NEbTQunQ7U7rmo6hnsFqm5 VdiUgSzMgaSn8EVmdpvf8GkMlRsIrTuCgs6IOtdcP0H17nCAVP7uyqcYb7XzdjhgBVTL StOA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JI5W7l3h; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202458-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202458-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d9443c01a7336-1f6324168cesi100306215ad.553.2024.06.05.05.52.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 05:52:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202458-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JI5W7l3h; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202458-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202458-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 34804B22AE5 for ; Wed, 5 Jun 2024 12:30:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 681D419D08F; Wed, 5 Jun 2024 12:02:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JI5W7l3h" 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 8CAB619D080; Wed, 5 Jun 2024 12:02:34 +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=1717588954; cv=none; b=WZSOExHN9/siPkvaOIWpL5kElNOmu3yRDzX8YwVgZHQxA3YSoVSMz3wS+K2FOqz+cdfEKYPHpxdQ+Hc2z9Rgk4JS2tsJPY5vHIwYTmEPMnFKeKDnpTKRcnmPmjoY6PlzO+3n5VBRi9UpCX6JqV7Cijj+BfSGKzf7lzhbJj5LfL4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717588954; c=relaxed/simple; bh=bylK+30oXOjpzBIqsZm0C+/6jGI+3ytDovsfXtt3fpI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qf5y1H5pdI3lYN+qbGBagU75CiDjyrvxKnS7LAFlGc2AenmCk/JCXwj55yyDj1e2JCAKrGf3jhq2Gz/m0hs7S5YfLCUDijIZZWKuQeFFLWjyZ9b1aXs/1io3WKZTl3fc6L06QcO0CkIsCh2PXOpfTAWK0TmgZOPgouXzjidOEb4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JI5W7l3h; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13E3EC32781; Wed, 5 Jun 2024 12:02:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717588954; bh=bylK+30oXOjpzBIqsZm0C+/6jGI+3ytDovsfXtt3fpI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JI5W7l3hEIm1fnEY9Y3UEtOzYbWZKypnrb9O4FYy1HkfbpzcjKuFBqbii7FBMu3P0 tfKQ9ooCW4gFhUjkv/0fNEAcm3ao2xX5yIXLEoDh/268mLmKRotG3ccaRVuyilE9ut KSNJ0ApEzwbuHEOUNfKoZphVS3dygYDYDG9g2wc6v/XXGOj3mXM+CQs+sbAJSEbvQ0 Ze+myHGOu5WviVo0aD/Et9C5hXlQ6fFouLQWb3GdtuskGfmxxwt2Iv5qH1LLO1+tlH wAog/KKAyB3+LV0kKWB5il77NtmGAPvQ9CvWcycFAY5x4mLpo3+woWaqbRShfUMN0Z OFNMt4n702RiA== 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 6.9 07/23] afs: Don't cross .backup mountpoint from backup volume Date: Wed, 5 Jun 2024 08:01:50 -0400 Message-ID: <20240605120220.2966127-7-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240605120220.2966127-1-sashal@kernel.org> References: <20240605120220.2966127-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 6.9.3 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 97f50e9fd9eb0..297487ee83231 100644 --- a/fs/afs/mntpt.c +++ b/fs/afs/mntpt.c @@ -140,6 +140,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