Skip to contentSkip to conversation

mm-fix-__dump_page-when-mapping-host-is-not-set.patch removed from -mm tree

merged [email protected] 1 participant 1 message Apr 1, 2019 Stable branch

lore
Share & tools
lore

[email protected]

author tree notice Applied
#0 lore raw

The patch titled

     Subject: mm/debug.c: fix __dump_page when mapping->host is not set

has been removed from the -mm tree. Its filename was
mm-fix-__dump_page-when-mapping-host-is-not-set.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Oscar Salvador <[email protected]>
Subject: mm/debug.c: fix __dump_page when mapping->host is not set

While debugging something, I added a dump_page() into do_swap_page(), and I got the splat from below. The issue happens when dereferencing mapping->host in __dump_page():

...

else if (mapping) {
	pr_warn("%ps ", mapping->a_ops);
	if (mapping->host->i_dentry.first) {
		struct dentry *dentry;
		dentry = container_of(mapping->host->i_dentry.first, struct dentry, d_u.d_alias);
		pr_warn("name:\"%pd\" ", dentry);
	}
}

...

Swap address space does not contain an inode information, and so mapping->host equals NULL.

Although the dump_page() call was added artificially into do_swap_page(), I am not sure if we can hit this from any other path, so it looks worth fixing it. We can easily do that by checking mapping->host first.

---

 mm/debug.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/debug.c renamed from mm/debug.c~mm-fix-__dump_page-when-mapping-host-is-not-set +1 -1
@@ -79,7 +79,7 @@ void __dump_page(struct page *page, cons
 		pr_warn("ksm ");
 	else if (mapping) {
 		pr_warn("%ps ", mapping->a_ops);
-		if (mapping->host->i_dentry.first) {
+		if (mapping->host && mapping->host->i_dentry.first) {
 			struct dentry *dentry;
 			dentry = container_of(mapping->host->i_dentry.first, struct dentry, d_u.d_alias);
 			pr_warn("name:\"%pd\" ", dentry);

_

Patches currently in -mm which might be from [email protected] are

mmmemory_hotplug-unlock-1gb-hugetlb-on-x86_64.patch mmmemory_hotplug-drop-redundant-hugepage_migration_supported-check.patch