All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: Greg KH <gregkh@linuxfoundation.org>,
	"Schmid, Carsten" <Carsten_Schmid@mentor.com>
Cc: USB list <linux-usb@vger.kernel.org>
Subject: Re: Possible race in 4.14 xhci stack
Date: Fri, 23 Jul 2021 22:43:43 +0300	[thread overview]
Message-ID: <9389e25a-d9e8-e0bf-d310-6a2b0a23e990@linux.intel.com> (raw)
In-Reply-To: <YPfXZBtd48oL7DaQ@kroah.com>

On 21.7.2021 11.14, Greg KH wrote:
> On Wed, Jul 21, 2021 at 07:51:58AM +0000, Schmid, Carsten wrote:
>> Hi Greg,
>>
>>>> Hi Mathias,
>>>>
>>>> i got a NULL pointer deref in the usbfs and analyzed it.
>>>> The connected device seemed to have trouble on USB transmissions.
>>>> However, I have the impression that there is a race between finishing URB handling and disconnection of devices.
>>>> In detail:
>>>> [ 4979.029666] xhci_hcd 0000:00:15.0: USB transfer error. Maybe the USB cable is bad?
>>>
>>> Did your cable die?
>>>
>>> And 4.14 is quite old, what about 5.13?
>>>
>>> thanks,
>>>
>>> greg k-h
>>
>> That was reported from a device in the field.
>> Yes, a defective cable is bad, but shouldn't the kernel's health avoid a NULL pointer deref?
> 
> Yes, I am not disagreeing about that, patches always welcome :)

Current kernel already has a cure for the symptom, avoiding the NULL pointer deref:

struct xhci_ring *xhci_triad_to_transfer_ring(...)
{
	struct xhci_virt_ep *ep;

	ep = xhci_get_virt_ep(xhci, slot_id, ep_index);
	if (!ep)
		return NULL;
	...
}

I'm still on vacation next week, but after that we could look closer at the root cause.

Thanks,
Mathias

  reply	other threads:[~2021-07-23 19:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-20 15:04 Possible race in 4.14 xhci stack Schmid, Carsten
2021-07-20 16:11 ` Greg KH
2021-07-21  7:51   ` Schmid, Carsten
2021-07-21  8:14     ` Greg KH
2021-07-23 19:43       ` Mathias Nyman [this message]
2021-07-26  7:10         ` Schmid, Carsten

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=9389e25a-d9e8-e0bf-d310-6a2b0a23e990@linux.intel.com \
    --to=mathias.nyman@linux.intel.com \
    --cc=Carsten_Schmid@mentor.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.