lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230906084842.1922052-1-heikki.krogerus@linux.intel.com>
Date:   Wed,  6 Sep 2023 11:48:42 +0300
From:   Heikki Krogerus <heikki.krogerus@...ux.intel.com>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
        Dave Hansen <dave.hansen@...el.com>,
        Mario Limonciello <mario.limonciello@....com>,
        Saranya Gopal <saranya.gopal@...el.com>
Subject: [PATCH] usb: typec: ucsi: Fix NULL pointer dereference

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

Fixes: df0383ffad64 ("usb: typec: ucsi: Add debugfs for ucsi commands")
Reported-by: Dave Hansen <dave.hansen@...el.com>
Closes: https://lore.kernel.org/linux-usb/700df3c4-2f6c-85f9-6c61-065bc5b2db3a@intel.com/
Suggested-by: Dave Hansen <dave.hansen@...el.com>
Suggested-by: Mario Limonciello <mario.limonciello@....com>
Cc: Saranya Gopal <saranya.gopal@...el.com>
Signed-off-by: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
---
 drivers/usb/typec/ucsi/debugfs.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/typec/ucsi/debugfs.c b/drivers/usb/typec/ucsi/debugfs.c
index 0c7bf88d4a7f..f67733cecfdf 100644
--- a/drivers/usb/typec/ucsi/debugfs.c
+++ b/drivers/usb/typec/ucsi/debugfs.c
@@ -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);
 }
-- 
2.40.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ