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.2-stable tree
@ 2015-10-23 14:21 gregkh
  0 siblings, 0 replies; 6+ messages in thread
From: gregkh @ 2015-10-23 14:21 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.2-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.2 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
@@ -4647,6 +4647,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
@@ -376,6 +376,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.2/btrfs-check-unsupported-filters-in-balance-arguments.patch

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

* Re: Patch "btrfs: check unsupported filters in balance arguments" has been added to the 4.2-stable tree
@ 2015-10-23 15:21 David Sterba
  2015-10-23 15:34 ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: David Sterba @ 2015-10-23 15:21 UTC (permalink / raw)
  To: stable; +Cc: clm

Hi,

this patch needs a followup that fixes a memory leak. The patch was not
tagged for stable and hasn't been merged to Linus' tree yet. The pa

Please add:

commit:  0f89abf56abbd0e1c6e3cef9813e6d9f05383c1e
subject: btrfs: fix possible leak in btrfs_ioctl_balance()

currently in Chris' pull request branch

https://git.kernel.org/cgit/linux/kernel/git/mason/linux-btrfs.git/commit/?h=for-linus-4.3&id=0f89abf56abbd0e1c6e3cef9813e6d9f05383c1e

Thanks.

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

* Re: Patch "btrfs: check unsupported filters in balance arguments" has been added to the 4.2-stable tree
  2015-10-23 15:21 David Sterba
@ 2015-10-23 15:34 ` Greg KH
  2015-10-24 12:18   ` Holger Hoffstätte
  2015-10-27 12:39   ` David Sterba
  0 siblings, 2 replies; 6+ messages in thread
From: Greg KH @ 2015-10-23 15:34 UTC (permalink / raw)
  To: David Sterba; +Cc: stable, clm

On Fri, Oct 23, 2015 at 05:21:12PM +0200, David Sterba wrote:
> Hi,
> 
> this patch needs a followup that fixes a memory leak. The patch was not
> tagged for stable and hasn't been merged to Linus' tree yet. The pa
> 
> Please add:
> 
> commit:  0f89abf56abbd0e1c6e3cef9813e6d9f05383c1e
> subject: btrfs: fix possible leak in btrfs_ioctl_balance()
> 
> currently in Chris' pull request branch
> 
> https://git.kernel.org/cgit/linux/kernel/git/mason/linux-btrfs.git/commit/?h=for-linus-4.3&id=0f89abf56abbd0e1c6e3cef9813e6d9f05383c1e

I can't do anything until it hits Linus's tree, please let me know when
that happens.

thanks,

greg k-h

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

* Re: Patch "btrfs: check unsupported filters in balance arguments" has been added to the 4.2-stable tree
  2015-10-23 15:34 ` Greg KH
@ 2015-10-24 12:18   ` Holger Hoffstätte
  2015-10-27 12:39   ` David Sterba
  1 sibling, 0 replies; 6+ messages in thread
From: Holger Hoffstätte @ 2015-10-24 12:18 UTC (permalink / raw)
  To: stable

On Fri, 23 Oct 2015 08:34:55 -0700, Greg KH wrote:

> On Fri, Oct 23, 2015 at 05:21:12PM +0200, David Sterba wrote:
>> Hi,
>> 
>> this patch needs a followup that fixes a memory leak. The patch was not
>> tagged for stable and hasn't been merged to Linus' tree yet. The pa
>> 
>> Please add:
>> 
>> commit:  0f89abf56abbd0e1c6e3cef9813e6d9f05383c1e
>> subject: btrfs: fix possible leak in btrfs_ioctl_balance()
>> 
>> currently in Chris' pull request branch
>> 
>> https://git.kernel.org/cgit/linux/kernel/git/mason/linux-btrfs.git/commit/?h=for-linus-4.3&id=0f89abf56abbd0e1c6e3cef9813e6d9f05383c1e
> 
> I can't do anything until it hits Linus's tree, please let me know when
> that happens.

It's now merged:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/fs/btrfs?id=0f89abf56abbd0e1c6e3cef9813e6d9f05383c1e

This needs to go everywhere $SUBJECT was merged, so far I see 4.1 and 4.2.

-h


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

* Re: Patch "btrfs: check unsupported filters in balance arguments" has been added to the 4.2-stable tree
  2015-10-23 15:34 ` Greg KH
  2015-10-24 12:18   ` Holger Hoffstätte
@ 2015-10-27 12:39   ` David Sterba
  1 sibling, 0 replies; 6+ messages in thread
From: David Sterba @ 2015-10-27 12:39 UTC (permalink / raw)
  To: Greg KH; +Cc: stable, clm

On Fri, Oct 23, 2015 at 08:34:55AM -0700, Greg KH wrote:
> On Fri, Oct 23, 2015 at 05:21:12PM +0200, David Sterba wrote:
> > this patch needs a followup that fixes a memory leak. The patch was not
> > tagged for stable and hasn't been merged to Linus' tree yet. The pa
> > 
> > Please add:
> > 
> > commit:  0f89abf56abbd0e1c6e3cef9813e6d9f05383c1e
> > subject: btrfs: fix possible leak in btrfs_ioctl_balance()
> > 
> > currently in Chris' pull request branch
> > 
> > https://git.kernel.org/cgit/linux/kernel/git/mason/linux-btrfs.git/commit/?h=for-linus-4.3&id=0f89abf56abbd0e1c6e3cef9813e6d9f05383c1e
> 
> I can't do anything until it hits Linus's tree, please let me know when
> that happens.

The patch has been merged, the commit id is unchanged. Thanks.

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

* Patch "btrfs: check unsupported filters in balance arguments" has been added to the 4.2-stable tree
@ 2015-12-11 17:19 gregkh
  0 siblings, 0 replies; 6+ 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.2-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.2 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
@@ -4652,6 +4652,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
@@ -384,6 +384,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.2/btrfs-check-unsupported-filters-in-balance-arguments.patch
queue-4.2/btrfs-fix-signed-overflows-in-btrfs_sync_file.patch

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

end of thread, other threads:[~2015-12-11 20:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-23 14:21 Patch "btrfs: check unsupported filters in balance arguments" has been added to the 4.2-stable tree gregkh
  -- strict thread matches above, loose matches on Subject: below --
2015-10-23 15:21 David Sterba
2015-10-23 15:34 ` Greg KH
2015-10-24 12:18   ` Holger Hoffstätte
2015-10-27 12:39   ` David Sterba
2015-12-11 17:19 gregkh

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