Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1219183 > unrolled thread

[PATCH] writeback: verify that underlying dev exists before getting its name

Started bySasha Levin <sasha.levin@oracle.com>
First post2015-09-04 19:00 +0200
Last post2015-09-04 19:00 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] writeback: verify that underlying dev exists before getting its name Sasha Levin <sasha.levin@oracle.com> - 2015-09-04 19:00 +0200

#1219183 — [PATCH] writeback: verify that underlying dev exists before getting its name

FromSasha Levin <sasha.levin@oracle.com>
Date2015-09-04 19:00 +0200
Subject[PATCH] writeback: verify that underlying dev exists before getting its name
Message-ID<q52lB-7Jv-33@gated-at.bofh.it>
We can't assume there is always an underlying device and must verify that
as well. Otherwise, we'd deref a NULL ptr here.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
 include/trace/events/writeback.h |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h
index fff846b..8f9efaa 100644
--- a/include/trace/events/writeback.h
+++ b/include/trace/events/writeback.h
@@ -66,7 +66,9 @@ TRACE_EVENT(writeback_dirty_page,
 
 	TP_fast_assign(
 		strncpy(__entry->name,
-			mapping ? dev_name(inode_to_bdi(mapping->host)->dev) : "(unknown)", 32);
+			mapping && inode_to_bdi(mapping->host)->dev ?
+				dev_name(inode_to_bdi(mapping->host)->dev) :
+				"(unknown)", 32);
 		__entry->ino = mapping ? mapping->host->i_ino : 0;
 		__entry->index = page->index;
 	),
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web