Re: [PATCH] net: davicom: dm9000: Avoid spinlock recursion during dm9000_timeout routine

From: David Miller
Date: Fri Jun 02 2017 - 14:12:50 EST


From: Liu Xiang <liu.xiang6@xxxxxxxxxx>
Date: Wed, 31 May 2017 23:06:42 +0800

> On the DM9000B, dm9000_phy_write() is called after the main spinlock
> is held, during the dm9000_timeout() routine. Spinlock recursion
> occurs because the main spinlock is requested again in
> dm9000_phy_write(). So spinlock should be avoided in dm9000_phy_write()
> during the dm9000_timeout() routine.
>
> Signed-off-by: Liu Xiang <liu.xiang6@xxxxxxxxxx>

It think this is racy.

Now, during a timeout device reset, another thread of control can come
in and access phy registers without any synchronization whatsoever.