[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250113030702.58502-1-zhuxiaohui.400@bytedance.com>
Date: Mon, 13 Jan 2025 11:07:02 +0800
From: zhuxiaohui <zhuxiaohui400@...il.com>
To: muchun.song@...ux.dev,
rostedt@...dmis.org,
mhiramat@...nel.org,
linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
linux-trace-kernel@...r.kernel.org
Cc: lihongbo22@...wei.com,
Xiaohui Zhu <zhuxiaohui.400@...edance.com>
Subject: [PATCH] hugetlbfs: check dir in trace_hugetlbfs_alloc_inode
From: Xiaohui Zhu <zhuxiaohui.400@...edance.com>
Anonymous huge page has no corresponding directory inode,
which cause a null pointer crash when access dir with the stack
trace_hugetlbfs_alloc_inode
hugetlbfs_get_inode
hugetlb_file_setup
ksys_mmap_pgoff
Signed-off-by: Xiaohui Zhu <zhuxiaohui.400@...edance.com>
---
include/trace/events/hugetlbfs.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/include/trace/events/hugetlbfs.h b/include/trace/events/hugetlbfs.h
index 8331c904a9ba..5daa52053edc 100644
--- a/include/trace/events/hugetlbfs.h
+++ b/include/trace/events/hugetlbfs.h
@@ -23,7 +23,9 @@ TRACE_EVENT(hugetlbfs_alloc_inode,
TP_fast_assign(
__entry->dev = inode->i_sb->s_dev;
__entry->ino = inode->i_ino;
- __entry->dir = dir->i_ino;
+ __entry->dir = 0;
+ if (dir)
+ __entry->dir = dir->i_ino;
__entry->mode = mode;
),
--
2.41.0
Powered by blists - more mailing lists