Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp267889lqr; Wed, 5 Jun 2024 05:45:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWnJv6ur0zaSkPxniMHFovNSzAeM//APglq3eUo+CoLPyFmXqhxuYgqO+EXwQGk3eRB4rpqbUYtX/b8n/pcBQpNGF5w+FM/QM88ZVFr6g== X-Google-Smtp-Source: AGHT+IF5uS3598p3GbnHGEdqnZXaqVWd7LnPR1EEp8As8J7y+Xvqnm2yFu5Tk1+6D8Fgu876yyab X-Received: by 2002:ac8:578d:0:b0:43a:c04c:e3d3 with SMTP id d75a77b69052e-4402b61f00bmr21984471cf.34.1717591515001; Wed, 05 Jun 2024 05:45:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717591514; cv=pass; d=google.com; s=arc-20160816; b=xA4prvsBNfscJVO0Gdy1AAfhH60ZwBsGyC9SfEl6tl+2deNydgm0O8Gn0kXfF7K1oV /p9s1I4DhQibPPYaVal1nOCIoqEj9G8G4ZGw03z9JygLpZkNeDQSu2WKSFn+PhRlXUHs /PwIfHAoi4cv7SaZvio/rkxuJ8r7Pbtz+FQrPx9kN472wjDFSfgq1GsLuUmj2sbCtD9Z GG1YY9D8WNxco4iFUC1pZtIO78nIyfPm3NTA/zjoH8r9qReSHOMqSMdslI2DvbEKgkr7 FitT4p+BL6SkcU9nqynb6Iu2oXuqtn1dB/ePkt8iRmgjFYcP2HhcNKj8H0u183mrI8LR 3ZYw== 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=fsoKYJfmVoHoIFhZ4zBu/u1AVbP2X9DkxQblqge4xg0i4NtT9UvvOQ+gfkC4oWZ2Cv 5RET7P4wtAATDTVqagbGyh6u3N42q6WqUct5mc0qI0jxXd1Chj8E0D4DIuESQ9gMPWC6 QS46+O8CQtMS0+pfMBVWsdAotnelIsbPGgY3FbuA+rSB6VWo7sIFqJcPN37vAAiAAm8F +9KRe77NBApf6REltW4af11SmF+O5TsSPIEhpGUc2HP2vy2FHvIbu2A2sgFeicrA6cMH 5HfTXty9AC6T1P1Xb8qVniMFu144YDT0yDTIbaocQPWhkctrKYcHQA4ygUByqG0wsRem 4vQQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cXIR2ZAw; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202517-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202517-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-4401cb9c325si40437541cf.729.2024.06.05.05.45.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 05:45:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202517-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cXIR2ZAw; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202517-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202517-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id A3B6C1C23E39 for ; Wed, 5 Jun 2024 12:45:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BD62B1CB2F7; Wed, 5 Jun 2024 12:05:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="cXIR2ZAw" 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 DB3801CB2E5; Wed, 5 Jun 2024 12:05:01 +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=1717589101; cv=none; b=sxBolFEMWtSdazLzJNK2kJzUtGLv7txl1VmMo6YqOfN3p3JMh5xrRvsId+Pu6rrjKiybXkP7mJRF3SOHYMx6HhXfRYdbIMDiY1y0etdzoAZC0OMG7qJx3FDX+Q2pHBqzBiXyGIqaPwvynym50rgpzmkqu2IHyMLp4ptK3RuCLvc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717589101; c=relaxed/simple; bh=bylK+30oXOjpzBIqsZm0C+/6jGI+3ytDovsfXtt3fpI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BSy54JZ0RbKJeHPJURXk+pMYskD+qrkKfl7gWsIUmc7SccW8QOMJUlevpaztvVhiHNurYvJX1F4mc72kRQ921N6BuWXbM0CiSfLjSe4c3jUOO/brrjKCTJ3BtPm2oLT2bJVruhCqJHlyTZRB+NWBghYLC4Tl3WQHIZEXjaEkPLk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cXIR2ZAw; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56127C3277B; Wed, 5 Jun 2024 12:05:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717589101; bh=bylK+30oXOjpzBIqsZm0C+/6jGI+3ytDovsfXtt3fpI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cXIR2ZAwCbRbSSxOKKyY2tVLhYmvdb+Q4aET6Mgw/ZLUhz6kqYoDB2+G8HDqs8CGj ixhceDfWC0K9Dc18M3Wpkd4GoRrBMKH1ZAJiNzEhKvwT/0DKznUq3J1Bt7djhiG/jx RxyEXPIh5op0jHh5+OCNT8e/8meOPRpK5ZYmFvf3IupmpEnJ+Y8ItbQKVlqpE2q8z6 uLgIpzPUsjRlyXn4Iqaay0pG0IVkEQ/zmxhEeCxmT81c0HpWdHNXc9csKeMzMMJXFI 09sXUsRDMC6yDlS+eWNzmm/7hjEO5Zp6aiw/LiX9fwyDsopBVdXqyarAdsWhr7wtoc thHNBLtwXiLfw== 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.1 04/14] afs: Don't cross .backup mountpoint from backup volume Date: Wed, 5 Jun 2024 08:04:37 -0400 Message-ID: <20240605120455.2967445-4-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240605120455.2967445-1-sashal@kernel.org> References: <20240605120455.2967445-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.1.92 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