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 <dave.hansen@intel.com> Closes: https://lore.kernel.org/linux-usb/700df3c4-2f6c-85f9-6c61-065bc5b2db3a@intel.com/ Suggested-by: Dave Hansen <dave.hansen@intel.com> Suggested-by: Mario Limonciello <mario.limonciello@amd.com> Cc: Saranya Gopal <saranya.gopal@intel.com> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Cc: Thorsten Leemhuis <regressions@leemhuis.info> Link: https://lore.kernel.org/r/20230906084842.1922052-1-heikki.krogerus@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
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)