Commit f26a679e authored by Heikki Krogerus's avatar Heikki Krogerus Committed by Greg Kroah-Hartman

usb: typec: ucsi: Fix NULL pointer dereference

Making sure the UCSI debugfs entry actually exists before
attempting to remove it.

Fixes: df0383ff ("usb: typec: ucsi: Add debugfs for ucsi commands")
Reported-by: default avatarDave Hansen <dave.hansen@intel.com>
Closes: https://lore.kernel.org/linux-usb/700df3c4-2f6c-85f9-6c61-065bc5b2db3a@intel.com/Suggested-by: default avatarDave Hansen <dave.hansen@intel.com>
Suggested-by: default avatarMario Limonciello <mario.limonciello@amd.com>
Cc: Saranya Gopal <saranya.gopal@intel.com>
Signed-off-by: default avatarHeikki 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.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0bb80ecc
......@@ -84,6 +84,9 @@ void ucsi_debugfs_register(struct ucsi *ucsi)
void ucsi_debugfs_unregister(struct ucsi *ucsi)
{
if (IS_ERR_OR_NULL(ucsi) || !ucsi->debugfs)
return;
debugfs_remove_recursive(ucsi->debugfs->dentry);
kfree(ucsi->debugfs);
}
......
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