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] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZidslwZAYyu4RnJk@wunner.de>
Date: Tue, 23 Apr 2024 10:08:55 +0200
From: Lukas Wunner <lukas@...ner.de>
To: Jacob Keller <jacob.e.keller@...el.com>
Cc: Marek Marczykowski-Górecki <marmarek@...isiblethingslab.com>,
	Tony Nguyen <anthony.l.nguyen@...el.com>, davem@...emloft.net,
	kuba@...nel.org, pabeni@...hat.com, edumazet@...gle.com,
	netdev@...r.kernel.org, sasha.neftin@...el.com,
	Roman Lozko <lozko.roma@...il.com>,
	Kurt Kanzenbach <kurt@...utronix.de>,
	Heiner Kallweit <hkallweit1@...il.com>,
	Simon Horman <horms@...nel.org>,
	Naama Meir <naamax.meir@...ux.intel.com>
Subject: Re: [PATCH net] igc: Fix LED-related deadlock on driver unbind

On Mon, Apr 22, 2024 at 04:46:28PM -0700, Jacob Keller wrote:
> To me, using devm from the PCI device should be equivalent to managing
> it manually within the igc_remove() function.

It is not equivalent because the ordering is different:

igc_remove() is called before device-managed resources are released:

__device_release_driver()
  device_remove()             # invokes igc_remove()
  device_unbind_cleanup()
    devres_release_all()      # releases device-managed resources

If you unregister LEDs explicitly in igc_remove() before unregistering
the netdev and disabling PCI device access, everything's fine.

If you instead use devm_led_classdev_register(), the LEDs would still
be registered and available in sysfs after igc_remove() has torn down
everything, which is bad.

You'd have to use devm_*() for all initialization steps in igc_probe()
to make this work.  With devm_*() it's generally all or nothing.

(There are exceptions:  Using devm_*() just for memory allocations is
fine as those can safely be freed even if everything else is torn down.)

Thanks,

Lukas

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ