stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Patch "btrfs: check unsupported filters in balance arguments" has been added to the 4.1-stable tree
@ 2015-10-23 14:20 gregkh
  0 siblings, 0 replies; 4+ messages in thread
From: gregkh @ 2015-10-23 14:20 UTC (permalink / raw)
  To: dsterba, clm, gregkh; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    btrfs: check unsupported filters in balance arguments

to the 4.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     btrfs-check-unsupported-filters-in-balance-arguments.patch
and it can be found in the queue-4.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From 8eb934591f8bf584969454a658f629cd06e59f3a Mon Sep 17 00:00:00 2001
From: David Sterba <dsterba@suse.com>
Date: Mon, 12 Oct 2015 16:55:54 +0200
Subject: btrfs: check unsupported filters in balance arguments

From: David Sterba <dsterba@suse.com>

commit 8eb934591f8bf584969454a658f629cd06e59f3a 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@suse.com>
Signed-off-by: Chris Mason <clm@fb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 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
@@ -4492,6 +4492,11 @@ locked:
 		bctl->flags |= BTRFS_BALANCE_TYPE_MASK;
 	}
 
+	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
@@ -372,6 +372,14 @@ struct map_lookup {
 #define BTRFS_BALANCE_ARGS_VRANGE	(1ULL << 4)
 #define BTRFS_BALANCE_ARGS_LIMIT	(1ULL << 5)
 
+#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


Patches currently in stable-queue which might be from dsterba@suse.com are

queue-4.1/btrfs-check-unsupported-filters-in-balance-arguments.patch

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Patch "btrfs: check unsupported filters in balance arguments" has been added to the 4.1-stable tree
@ 2015-12-11 17:19 gregkh
  2015-12-12 21:47 ` Holger Hoffstätte
  0 siblings, 1 reply; 4+ messages in thread
From: gregkh @ 2015-12-11 17:19 UTC (permalink / raw)
  To: dsterba, clm, gregkh; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    btrfs: check unsupported filters in balance arguments

to the 4.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     btrfs-check-unsupported-filters-in-balance-arguments.patch
and it can be found in the queue-4.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From 849ef9286f30c88113906dc35f44a499c0cb385d Mon Sep 17 00:00:00 2001
From: David Sterba <dsterba@suse.com>
Date: Mon, 12 Oct 2015 16:55:54 +0200
Subject: btrfs: check unsupported filters in balance arguments

From: David Sterba <dsterba@suse.com>

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@suse.com>
Signed-off-by: Chris Mason <clm@fb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 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


Patches currently in stable-queue which might be from dsterba@suse.com are

queue-4.1/btrfs-check-unsupported-filters-in-balance-arguments.patch

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Patch "btrfs: check unsupported filters in balance arguments" has been added to the 4.1-stable tree
  2015-12-11 17:19 gregkh
@ 2015-12-12 21:47 ` Holger Hoffstätte
  2015-12-13  1:13   ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Holger Hoffstätte @ 2015-12-12 21:47 UTC (permalink / raw)
  To: stable

On Fri, 11 Dec 2015 09:19:26 -0800, gregkh wrote:

> This is a note to let you know that I've just added the patch titled
> 
>     btrfs: check unsupported filters in balance arguments
> 
> to the 4.1-stable tree which can be found at:
>     http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
> 
> The filename of the patch is:
>      btrfs-check-unsupported-filters-in-balance-arguments.patch
> and it can be found in the queue-4.1 subdirectory.

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Patch "btrfs: check unsupported filters in balance arguments" has been added to the 4.1-stable tree
  2015-12-12 21:47 ` Holger Hoffstätte
@ 2015-12-13  1:13   ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2015-12-13  1:13 UTC (permalink / raw)
  To: Holger Hoffstätte; +Cc: stable

On Sat, Dec 12, 2015 at 09:47:03PM +0000, Holger Hoffst�tte wrote:
> On Fri, 11 Dec 2015 09:19:26 -0800, gregkh wrote:
> 
> > This is a note to let you know that I've just added the patch titled
> > 
> >     btrfs: check unsupported filters in balance arguments
> > 
> > to the 4.1-stable tree which can be found at:
> >     http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
> > 
> > The filename of the patch is:
> >      btrfs-check-unsupported-filters-in-balance-arguments.patch
> > and it can be found in the queue-4.1 subdirectory.
> 
> 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;
> }
> ...

Thanks for letting me know, this must have come in in a different branch
multiple times, which is why I tried to pick it up twice.  Now removed
from the queue.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-12-13  1:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-23 14:20 Patch "btrfs: check unsupported filters in balance arguments" has been added to the 4.1-stable tree gregkh
  -- strict thread matches above, loose matches on Subject: below --
2015-12-11 17:19 gregkh
2015-12-12 21:47 ` Holger Hoffstätte
2015-12-13  1:13   ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).