From patchwork Fri May 24 16:17:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13673292 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 8F6C585C58 for ; Fri, 24 May 2024 16:18:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716567484; cv=none; b=ND23dcNtXloOSXb76KXKm5Wl1c9s9Wfy4/P/fdQwI7x1AMVmbLJHoMDQAHOONStqCX7OcQCPypVjVp1exWwjSgEDCL7XSZishXyYL5OcZv6vXGmu3ZetUX2Em1OwQVT7+drdnsl3Gmlh4RfoWfkikst6F9XvguE+c4Y2IoExjBk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716567484; c=relaxed/simple; bh=omAssB6I02yj+x+pz+EEXEalHt+q5NCe67eht1huW5c=; h=From:To:cc:Subject:MIME-Version:Content-Type:Date:Message-ID; b=H3/cc77yrF8HhByriCyLk/RfTMcBiyaiKhWRZVG43HiJam9LRePQ/RGZGBxn0VaVwiRwM4UOdYx5H/wncUARlDwXOX3r3u9cTMitV/3HfTkINrGPEqUz3QABi0ub2ohK4aEyEr3IK6m9YTdhXQVNuPEpC7U9J/NF4pCftpZ9UsU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=RlxLGnNr; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="RlxLGnNr" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1716567481; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vHjClk8E6ZL5CAwbbjUXeTWTpXpzXKPzMEFy1g+hdPs=; b=RlxLGnNrHVjQ1qzah9EWwYi595MzfXQPeE2gyD2LJGbN6kGwh/y2ESm1Y0nS2N5nkFOyug k7I1g9AoQnlBUOi/pDrg7idZPQSBMP+ew/WHjGWa1huwHq6GsY/Xk+DwZ46aZ9S/N7pU4d jZtYaLB6c7suH1YCdeHYzMmwP2urL68= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-163-Y4ybQU0dP5WtwdLUCHbt2Q-1; Fri, 24 May 2024 12:17:58 -0400 X-MC-Unique: Y4ybQU0dP5WtwdLUCHbt2Q-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 73C5C101A52C; Fri, 24 May 2024 16:17:57 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3D22F2026D68; Fri, 24 May 2024 16:17:56 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells To: Christian Brauner cc: dhowells@redhat.com, Jan Henrik Sylvester , Markus Suvanto , Marc Dionne , Jeffrey Altman , linux-afs@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] afs: Don't cross .backup mountpoint from backup volume Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-ID: <768759.1716567475.1@warthog.procyon.org.uk> Date: Fri, 24 May 2024 17:17:55 +0100 Message-ID: <768760.1716567475@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 Hi Christian, Can you pick this up, please? Thanks, David --- From: Marc Dionne afs: Don't cross .backup mountpoint from backup volume 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 Reviewed-by: Jeffrey Altman cc: linux-afs@lists.infradead.org --- fs/afs/mntpt.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/afs/mntpt.c b/fs/afs/mntpt.c index 97f50e9fd9eb..297487ee8323 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;