Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp271705lqr; Wed, 5 Jun 2024 05:52:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWmPRf5pD128nFHhSKMp+uBoklefr2xGYQ5FGqz/1btGFMHW8jVuQVA5rtxxcz2eFlOTKXGaHMb9rfdNKd+CA0GuiED9ovrv9rWu7sFzQ== X-Google-Smtp-Source: AGHT+IEYxuFXZ2vuSGpJCCLpd+zAb3Fpe8YKl/+h2zGeJonZzdejuTFo+RW/qgTVgsfq0DK9PGyE X-Received: by 2002:a05:6512:2393:b0:529:b717:2a18 with SMTP id 2adb3069b0e04-52bab4fa558mr2026731e87.47.1717591962453; Wed, 05 Jun 2024 05:52:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717591962; cv=pass; d=google.com; s=arc-20160816; b=dAotJbKlQaJcCuRFzbOBniMXbNetPGi4upfdaMenCe1FVoMs02KwoiBemyE+Ym1mox 9f6tztOD9oesg3UTopYnWo8OatihZC1mJXjR8/vkcigg40Qq0eno0LbxIYVGkez2seXX xudr8U0pRTI29PFn/lY5vMgLdCto9pbIOnsOPTlcD0GnPcuxh+zkLJL3EljU0k1X+czj 3pyTSzkwGkaYyM74gEvQ4SqwbMcPT/sb+BmKeDQgno2zWsYAJ+dmKoVQNNVN3rPenmbQ VurVgjcgymWKzkVhz7qYWWprtBSTb5rtpHa3TZxIfofKbAZ/uNY5uOdhH1gPi9OxLNVl tPug== 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=bd2lfFSqVJK5LwenhZ17rp4Ubt3uL3u31I47CJ8pyz6BRa0Myu/zROioK5byR4VID6 FzFkYyqnTAejta3hE4RACsrMNJoJlawgNZP1SiQB55SV7b3bRbgoivG48sqcEbgNtHig FPzG83nLDMTmQol5pM35fMbIBYAZImDDhpx/3n1ULIJbn8goT4SHa+w8rWX2iYtbvOD3 /OP6+04j16c8+7pnK4YZTs5H8CPwsuM3m2tBg0AGnLxnZHbZ311R1aPQHecnY0PgxOBA 0EZFJK2zIs6KXu2elGc655kQcSSpUSmHGJypYPOEJjkeNZDR2fVE04s3VemE+imU55A+ EO7w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oPkMrUTu; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202543-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202543-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-a693178c836si228415066b.432.2024.06.05.05.52.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 05:52:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202543-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=oPkMrUTu; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202543-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202543-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 2C8331F2A69F for ; Wed, 5 Jun 2024 12:52:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ABC551D0EC1; Wed, 5 Jun 2024 12:06:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="oPkMrUTu" 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 D100F1ABCD2; Wed, 5 Jun 2024 12:05:59 +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=1717589159; cv=none; b=sE6S8kgLO+aDQdt1ax8Xr80xosS6/UiBFaqFnCegQQpgCs/Zm23iCzEkkUVGQelv0FXTOQJ3Wuvr1F4fyk1p2+Vs6pPWdVSHG5cy0tHXodaUtBut4+A2zd+fdg/jCB/MWOLk16JBWvJj4Ga8UZhn+pKi7JXQVXLl03vpzMxgtCA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717589159; c=relaxed/simple; bh=6ghHQ4oFDM/MuZh0bso4VZhlvZ9ZWfi1y9gl6T3Gy0E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Sq+TLrCIVZn/7W4f0aDR9pmcvBsbpIDU/MMz0D9HJBTM/xoOBPaEbPg0cSldRHTo5D+98P9DPQ8RSxsXC2JYKN/80O6w/2I3vlOSRcbkLRlduDTNHHlJZ1WhcyA3yXJ2OIWSefMd/+QmGJ/Ec5l+KonS1ZNqJd4ZzdKN7zXLbuQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=oPkMrUTu; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 585E5C32781; Wed, 5 Jun 2024 12:05:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717589159; bh=6ghHQ4oFDM/MuZh0bso4VZhlvZ9ZWfi1y9gl6T3Gy0E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oPkMrUTu2Mr2Zlf0BK0iupg39eFDb9Jrbtx7j/bFbWweEYRlYOUNjZczG1XOk5Rwh 9t6/39cOyYUZnjhRYSf78wObJlylZ+ZnvqlcPM6GE4vj4F2sjegda33FF3+JWI00gB yjpC5ohkQX22kWt0eFRkPrI9lJvZRCzPRl445LwJ6jsJZs86bGplyqL+Ki/VXQL623 ldlndb0SAyCtytlWsj2zbpPGjYRIsMsYDnn3Y5/t+/npDfZdy/zhzaGQ8qSoupoBru 0S7Sg/xzUI+EwOkxtY2FstuwBBxzGw0QyNc/mAqaFrzchGf3EnTJCQohM59KTUjCpH +pdg9F/7Wj05g== 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.10 3/8] afs: Don't cross .backup mountpoint from backup volume Date: Wed, 5 Jun 2024 08:05:46 -0400 Message-ID: <20240605120554.2968012-3-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240605120554.2968012-1-sashal@kernel.org> References: <20240605120554.2968012-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.10.218 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