[PATCH] afs: Don't cross .backup mountpoint from backup volume

Jeffrey E Altman jaltman at auristor.com
Fri May 10 21:03:50 PDT 2024


On 5/10/2024 6:14 PM, Marc Dionne wrote:

> Don't cross a mountpoint that explicitly specifies a backup volume
> (target is <vol>.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.
>
> Signed-off-by: Marc Dionne <marc.dionne at auristor.com>
> ---
>   fs/afs/mntpt.c | 5 +++++
>   1 file changed, 5 insertions(+)
>
> diff --git a/fs/afs/mntpt.c b/fs/afs/mntpt.c
> index 97f50e9fd9eb..fb6eea31ff31 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;

Reviewed-by: Jeffrey Altman <jaltman at auristor.com>

Reported-by: Jan Henrik Sylvester <jan.henrik.sylvester at uni-hamburg.de>

Link: http://lists.infradead.org/pipermail/linux-afs/2024-May/008454.html

Reported-by: Markus Suvanto <markus.suvanto at gmail.com>

Link: 
http://lists.infradead.org/pipermail/linux-afs/2024-February/008074.html

Cc: stable at vger.kernel.org



More information about the linux-afs mailing list