From 8c229b794b6f165321a9d38afbd58451225296f2 Mon Sep 17 00:00:00 2001 From: Omar Sandoval Date: Thu, 2 May 2019 08:09:48 -0700 Subject: [PATCH] helpers: handle inodes with no aliases in inode_path() --- drgn/helpers/linux/fs.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drgn/helpers/linux/fs.py b/drgn/helpers/linux/fs.py index e4fea12a..0b140f09 100644 --- a/drgn/helpers/linux/fs.py +++ b/drgn/helpers/linux/fs.py @@ -13,7 +13,11 @@ import os from drgn import Program, container_of from drgn.helpers import escape_string -from drgn.helpers.linux.list import hlist_for_each_entry, list_for_each_entry +from drgn.helpers.linux.list import ( + hlist_empty, + hlist_for_each_entry, + list_for_each_entry, +) __all__ = [ 'd_path', @@ -94,6 +98,8 @@ def inode_path(inode): Return any path of an inode from the root of its filesystem. """ + if hlist_empty(inode.i_dentry): + return None return dentry_path(container_of(inode.i_dentry.first, 'struct dentry', 'd_u.d_alias'))