reproduce:
  lzto@objd ~ $ ~/linux/tools/perf/perf record -I -e 
intel_pt/tsc=1,noretcomp=1/u /bin/ls
  lzto@objd ~ $ ~/linux/tools/perf/perf script  -F 
event,comm,pid,tid,time,addr,ip,sym,dso,iregs
  Segmentation fault
  lzto@objd ~ $

Upon further investigation, it seems that
commit 747a9b0a08ae ("Merge branch 'perf-urgent-for-linus' of 
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip")
breaks perf tool.

__list_del(): tools/include/linux/list.h does not check null pointer dereference

Signed-off-by: Tong Zhang <zt...@vt.edu>
---
 tools/include/linux/list.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/include/linux/list.h b/tools/include/linux/list.h
index 1da4238..1d644a0 100644
--- a/tools/include/linux/list.h
+++ b/tools/include/linux/list.h
@@ -85,8 +85,10 @@ static inline void list_add_tail(struct list_head *new, 
struct list_head *head)
  */
 static inline void __list_del(struct list_head * prev, struct list_head * next)
 {
-       next->prev = prev;
-       WRITE_ONCE(prev->next, next);
+       if (next)
+               next->prev = prev;
+       if (prev)
+               WRITE_ONCE(prev->next, next);
 }
 
 /**
-- 
2.4.10

Reply via email to