delete_procfs_entries: fix possible crash if top entry has no children

Change-Id: I209842699615f9bb58c12ccd262ae4b17f8f558c
This commit is contained in:
tinhnt86
2020-10-08 16:51:29 +07:00
committed by Masamichi Takagi
parent 442045a320
commit 3cc98883f5

View File

@ -126,7 +126,7 @@ find_procfs_entry(struct procfs_list_entry *parent, const char *name)
static void
delete_procfs_entries(struct procfs_list_entry *top)
{
struct procfs_list_entry *e;
struct procfs_list_entry *e = NULL;
struct procfs_list_entry *n;
list_del(&top->list);
@ -136,8 +136,10 @@ delete_procfs_entries(struct procfs_list_entry *top)
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
e->entry->read_proc = NULL;
e->entry->data = NULL;
if (e) {
e->entry->read_proc = NULL;
e->entry->data = NULL;
}
#endif
remove_proc_entry(top->name, top->parent? top->parent->entry: NULL);
if(top->data)