Commit fa976e5e authored by Yisheng Xie's avatar Yisheng Xie Committed by Greg Kroah-Hartman

staging: android: ion: Avoid NULL point in error path

If we failed to create debugfs for ion at ion_device_create, the
debug_root of ion_device will be NULL, and then when try to create debug
file for shrinker of heap it will be create on the top of debugfs. If we
also failed to create this the debug file, it call dentry_path to found
the path of debug_root, then a NULL point will occur.

Fix this by avoiding call dentry_path, but show the debug name only when
failed to create debug file for shrinker.
Acked-by: default avatarLaura Abbott <labbott@redhat.com>
Signed-off-by: default avatarYisheng Xie <xieyisheng1@huawei.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f3b0b012
...@@ -564,13 +564,9 @@ void ion_device_add_heap(struct ion_heap *heap) ...@@ -564,13 +564,9 @@ void ion_device_add_heap(struct ion_heap *heap)
debug_file = debugfs_create_file(debug_name, debug_file = debugfs_create_file(debug_name,
0644, dev->debug_root, heap, 0644, dev->debug_root, heap,
&debug_shrink_fops); &debug_shrink_fops);
if (!debug_file) { if (!debug_file)
char buf[256], *path; pr_err("Failed to create ion heap shrinker debugfs at %s\n",
debug_name);
path = dentry_path(dev->debug_root, buf, 256);
pr_err("Failed to create heap shrinker debugfs at %s/%s\n",
path, debug_name);
}
} }
dev->heap_cnt++; dev->heap_cnt++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment