stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: Oliver Neukum <oneukum@suse.com>, gregkh@linuxfoundation.org
Cc: linux-usb@vger.kernel.org, Gavin Shan <gwshan@linux.vnet.ibm.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH 2/2] drivers/usb: Delete XHCI command timer if necessary
Date: Wed, 12 Aug 2015 13:55:34 +0300	[thread overview]
Message-ID: <55CB2626.3060000@linux.intel.com> (raw)
In-Reply-To: <1439280938.6524.2.camel@suse.com>

On 11.08.2015 11:15, Oliver Neukum wrote:
> On Mon, 2015-08-03 at 16:07 +0300, Mathias Nyman wrote:
>> From: Gavin Shan <gwshan@linux.vnet.ibm.com>
>>
>> When xhci_mem_cleanup() is called, it's possible that the command
>> timer isn't initialized and scheduled. For those cases, to delete
>> the command timer causes soft-lockup as below stack dump shows.
>>
>> The patch avoids deleting the command timer if it's not scheduled
>> with the help of timer_pending().
> 
> Are you sure this is safe? timer_pending() will not show you that
> the timer function is running. It looks like you introduced a race
> between timeout and cleanup.
> 

Looking at it in more detail you're right.

Fortunately this can only happen in cases where xhci is already hosed
(no command response for 5 seconds), and we are at the same time
anyway about to remove xhci.

Doesn't this mean that all cases with
if (timer_pending(&timer))
	del_timer_sync(&timer)

is just basically the same as a plain del_timer(&timer)?

Anyways, turns out that the error path in xhci initialization code can end up calling
del_timer_sync() before timer is initialized. This should be fixed by re-arranging
some code in xhci initialization instead.

Greg, should this be reverted in rc7?
I think that the possible side effect of this patch is still lesser the original
issue.     

Thanks for spotting this

-Mathias

  reply	other threads:[~2015-08-12 10:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1438607269-8977-1-git-send-email-mathias.nyman@linux.intel.com>
2015-08-03 13:07 ` [PATCH 1/2] xhci: fix off by one error in TRB DMA address boundary check Mathias Nyman
2015-08-03 13:07 ` [PATCH 2/2] drivers/usb: Delete XHCI command timer if necessary Mathias Nyman
2015-08-11  8:15   ` Oliver Neukum
2015-08-12 10:55     ` Mathias Nyman [this message]
2015-08-12 13:08       ` Oliver Neukum
2015-08-12 16:18       ` Greg KH

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=55CB2626.3060000@linux.intel.com \
    --to=mathias.nyman@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=gwshan@linux.vnet.ibm.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=oneukum@suse.com \
    --cc=stable@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).