* [PATCH] btrfs: tree-checker: add missing returns after data_ref alignment checks
@ 2020-11-20 15:55 David Sterba
2020-11-20 22:51 ` Qu Wenruo
0 siblings, 1 reply; 2+ messages in thread
From: David Sterba @ 2020-11-20 15:55 UTC (permalink / raw)
To: linux-btrfs; +Cc: David Sterba, stable
There are sectorsize alignment checks that are reported but then
check_extent_data_ref continues. This was not intended, wrong alignment
is not a minor problem and we should return with error.
CC: stable@vger.kernel.org # 5.4+
Fixes: 0785a9aacf9d ("btrfs: tree-checker: Add EXTENT_DATA_REF check")
Signed-off-by: David Sterba <dsterba@suse.com>
---
fs/btrfs/tree-checker.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/btrfs/tree-checker.c b/fs/btrfs/tree-checker.c
index 1b27242a9c0b..f3f666b343ef 100644
--- a/fs/btrfs/tree-checker.c
+++ b/fs/btrfs/tree-checker.c
@@ -1424,6 +1424,7 @@ static int check_extent_data_ref(struct extent_buffer *leaf,
"invalid item size, have %u expect aligned to %zu for key type %u",
btrfs_item_size_nr(leaf, slot),
sizeof(*dref), key->type);
+ return -EUCLEAN;
}
if (!IS_ALIGNED(key->objectid, leaf->fs_info->sectorsize)) {
generic_err(leaf, slot,
@@ -1452,6 +1453,7 @@ static int check_extent_data_ref(struct extent_buffer *leaf,
extent_err(leaf, slot,
"invalid extent data backref offset, have %llu expect aligned to %u",
offset, leaf->fs_info->sectorsize);
+ return -EUCLEAN;
}
}
return 0;
--
2.25.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] btrfs: tree-checker: add missing returns after data_ref alignment checks
2020-11-20 15:55 [PATCH] btrfs: tree-checker: add missing returns after data_ref alignment checks David Sterba
@ 2020-11-20 22:51 ` Qu Wenruo
0 siblings, 0 replies; 2+ messages in thread
From: Qu Wenruo @ 2020-11-20 22:51 UTC (permalink / raw)
To: David Sterba, linux-btrfs; +Cc: stable
[-- Attachment #1.1: Type: text/plain, Size: 1396 bytes --]
On 2020/11/20 下午11:55, David Sterba wrote:
> There are sectorsize alignment checks that are reported but then
> check_extent_data_ref continues. This was not intended, wrong alignment
> is not a minor problem and we should return with error.
>
> CC: stable@vger.kernel.org # 5.4+
> Fixes: 0785a9aacf9d ("btrfs: tree-checker: Add EXTENT_DATA_REF check")
> Signed-off-by: David Sterba <dsterba@suse.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Thanks,
Qu
> ---
> fs/btrfs/tree-checker.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/fs/btrfs/tree-checker.c b/fs/btrfs/tree-checker.c
> index 1b27242a9c0b..f3f666b343ef 100644
> --- a/fs/btrfs/tree-checker.c
> +++ b/fs/btrfs/tree-checker.c
> @@ -1424,6 +1424,7 @@ static int check_extent_data_ref(struct extent_buffer *leaf,
> "invalid item size, have %u expect aligned to %zu for key type %u",
> btrfs_item_size_nr(leaf, slot),
> sizeof(*dref), key->type);
> + return -EUCLEAN;
> }
> if (!IS_ALIGNED(key->objectid, leaf->fs_info->sectorsize)) {
> generic_err(leaf, slot,
> @@ -1452,6 +1453,7 @@ static int check_extent_data_ref(struct extent_buffer *leaf,
> extent_err(leaf, slot,
> "invalid extent data backref offset, have %llu expect aligned to %u",
> offset, leaf->fs_info->sectorsize);
> + return -EUCLEAN;
> }
> }
> return 0;
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-11-20 22:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-20 15:55 [PATCH] btrfs: tree-checker: add missing returns after data_ref alignment checks David Sterba
2020-11-20 22:51 ` Qu Wenruo
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).