public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Zhengqiao Xia <xiazhengqiao@huaqin.corp-partner.google.com>
Cc: rafael@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] device_core: check null pointer
Date: Mon, 17 Nov 2025 07:37:51 -0500	[thread overview]
Message-ID: <2025111720-sensitize-schnapps-3189@gregkh> (raw)
In-Reply-To: <CADYyEwQQOfvAtEfqMNrcLROHcMZmPQWJxuKSugHDeK_SHk-EQw@mail.gmail.com>

On Mon, Nov 17, 2025 at 10:55:05AM +0800, Zhengqiao Xia wrote:
> Hi Greg,
> 
> Based on my analysis,

Please do not top-post :(

> 
> usb_new_device ->  device_add -> device_private_init
>                                                     ->
> bus_probe_device -> usb_generic_driver_probe  ->
> usb_set_configuration  -> "add each interface"  ->
> device_add(&intf->dev);
> 
> 
>                                     --> if of_node status is disabled
> -> of_device_is_available is false -> not running  device_add ->

Why is of_node related to USB interfaces?

> interface dev->p is null
> usbdev_ioctl -> proc_ioctl -> device_attach -> __device_attach ->
> device_attach ->  if (dev->p->dead)
> 
> Since dev->p has not been created at this time, dev->p is NULL,  So I
> think we should add a check here.
> 
> Here is my current analysis, but there may be some misunderstandings
> or mistakes in it. Could you please help clarify my confusion?

As this code is very old, USB was one of the first subsystems to get
driver core support decades ago, what has changed recently to require
this check?  Have you seen crashes here?  If so, what is the traceback
for them and with what hardware/drivers?

thanks,

greg k-h

  reply	other threads:[~2025-11-17 12:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-14 14:18 [PATCH] device_core: check null pointer Zhengqiao Xia
2025-11-15 20:16 ` Greg KH
2025-11-17  2:55   ` Zhengqiao Xia
2025-11-17 12:37     ` Greg KH [this message]
2025-11-18  7:31       ` Zhengqiao Xia
2025-11-27  9:54         ` Greg KH
2025-11-27 11:37           ` Zhengqiao Xia
2025-11-27 11:51             ` Greg KH
2025-11-27 12:34               ` Zhengqiao Xia
2025-11-27 12:42                 ` Greg KH
2025-11-27 12:51                   ` Zhengqiao Xia

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=2025111720-sensitize-schnapps-3189@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=xiazhengqiao@huaqin.corp-partner.google.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