* Patch "btrfs: avoid overflowing f_bfree" has been added to the 4.5-stable tree
@ 2016-06-05 21:48 gregkh
0 siblings, 0 replies; only message in thread
From: gregkh @ 2016-06-05 21:48 UTC (permalink / raw)
To: luisbg, dsterba, gregkh; +Cc: stable, stable-commits
This is a note to let you know that I've just added the patch titled
btrfs: avoid overflowing f_bfree
to the 4.5-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-avoid-overflowing-f_bfree.patch
and it can be found in the queue-4.5 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 41b34accb265e3a20211a7a8ef3625678f1c6ec7 Mon Sep 17 00:00:00 2001
From: Luis de Bethencourt <luisbg@osg.samsung.com>
Date: Wed, 30 Mar 2016 23:18:14 +0100
Subject: btrfs: avoid overflowing f_bfree
From: Luis de Bethencourt <luisbg@osg.samsung.com>
commit 41b34accb265e3a20211a7a8ef3625678f1c6ec7 upstream.
Since mixed block groups accounting isn't byte-accurate and f_bree is an
unsigned integer, it could overflow. Avoid this.
Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
Suggested-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/btrfs/super.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -2073,7 +2073,11 @@ static int btrfs_statfs(struct dentry *d
/* Account global block reserve as used, it's in logical size already */
spin_lock(&block_rsv->lock);
- buf->f_bfree -= block_rsv->size >> bits;
+ /* Mixed block groups accounting is not byte-accurate, avoid overflow */
+ if (buf->f_bfree >= block_rsv->size >> bits)
+ buf->f_bfree -= block_rsv->size >> bits;
+ else
+ buf->f_bfree = 0;
spin_unlock(&block_rsv->lock);
buf->f_bavail = div_u64(total_free_data, factor);
Patches currently in stable-queue which might be from luisbg@osg.samsung.com are
queue-4.5/btrfs-fix-mixed-block-count-of-available-space.patch
queue-4.5/btrfs-avoid-overflowing-f_bfree.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-06-05 22:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-05 21:48 Patch "btrfs: avoid overflowing f_bfree" has been added to the 4.5-stable tree gregkh
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.