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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250214114008.4975ccb4@kernel.org>
Date: Fri, 14 Feb 2025 11:40:08 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Jacob Keller <jacob.e.keller@...el.com>
Cc: Intel Wired LAN <intel-wired-lan@...ts.osuosl.org>, netdev
 <netdev@...r.kernel.org>, Anthony Nguyen <anthony.l.nguyen@...el.com>,
 Przemek Kitszel <przemyslaw.kitszel@...el.com>
Subject: Re: [PATCH iwl-net v2] iavf: fix circular lock dependency with
 netdev_lock

On Thu, 13 Feb 2025 16:30:59 -0800 Jacob Keller wrote:
> Analyzing the places where we take crit_lock in the driver there are two
> sources:
> 
> a) several of the work queue tasks including adminq_task, watchdog_task,
> reset_task, and the finish_config task.
> 
> b) various callbacks which ultimately stem back to .ndo operations or
> ethtool operations.
> 
> The latter cannot be triggered until after the netdevice registration is
> completed successfully.
> 
> The iAVF driver uses alloc_ordered_workqueue, which is an unbound workqueue
> that has a max limit of 1, and thus guarantees that only a single work item
> on the queue is executing at any given time, so none of the other work
> threads could be executing due to the ordered workqueue guarantees.
> 
> The iavf_finish_config() function also does not do anything else after
> register_netdevice, unless it fails. It seems unlikely that the driver
> private crit_lock is protecting anything that register_netdevice() itself
> touches.
> 
> Thus, to fix this ABBA lock violation, lets simply release the
> adapter->crit_lock as well as netdev_lock prior to calling
> register_netdevice(). We do still keep holding the RTNL lock as required by
> the function. If we do fail to register the netdevice, then we re-acquire
> the adapter critical lock to finish the transition back to
> __IAVF_INIT_CONFIG_ADAPTER.
> 
> This ensures every call where both netdev_lock and the adapter->crit_lock
> are acquired under the same ordering.

Thanks a lot for figuring this out, much appreciated!

Reviewed-by: Jakub Kicinski <kuba@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ