linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org,
	Yehezkel Bernat <YehezkelShB@gmail.com>,
	Michael Jamet <michael.jamet@intel.com>,
	Paulian Bogdan Marinca <paulian@marinca.net>,
	Andreas Noever <andreas.noever@gmail.com>,
	Lukas Wunner <lukas@wunner.de>
Subject: Re: [PATCH v2] thunderbolt: Fix use-after-free in remove_unplugged_switch()
Date: Thu, 19 Nov 2020 16:48:12 +0200	[thread overview]
Message-ID: <20201119144812.GL2495@lahna.fi.intel.com> (raw)
In-Reply-To: <X7YvrflfJf+I/5BX@kroah.com>

On Thu, Nov 19, 2020 at 09:41:17AM +0100, Greg Kroah-Hartman wrote:
> On Thu, Nov 19, 2020 at 11:34:29AM +0300, Mika Westerberg wrote:
> > Paulian reported a crash that happens when a dock is unplugged during
> > hibernation:
> > 
> > [78436.228217] thunderbolt 0-1: device disconnected
> > [78436.228365] BUG: kernel NULL pointer dereference, address: 00000000000001e0
> > ...
> > [78436.228397] RIP: 0010:icm_free_unplugged_children+0x109/0x1a0
> > ...
> > [78436.228432] Call Trace:
> > [78436.228439]  icm_rescan_work+0x24/0x30
> > [78436.228444]  process_one_work+0x1a3/0x3a0
> > [78436.228449]  worker_thread+0x30/0x370
> > [78436.228454]  ? process_one_work+0x3a0/0x3a0
> > [78436.228457]  kthread+0x13d/0x160
> > [78436.228461]  ? kthread_park+0x90/0x90
> > [78436.228465]  ret_from_fork+0x1f/0x30
> > 
> > This happens because remove_unplugged_switch() calls tb_switch_remove()
> > that releases the memory pointed by sw so the following lines reference
> > to a memory that might be released already.
> > 
> > Fix this by saving pointer to the parent device before calling
> > tb_switch_remove().
> > 
> > Reported-by: Paulian Bogdan Marinca <paulian@marinca.net>
> > Fixes: 4f7c2e0d8765 ("thunderbolt: Make sure device runtime resume completes before taking domain lock")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> > ---
> 
> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Thanks!

Applied to thunderbolt.git/fixes.

      reply	other threads:[~2020-11-19 14:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-19  8:34 [PATCH v2] thunderbolt: Fix use-after-free in remove_unplugged_switch() Mika Westerberg
2020-11-19  8:41 ` Greg Kroah-Hartman
2020-11-19 14:48   ` Mika Westerberg [this message]

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=20201119144812.GL2495@lahna.fi.intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=YehezkelShB@gmail.com \
    --cc=andreas.noever@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=michael.jamet@intel.com \
    --cc=paulian@marinca.net \
    /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).