[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190612103801.GW2640@lahna.fi.intel.com>
Date: Wed, 12 Jun 2019 13:38:01 +0300
From: Mika Westerberg <mika.westerberg@...ux.intel.com>
To: linux-kernel@...r.kernel.org
Cc: Andreas Noever <andreas.noever@...il.com>,
Michael Jamet <michael.jamet@...el.com>,
Yehezkel Bernat <YehezkelShB@...il.com>,
Pengfei Xu <pengfei.xu@...el.com>,
Lukas Wunner <lukas@...ner.de>
Subject: Re: [PATCH] thunderbolt: Make sure device runtime resume completes
before taking domain lock
On Wed, Jun 05, 2019 at 05:04:38PM +0300, Mika Westerberg wrote:
> When a device is authorized from userspace by writing to authorized
> attribute we first take the domain lock and then runtime resume the
> device in question. There are two issues with this.
>
> First is that the device connected notifications are blocked during this
> time which means we get them only after the authorization operation is
> complete. Because of this the authorization needed flag from the
> firmware notification is not reflecting the real authorization status
> anymore. So what happens is that the "authorized" keeps returning 0 even
> if the device was already authorized properly.
>
> Second issue is that each time the controller is runtime resumed the
> connection_id field of device connected notification may be different
> than in the previous resume. We need to use the latest connection_id
> otherwise the firmware rejects the authorization command.
>
> Fix these by moving runtime resume operations to happen before the
> domain lock is taken, and waiting for the updated device connected
> notification from the firmware before we allow runtime resume of a
> device to complete.
>
> While there add missing locking to tb_switch_nvm_read().
>
> Fixes: 09f11b6c99fe ("thunderbolt: Take domain lock in switch sysfs attribute callbacks")
> Reported-by: Pengfei Xu <pengfei.xu@...el.com>
> Signed-off-by: Mika Westerberg <mika.westerberg@...ux.intel.com>
Applied to thunderbolt.git/fixes.
Powered by blists - more mailing lists