]> Git Repo - linux.git/blobdiff - fs/btrfs/inode.c
Merge tag 'for-5.9-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux
[linux.git] / fs / btrfs / inode.c
index 6dc03bab0c9d1b51c3f8572d046c8ac4b49560c3..51fcd82d41c0ebec1fceb671dc23e40492941e6f 100644 (file)
@@ -654,12 +654,18 @@ cont:
                                                     page_error_op |
                                                     PAGE_END_WRITEBACK);
 
-                       for (i = 0; i < nr_pages; i++) {
-                               WARN_ON(pages[i]->mapping);
-                               put_page(pages[i]);
+                       /*
+                        * Ensure we only free the compressed pages if we have
+                        * them allocated, as we can still reach here with
+                        * inode_need_compress() == false.
+                        */
+                       if (pages) {
+                               for (i = 0; i < nr_pages; i++) {
+                                       WARN_ON(pages[i]->mapping);
+                                       put_page(pages[i]);
+                               }
+                               kfree(pages);
                        }
-                       kfree(pages);
-
                        return 0;
                }
        }
@@ -6622,7 +6628,7 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
            extent_type == BTRFS_FILE_EXTENT_PREALLOC) {
                /* Only regular file could have regular/prealloc extent */
                if (!S_ISREG(inode->vfs_inode.i_mode)) {
-                       ret = -EUCLEAN;
+                       err = -EUCLEAN;
                        btrfs_crit(fs_info,
                "regular/prealloc extent found for non-regular inode %llu",
                                   btrfs_ino(inode));
This page took 0.034347 seconds and 4 git commands to generate.