lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <438bdacdfe2b50534d30d5d51660c4a7c3ba4f66.camel@redhat.com>
Date: Thu, 12 Oct 2023 10:20:11 +0200
From: Paolo Abeni <pabeni@...hat.com>
To: Marc Kleine-Budde <mkl@...gutronix.de>, Francois Romieu
	 <romieu@...zoreil.com>
Cc: netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>, Eric
 Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Kalle Valo
 <kvalo@...nel.org>,  Wei Fang <wei.fang@....com>, kernel@...gutronix.de,
 stable@...r.kernel.org
Subject: Re: [PATCH net] net: davicom: dm9000: dm9000_phy_write(): fix
 deadlock during netdev watchdog handling

On Wed, 2023-10-11 at 08:43 +0200, Marc Kleine-Budde wrote:
> On 11.10.2023 00:21:31, Francois Romieu wrote:
> > Marc Kleine-Budde <mkl@...gutronix.de> :
> > > The dm9000 takes the db->lock spin lock in dm9000_timeout() and calls
> > > into dm9000_init_dm9000(). For the DM9000B the PHY is reset with
> > > dm9000_phy_write(). That function again takes the db->lock spin lock,
> > > which results in a deadlock. For reference the backtrace:
> > [...]
> > > To workaround similar problem (take mutex inside spin lock ) , a
> > > "in_timeout" variable was added in 582379839bbd ("dm9000: avoid
> > > sleeping in dm9000_timeout callback"). Use this variable and not take
> > > the spin lock inside dm9000_phy_write() if in_timeout is true.
> > > 
> > > Cc: stable@...r.kernel.org
> > > Signed-off-by: Marc Kleine-Budde <mkl@...gutronix.de>
> > > ---
> > > During the netdev watchdog handling the dm9000 driver takes the same
> > > spin lock twice. Avoid this by extending an existing workaround.
> > > ---
> > 
> > I can review it but I can't really endorse it. :o)
> > 
> > Extending ugly workaround in pre-2000 style device drivers...
> > I'd rather see the thing fixed if there is some real use for it.
> 
> There definitely are still users of this drivers on modern kernels out
> there.
> 
> I too don't like the feeling of wrapping more and more duct tape
> around existing drivers. How about moving the functionality to
> dm9000_phy_write_locked() and leave the locking in dm9000_phy_write().
> I will prepare a patch.

If you have the H/W handy to try some more invasive change, I'm
wondering if you could schedule a work from dm9000_timeout() and there
acquire all the needed locks. 

Cheers,

Paolo


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ