Re: [PATCH 4.1 27/45] btrfs: check unsupported filters in balance arguments

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



(apologies if you receive this twice, pilot error)

On Sat, 12 Dec 2015 11:33:22 -0800, Greg Kroah-Hartman wrote:

> 4.1-stable review patch.  If anyone has any objections, please let me know.
> 
> ------------------
> 
> From: David Sterba <dsterba@xxxxxxxx>
> 
> commit 849ef9286f30c88113906dc35f44a499c0cb385d upstream.
> 
> We don't verify that all the balance filter arguments supplemented by
> the flags are actually known to the kernel. Thus we let it silently pass
> and do nothing.
> 
> At the moment this means only the 'limit' filter, but we're going to add
> a few more soon so it's better to have that fixed. Also in older stable
> kernels so that it works with newer userspace tools.
> 
> Signed-off-by: David Sterba <dsterba@xxxxxxxx>
> Signed-off-by: Chris Mason <clm@xxxxxx>
> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> 
> ---
>  fs/btrfs/ioctl.c   |    5 +++++
>  fs/btrfs/volumes.h |    8 ++++++++
>  2 files changed, 13 insertions(+)
> 
> --- a/fs/btrfs/ioctl.c
> +++ b/fs/btrfs/ioctl.c
> @@ -4497,6 +4497,11 @@ locked:
>  		goto out_bctl;
>  	}
>  
> +	if (bctl->flags & ~(BTRFS_BALANCE_ARGS_MASK | BTRFS_BALANCE_TYPE_MASK)) {
> +		ret = -EINVAL;
> +		goto out_bargs;
> +	}
> +
>  do_balance:
>  	/*
>  	 * Ownership of bctl and mutually_exclusive_operation_running
> --- a/fs/btrfs/volumes.h
> +++ b/fs/btrfs/volumes.h
> @@ -380,6 +380,14 @@ struct map_lookup {
>  	 BTRFS_BALANCE_ARGS_VRANGE |		\
>  	 BTRFS_BALANCE_ARGS_LIMIT)
>  
> +#define BTRFS_BALANCE_ARGS_MASK			\
> +	(BTRFS_BALANCE_ARGS_PROFILES |		\
> +	 BTRFS_BALANCE_ARGS_USAGE |		\
> +	 BTRFS_BALANCE_ARGS_DEVID | 		\
> +	 BTRFS_BALANCE_ARGS_DRANGE |		\
> +	 BTRFS_BALANCE_ARGS_VRANGE |		\
> +	 BTRFS_BALANCE_ARGS_LIMIT)
> +
>  /*
>   * Profile changing flags.  When SOFT is set we won't relocate chunk if
>   * it already has the target profile (even though it may be

This patch was previously already added to 4.1.12 & 4.2.5 and should be
dropped from all queues. 4.3 has it out of the box, so no need to add it
there either.

Not sure how but apparently you managed to apply it twice, so e.g.
fs/btrfs/ioctl.c:4604 from 4.1.15-rc1 now looks like:

...
if (bctl->flags & ~(BTRFS_BALANCE_ARGS_MASK | BTRFS_BALANCE_TYPE_MASK)) {
	ret = -EINVAL;
	goto out_bctl;
}

if (bctl->flags & ~(BTRFS_BALANCE_ARGS_MASK | BTRFS_BALANCE_TYPE_MASK)) {
	ret = -EINVAL;
	goto out_bargs;
}
...

cheers,
Holger

--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]