* Patch "Btrfs: fix divide error upon chunk's stripe_len" 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: bo.li.liu, dsterba, gregkh, quentin.casasnovas, vegard.nossum
Cc: stable, stable-commits
This is a note to let you know that I've just added the patch titled
Btrfs: fix divide error upon chunk's stripe_len
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-fix-divide-error-upon-chunk-s-stripe_len.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 3d8da67817606380fdadfa483d4dba5c3a5446c6 Mon Sep 17 00:00:00 2001
From: Liu Bo <bo.li.liu@oracle.com>
Date: Tue, 26 Apr 2016 17:53:31 -0700
Subject: Btrfs: fix divide error upon chunk's stripe_len
From: Liu Bo <bo.li.liu@oracle.com>
commit 3d8da67817606380fdadfa483d4dba5c3a5446c6 upstream.
The struct 'map_lookup' uses type int for @stripe_len, while
btrfs_chunk_stripe_len() can return a u64 value, and it may end up with
@stripe_len being undefined value and it can lead to 'divide error' in
__btrfs_map_block().
This changes 'map_lookup' to use type u64 for stripe_len, also right now
we only use BTRFS_STRIPE_LEN for stripe_len, so this adds a valid checker for
BTRFS_STRIPE_LEN.
Reported-by: Vegard Nossum <vegard.nossum@oracle.com>
Reported-by: Quentin Casasnovas <quentin.casasnovas@oracle.com>
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
[ folded division fix to scrub_raid56_parity ]
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/btrfs/scrub.c | 2 +-
fs/btrfs/volumes.c | 2 +-
fs/btrfs/volumes.h | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -2858,7 +2858,7 @@ static noinline_for_stack int scrub_raid
int extent_mirror_num;
int stop_loop = 0;
- nsectors = map->stripe_len / root->sectorsize;
+ nsectors = div_u64(map->stripe_len, root->sectorsize);
bitmap_len = scrub_calc_parity_bitmap_len(nsectors);
sparity = kzalloc(sizeof(struct scrub_parity) + 2 * bitmap_len,
GFP_NOFS);
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -6249,7 +6249,7 @@ static int read_one_chunk(struct btrfs_r
"invalid chunk length %llu", length);
return -EIO;
}
- if (!is_power_of_2(stripe_len)) {
+ if (!is_power_of_2(stripe_len) || stripe_len != BTRFS_STRIPE_LEN) {
btrfs_err(root->fs_info, "invalid chunk stripe length: %llu",
stripe_len);
return -EIO;
--- a/fs/btrfs/volumes.h
+++ b/fs/btrfs/volumes.h
@@ -347,7 +347,7 @@ struct map_lookup {
u64 type;
int io_align;
int io_width;
- int stripe_len;
+ u64 stripe_len;
int sector_size;
int num_stripes;
int sub_stripes;
Patches currently in stable-queue which might be from bo.li.liu@oracle.com are
queue-4.5/btrfs-fix-unexpected-return-value-of-fiemap.patch
queue-4.5/btrfs-do-not-create-empty-block-group-if-we-have-allocated-data.patch
queue-4.5/btrfs-fix-divide-error-upon-chunk-s-stripe_len.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: fix divide error upon chunk's stripe_len" 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.