]> git.itanic.dy.fi Git - linux-stable/commitdiff
btrfs: print-tree: parent bytenr must be aligned to sector size
authorAnastasia Belova <abelova@astralinux.ru>
Wed, 26 Apr 2023 11:53:23 +0000 (14:53 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 May 2023 09:50:22 +0000 (11:50 +0200)
commit c87f318e6f47696b4040b58f460d5c17ea0280e6 upstream.

Check nodesize to sectorsize in alignment check in print_extent_item.
The comment states that and this is correct, similar check is done
elsewhere in the functions.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: ea57788eb76d ("btrfs: require only sector size alignment for parent eb bytenr")
CC: stable@vger.kernel.org # 4.14+
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Anastasia Belova <abelova@astralinux.ru>
Reviewed-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/print-tree.c

index aae1027bd76a1379e9397bef191b97ef3d978189..0757f133e302a3bab35d39d228909ca92c24d339 100644 (file)
@@ -147,10 +147,10 @@ static void print_extent_item(struct extent_buffer *eb, int slot, int type)
                        pr_cont("shared data backref parent %llu count %u\n",
                               offset, btrfs_shared_data_ref_count(eb, sref));
                        /*
-                        * offset is supposed to be a tree block which
-                        * must be aligned to nodesize.
+                        * Offset is supposed to be a tree block which must be
+                        * aligned to sectorsize.
                         */
-                       if (!IS_ALIGNED(offset, eb->fs_info->nodesize))
+                       if (!IS_ALIGNED(offset, eb->fs_info->sectorsize))
                                pr_info(
                        "\t\t\t(parent %llu not aligned to sectorsize %u)\n",
                                     offset, eb->fs_info->sectorsize);