Skip to content

Commit c3552ab

Browse files
lategoodbyegregkh
authored andcommitted
staging: vchiq_debugfs: Fix NPD in vchiq_dump_state
The commit 42a2f66 ("staging: vc04_services: Move global g_state to vchiq_state") falsely assumed that the debugfs entry vchiq/state was created with vchiq_instance as data. This causes now a NULL pointer derefence while trying to dump the vchiq state. So fix this by passing vchiq_state as data, because this is the relevant part here. Fixes: 42a2f66 ("staging: vc04_services: Move global g_state to vchiq_state") Signed-off-by: Stefan Wahren <[email protected]> Reviewed-by: Umang Jain <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent c3f38fa commit c3552ab

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1759,7 +1759,7 @@ static int vchiq_probe(struct platform_device *pdev)
17591759
if (err)
17601760
goto failed_platform_init;
17611761

1762-
vchiq_debugfs_init();
1762+
vchiq_debugfs_init(&mgmt->state);
17631763

17641764
dev_dbg(&pdev->dev, "arm: platform initialised - version %d (min %d)\n",
17651765
VCHIQ_VERSION, VCHIQ_VERSION_MIN);

drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ static int debugfs_trace_show(struct seq_file *f, void *offset)
4242

4343
static int vchiq_dump_show(struct seq_file *f, void *offset)
4444
{
45-
struct vchiq_instance *instance = f->private;
45+
struct vchiq_state *state = f->private;
4646

47-
vchiq_dump_state(f, instance->state);
47+
vchiq_dump_state(f, state);
4848

4949
return 0;
5050
}
@@ -121,12 +121,12 @@ void vchiq_debugfs_remove_instance(struct vchiq_instance *instance)
121121
debugfs_remove_recursive(node->dentry);
122122
}
123123

124-
void vchiq_debugfs_init(void)
124+
void vchiq_debugfs_init(struct vchiq_state *state)
125125
{
126126
vchiq_dbg_dir = debugfs_create_dir("vchiq", NULL);
127127
vchiq_dbg_clients = debugfs_create_dir("clients", vchiq_dbg_dir);
128128

129-
debugfs_create_file("state", S_IFREG | 0444, vchiq_dbg_dir, NULL,
129+
debugfs_create_file("state", S_IFREG | 0444, vchiq_dbg_dir, state,
130130
&vchiq_dump_fops);
131131
}
132132

drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ struct vchiq_debugfs_node {
1010
struct dentry *dentry;
1111
};
1212

13-
void vchiq_debugfs_init(void);
13+
void vchiq_debugfs_init(struct vchiq_state *state);
1414

1515
void vchiq_debugfs_deinit(void);
1616

0 commit comments

Comments
 (0)