Commit 7aba3d62 authored by Wupeng Ma's avatar Wupeng Ma
Browse files

Revert "arm64: mm: add mc support for __buffer_migrate_page"

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IB0OV7



--------------------------------

This reverts commit 19e1c506.

During our test, it is found that this will lead to NULL pointer
dereference as follow:

  Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
  pc : __find_get_block_slow+0xbc/0x29c
  lr : __find_get_block_slow+0x50/0x29c
  Call trace:
   __find_get_block_slow+0xbc/0x29c
   __find_get_block+0xa8/0xd0
   __getblk_gfp+0x30/0x84
   ext4_getblk+0x90/0x244 [ext4]
   ext4_bread+0x1c/0x10c [ext4]
   __ext4_read_dirblock.part.0+0x48/0x32c [ext4]
   ext4_dx_find_entry+0xb0/0x220 [ext4]
   __ext4_find_entry+0x3f0/0x470 [ext4]
   ext4_lookup.part.0+0x5c/0x240 [ext4]
   ext4_lookup+0x2c/0x50 [ext4]
   lookup_open.isra.0+0x1d4/0x3c4
   open_last_lookups+0x36c/0x3d0
   path_openat+0x8c/0x1f0
   do_filp_open+0x88/0x150
   do_open_execat+0x78/0x1cc
   alloc_bprm+0x30/0x180

Revert this for a better solution.

Fixes: 19e1c506 ("arm64: mm: add mc support for __buffer_migrate_page")
Signed-off-by: default avatarWupeng Ma <mawupeng1@huawei.com>
parent ad453b4d
Loading
Loading
Loading
Loading
+1 −11
Original line number Diff line number Diff line
@@ -820,7 +820,6 @@ static int __buffer_migrate_page(struct address_space *mapping,
	struct buffer_head *bh, *head;
	int rc;
	int expected_count;
	bool copy_done = false;

	if (!page_has_buffers(page))
		return migrate_page(mapping, newpage, page, mode);
@@ -861,13 +860,7 @@ static int __buffer_migrate_page(struct address_space *mapping,
		}
	}

	if (IS_ENABLED(CONFIG_ARM64) && IS_ENABLED(CONFIG_ARCH_HAS_COPY_MC) &&
	    (mode != MIGRATE_SYNC_NO_COPY)) {
		rc = migrate_page_mc_extra(mapping, newpage, page, mode, 0);
		copy_done = true;
	} else {
	rc = migrate_page_move_mapping(mapping, newpage, page, 0);
	}
	if (rc != MIGRATEPAGE_SUCCESS)
		goto unlock_buffers;

@@ -880,9 +873,6 @@ static int __buffer_migrate_page(struct address_space *mapping,

	} while (bh != head);

	if (copy_done)
		goto unlock_buffers;

	if (mode != MIGRATE_SYNC_NO_COPY)
		migrate_page_copy(newpage, page);
	else