Message ID | 20200326053556.20492-3-wqu@suse.com |
---|---|
State | Accepted |
Commit | a62db245265bd898feaab3f035c5b5f99bf4ea6c |
Delegated to: | Tom Rini |
Headers | show |
Series | fs: btrfs: Fix false LZO decompression error due to missing page boundary check | expand |
On Thu, 26 Mar 2020 13:35:55 +0800 Qu Wenruo <wqu@suse.com> wrote: > Although in theory u-boot fs driver could easily support more sector > sizes, current code base doesn't have good enough way to grab sector > size yet. > > This would cause problem for later LZO fixes which rely on sector size. > > And considering that most u-boot boards are using 4K page size, which is > also the most common sector size for btrfs, rejecting fs with > non-page-sized sector size shouldn't cause much problem. > > This should only be a quick fix before we implement better sector size > support. > > Signed-off-by: Qu Wenruo <wqu@suse.com> > Cc: Marek Behun <marek.behun@nic.cz> > --- > fs/btrfs/super.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c > index 2dc4a6fcd7a3..b693a073fc0b 100644 > --- a/fs/btrfs/super.c > +++ b/fs/btrfs/super.c > @@ -7,6 +7,7 @@ > > #include "btrfs.h" > #include <memalign.h> > +#include <linux/compat.h> > > #define BTRFS_SUPER_FLAG_SUPP (BTRFS_HEADER_FLAG_WRITTEN \ > | BTRFS_HEADER_FLAG_RELOC \ > @@ -232,6 +233,13 @@ int btrfs_read_superblock(void) > return -1; > } > > + if (sb->sectorsize != PAGE_SIZE) { > + printf( > + "%s: Unsupported sector size (%u), only supports %u as sector size\n", > + __func__, sb->sectorsize, PAGE_SIZE); > + return -1; > + } > + > if (btrfs_info.sb.num_devices != 1) { > printf("%s: Unsupported number of devices (%lli). This driver " > "only supports filesystem on one device.\n", __func__, Reviewed-by: Marek Behún <marek.behun@nic.cz>
On Thu, Mar 26, 2020 at 01:35:55PM +0800, Qu Wenruo wrote: > Although in theory u-boot fs driver could easily support more sector > sizes, current code base doesn't have good enough way to grab sector > size yet. > > This would cause problem for later LZO fixes which rely on sector size. > > And considering that most u-boot boards are using 4K page size, which is > also the most common sector size for btrfs, rejecting fs with > non-page-sized sector size shouldn't cause much problem. > > This should only be a quick fix before we implement better sector size > support. > > Signed-off-by: Qu Wenruo <wqu@suse.com> > Cc: Marek Behun <marek.behun@nic.cz> > Reviewed-by: Marek Behún <marek.behun@nic.cz> Applied to u-boot/master, thanks!
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 2dc4a6fcd7a3..b693a073fc0b 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -7,6 +7,7 @@ #include "btrfs.h" #include <memalign.h> +#include <linux/compat.h> #define BTRFS_SUPER_FLAG_SUPP (BTRFS_HEADER_FLAG_WRITTEN \ | BTRFS_HEADER_FLAG_RELOC \ @@ -232,6 +233,13 @@ int btrfs_read_superblock(void) return -1; } + if (sb->sectorsize != PAGE_SIZE) { + printf( + "%s: Unsupported sector size (%u), only supports %u as sector size\n", + __func__, sb->sectorsize, PAGE_SIZE); + return -1; + } + if (btrfs_info.sb.num_devices != 1) { printf("%s: Unsupported number of devices (%lli). This driver " "only supports filesystem on one device.\n", __func__,
Although in theory u-boot fs driver could easily support more sector sizes, current code base doesn't have good enough way to grab sector size yet. This would cause problem for later LZO fixes which rely on sector size. And considering that most u-boot boards are using 4K page size, which is also the most common sector size for btrfs, rejecting fs with non-page-sized sector size shouldn't cause much problem. This should only be a quick fix before we implement better sector size support. Signed-off-by: Qu Wenruo <wqu@suse.com> Cc: Marek Behun <marek.behun@nic.cz> --- fs/btrfs/super.c | 8 ++++++++ 1 file changed, 8 insertions(+)