public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mario Limonciello <mario.limonciello@amd.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: "Dave Hansen" <dave.hansen@intel.com>,
	LKML <linux-kernel@vger.kernel.org>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Saranya Gopal" <saranya.gopal@intel.com>,
	"Rajaram Regupathy" <rajaram.regupathy@intel.com>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Wayne Chang" <waynec@nvidia.com>,
	"Hans de Goede" <hdegoede@redhat.com>,
	"Neil Armstrong" <neil.armstrong@linaro.org>,
	linux-usb@vger.kernel.org
Subject: Re: [PATCH] usb: typec: ucsi: Fix NULL pointer dereference
Date: Wed, 6 Sep 2023 07:05:21 -0500	[thread overview]
Message-ID: <288ac4c1-b66d-477a-ba2e-9b8d8dde4dc6@amd.com> (raw)
In-Reply-To: <2023090638-overexert-endearing-3726@gregkh>

On 9/6/2023 03:57, Greg Kroah-Hartman wrote:
> On Wed, Sep 06, 2023 at 11:48:42AM +0300, Heikki Krogerus wrote:
>> 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@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>

I could also reproduce it with 7733171926cc336ddf0c8f847eefaff569dbff86 
on two different laptops.

>> ---
>>   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);
> 
> Why are you saving the dentry at all?  Why not just have debugfs look it
> up when you want to remove it based on the filename?
> 
> Anyway, not a big deal here, just a comment.  I'll queue this up after
> -rc1 is out.

It might be worth sending before rc1 if it ends up being widespread.

> 
> thanks,
> 
> greg k-h


  reply	other threads:[~2023-09-06 12:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-06  8:48 [PATCH] usb: typec: ucsi: Fix NULL pointer dereference Heikki Krogerus
2023-09-06  8:57 ` Greg Kroah-Hartman
2023-09-06 12:05   ` Mario Limonciello [this message]
2023-09-11  9:46     ` Thorsten Leemhuis
2023-09-11 11:52       ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=288ac4c1-b66d-477a-ba2e-9b8d8dde4dc6@amd.com \
    --to=mario.limonciello@amd.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=dave.hansen@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hdegoede@redhat.com \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=rajaram.regupathy@intel.com \
    --cc=saranya.gopal@intel.com \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=waynec@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox