Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp270303lqr; Wed, 5 Jun 2024 05:49:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUKY27FjH3HWnqtji1Nltq6CIZtgfeHvYpnYjlLgPD8vMfLhLdQ4bNxqRQNJNITutFSVov5eg7txuuh5JqUlu9Frh/ZttppM2kgTIEjRg== X-Google-Smtp-Source: AGHT+IHuYYfuTPjARbuRjvMlRPNg6wMRNN1lvBtTjZwOwtDL/WAwwzx20q5dAR3uXc6spPGjRrht X-Received: by 2002:a05:6a20:8409:b0:1af:939b:d477 with SMTP id adf61e73a8af0-1b2b7038a9amr2716035637.36.1717591789426; Wed, 05 Jun 2024 05:49:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717591789; cv=pass; d=google.com; s=arc-20160816; b=AR2AbO8GMFxQhCH8EmzjEQhOKKgvzWMhlyPD0gD1zjpvaRk+KiwDUyxzRgG3rd1p1t QKzqnxDNRdRN4Duju/3Dyx1fsQIrlrkSev5LGDPOE0AjmrPDPYQpXoE2Ub80V7J2jvRW 620N5jSHORuC1GLr3rkv+C/TnrjpaB67v8ZmxT3dIPTa+BTeDSNPo+ZVMl3qJHvwfv2T GWCTXfrczZk9C8aDTs87Q6VCs7Mu3V6BE7+AHmsOS+HxLCJAzi4zI2fQvVRxV9bIi7Kr WUJs6dvDNirxRfFHya/+YAB47W0OllhdrOJ5l2AYGyn7XW9yeUkNKVTm/fHqf6qSLk+V wilg== 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=jWZgIOwVY0JngcvgVuFLh9BargqtQN24teYie6mb/IkYJHIA1Iz0brEli6AYZw28/P NKD1+jMt9BsJZ7L5JYzBsV4IXZq2OXjG+5EBU3OgCkTn0zfW7JSgVZC/T7DloQ5IAUfo tCdOFkrUEQY8maGSMHZ91tq762BXXW5I+BkUZqQpwAsYlIN01Je7vYDzmFgiuH2CNGSA IHPB3NmxlCYER3nMIphu5LkOlKIf/ifvwGI3BvzpzDDcJZPtco+L750pmcAThPNHaCka tuJ8123liM4r4f4tXFUPGmRI02pbCr0cjSvr/8fgvPJacrhlF2MYIocRgan05YRKv2FB 3lsQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=o01oxb+5; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202499-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202499-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-6c3542e3956si569607a12.23.2024.06.05.05.49.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 05:49:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202499-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=o01oxb+5; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202499-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202499-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id E6C182864C6 for ; Wed, 5 Jun 2024 12:40:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0C98C1C7740; Wed, 5 Jun 2024 12:04:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="o01oxb+5" 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 3220B195819; Wed, 5 Jun 2024 12:04:17 +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=1717589057; cv=none; b=fpgs+QStnlFA+PD6bVy1n5tBT9HRloqWcQJX/1QbXzhYIy95wsQcdhvGGv6CM50jOYMPdpQFiSVaKISyDe8nXk24a4ERP8qCEbBPeFWqqifyoun1n2dosQi8Np4JN/HOrtgPBROVR/kd9/I7wrtujif4nsduVV5GKWdzRu/yLfo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717589057; c=relaxed/simple; bh=bylK+30oXOjpzBIqsZm0C+/6jGI+3ytDovsfXtt3fpI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QD9PZYIfwyttvH/Yf78dMk57lrERXODomyLvsvAAGad/Izbsbt56QTmAhEimgyRYcWWQFjptgdi+omg+nyct/qGsoE2zNZCPzk3gG2VL5Lcr0ywJnUpKGEREig5nHrWgohuTgREmHdj4qQuWUQOG8RaAzzG5Gs034+Z4SjNcEs0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=o01oxb+5; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 036ACC32781; Wed, 5 Jun 2024 12:04:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717589057; bh=bylK+30oXOjpzBIqsZm0C+/6jGI+3ytDovsfXtt3fpI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o01oxb+5oxvtjKQqkofhjQNPLq2H080Vh5F5y9rDM2NcpCC37MyBAW6D7wOlTeEAM g7lX4Gn87b4xVNDn+wgu0oXtE4R0oJBOJhbRrJ1VcOjywZywSiE6PQIfvyPAOJibM3 OtrEkP4A7HNasxDGa28dPINqjSekVoBPRDm92aVKDzB7PM19rPFaY12dOr90lH8GNx faMpll2gnjZIGlBMAMM15Du1WERuiRUhwDw+65hkfGLFnEPByDL5IE/jdXcUAs1o3V /fY1mzFop7hl+czqOVs+Y+NDtM5D+LkXgF0fJaWEftVrgU1IGvX3Ivpx7n1htqZWvC Yc7C9xOKz+iFg== 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.6 05/18] afs: Don't cross .backup mountpoint from backup volume Date: Wed, 5 Jun 2024 08:03:44 -0400 Message-ID: <20240605120409.2967044-5-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240605120409.2967044-1-sashal@kernel.org> References: <20240605120409.2967044-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.6.32 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