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-next>] [day] [month] [year] [list]
Message-Id: <20241008-mv88e6xxx_leds_fwnode_put-v1-0-cfd7758cd176@gmail.com>
Date: Tue, 08 Oct 2024 18:10:26 +0200
From: Javier Carrasco <javier.carrasco.cruz@...il.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>, 
 "Rafael J. Wysocki" <rafael@...nel.org>, 
 Andy Shevchenko <andriy.shevchenko@...ux.intel.com>, 
 Daniel Scally <djrscally@...il.com>, 
 Heikki Krogerus <heikki.krogerus@...ux.intel.com>, 
 Sakari Ailus <sakari.ailus@...ux.intel.com>, Andrew Lunn <andrew@...n.ch>, 
 Florian Fainelli <f.fainelli@...il.com>, 
 Vladimir Oltean <olteanv@...il.com>, 
 "David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, 
 Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, 
 Linus Walleij <linus.walleij@...aro.org>
Cc: linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org, 
 netdev@...r.kernel.org, Javier Carrasco <javier.carrasco.cruz@...il.com>
Subject: [PATCH net-next 0/3] net, device property: fix led node releases
 in mv88e6xxx with new macro

This series introduces the scoped variant of
fwnode_for_each_available_child_node() to avoid the common issue the
non-scoped variant triggers: forgetting the required fwnode_handle_put()
upon early exits. It is strongly based on the existing
device_for_each_child_node_scoped(), using
fwnode_get_next_available_child_node() instead, and of course fwnode
instead of dev.

A fix with this new macro has been proposed in this series, as well as a
second fix for a node outside the loop by means of the __free()
automatic cleanup mechanism. Given that the bugs were recently
introduced, new approaches can be used without affecting stable kernels.
Of course the issue could be solved by adding multiple calls to
fwnode_handle_put(), but the scoped macros and the automatic cleanup has
already showed multiple times that they can save us from introducing
bugs and also help us fix existing ones.

Note that the declaration of 'leds' has been moved to its initialization
as it is preferred when using this mechanism to avoid releasing
uninitialized nodes. It could be left on top with a NULL initialization,
but that pattern is less common.

A more important modification is the use of the _available_ variant of
the macro, as it seems that there is no need to walk over unavailable
nodes. If that is not the case, please let me know why unavailable nodes
are required, as a scoped variant of the current loop could be
introduced instead.

This series has been compile-checked and statically analyzed, as I
don't have the hardware to test it. I have been using the scoped macro
for a while downstream, but that is not saying much, and actual tests
with the real hardware would be more than welcome.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@...il.com>
---
Javier Carrasco (3):
      device property: Introduce fwnode_for_each_available_child_node_scoped()
      net: dsa: mv88e6xxx: leds: fix led refcount in error path
      net: dsa: mv88e6xxx: leds: fix leds refcount

 drivers/net/dsa/mv88e6xxx/leds.c | 6 +++---
 include/linux/property.h         | 5 +++++
 2 files changed, 8 insertions(+), 3 deletions(-)
---
base-commit: 489cee4caeba4f70a29b7215cfd18152dcadab7f
change-id: 20241008-mv88e6xxx_leds_fwnode_put-93946e7a87a8

Best regards,
-- 
Javier Carrasco <javier.carrasco.cruz@...il.com>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ