[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20200724.170220.1275270219725381485.davem@davemloft.net>
Date: Fri, 24 Jul 2020 17:02:20 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: andrea.righi@...onical.com
Cc: boris.ostrovsky@...cle.com, jgross@...e.com,
sstabellini@...nel.org, kuba@...nel.org,
xen-devel@...ts.xenproject.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] xen-netfront: fix potential deadlock in
xennet_remove()
From: Andrea Righi <andrea.righi@...onical.com>
Date: Fri, 24 Jul 2020 10:59:10 +0200
> There's a potential race in xennet_remove(); this is what the driver is
> doing upon unregistering a network device:
>
> 1. state = read bus state
> 2. if state is not "Closed":
> 3. request to set state to "Closing"
> 4. wait for state to be set to "Closing"
> 5. request to set state to "Closed"
> 6. wait for state to be set to "Closed"
>
> If the state changes to "Closed" immediately after step 1 we are stuck
> forever in step 4, because the state will never go back from "Closed" to
> "Closing".
>
> Make sure to check also for state == "Closed" in step 4 to prevent the
> deadlock.
>
> Also add a 5 sec timeout any time we wait for the bus state to change,
> to avoid getting stuck forever in wait_event().
>
> Signed-off-by: Andrea Righi <andrea.righi@...onical.com>
> ---
> Changes in v2:
> - remove all dev_dbg() calls (as suggested by David Miller)
Applied, thank you.
Powered by blists - more mailing lists