Skip to contentSkip to conversation

mm: Fix __dump_page when mapping->host is not set

PATCH Applied Oscar Salvador 2 participants 2 messages Mar 18, 2019 – Mar 19, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 mm: Fix __dump_page when mapping->host is not set

Swap mapping->host is NULL, so let us protect __dump_page() for such cases.

Fixes 1c6fb1d89e73c ("mm: print more information about mapping in __dump_page")
---
 mm/debug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/debug.c +1 -1
index c0b31b6c3877..7759f12a8fbb 100644
@@ -79,7 +79,7 @@ void __dump_page(struct page *page, const char *reason)
 		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);
Signature · 1 line
2.13.7
Acked-by on v2 1/1
#1 lore raw
Quoted 1 line · Oscar Salvador

Swap mapping->host is NULL, so let us protect __dump_page() for such cases.

Thanks :)

Quoted 4 lines
Fixes 1c6fb1d89e73c ("mm: print more information about mapping in __dump_page")
Quoted 19 lines
---
 mm/debug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/debug.c +1 -1
index c0b31b6c3877..7759f12a8fbb 100644
@@ -79,7 +79,7 @@ void __dump_page(struct page *page, const char *reason)
 		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);
Signature · 1 line
2.13.7