Skip to content

Commit f26a679

Browse files
Heikki Krogerusgregkh
authored andcommitted
usb: typec: ucsi: Fix NULL pointer dereference
Making sure the UCSI debugfs entry actually exists before attempting to remove it. Fixes: df0383f ("usb: typec: ucsi: Add debugfs for ucsi commands") Reported-by: Dave Hansen <[email protected]> Closes: https://lore.kernel.org/linux-usb/[email protected]/ Suggested-by: Dave Hansen <[email protected]> Suggested-by: Mario Limonciello <[email protected]> Cc: Saranya Gopal <[email protected]> Signed-off-by: Heikki Krogerus <[email protected]> Cc: Thorsten Leemhuis <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 0bb80ec commit f26a679

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/usb/typec/ucsi/debugfs.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ void ucsi_debugfs_register(struct ucsi *ucsi)
8484

8585
void ucsi_debugfs_unregister(struct ucsi *ucsi)
8686
{
87+
if (IS_ERR_OR_NULL(ucsi) || !ucsi->debugfs)
88+
return;
89+
8790
debugfs_remove_recursive(ucsi->debugfs->dentry);
8891
kfree(ucsi->debugfs);
8992
}

0 commit comments

Comments
 (0)