Skip to content

gpio: sysfs: fix attribute leaks and races

Johan Hovold linux-gpio lkml stable 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 6 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3gpio: sysfs: fix gpio-chip device-attribute leakdrivers/gpio/gpiolib-sysfs.c+8 -111 reply
2/3gpio: sysfs: fix gpio device-attribute leakdrivers/gpio/gpiolib-sysfs.c+13 -152 replies
3/3gpio: sysfs: fix gpio attribute-creation racedrivers/gpio/gpiolib-sysfs.c drivers/gpio/gpiolib.h+40 -222 replies

Reviews trailers per patch

2 of 3 patches have a Reviewed-by or Acked-by.

PatchAlexandre Courbot
1/3R-b
2/3R-b
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/3] gpio: sysfs: fix attribute leaks and races

Here are three more patches for 3.19 fixing some long-standing memory leaks and races (with userspace) in the gpio sysfs-interface implementation.

The memory leaks are marked for stable, but I'll need to backport them to pre-3.18 kernels once they are upstream due to commit 0eb4c6c2671c ("gpio: move sysfs support to its own file").

I chose not to mark the final patch for stable as the attribute-creation race with userspace (e.g. udev rule) is not as critical (and patch a bit more invasive).

Please note that these patches will cause a conflict with 3511ee7b3312 ("gpio: lib-sysfs: Add 'wakeup' attribute") in gpio/devel, which adds yet another device attribute without ever removing it. Unless the commit in question can be reverted, that leak could be fixed as part of the merge resolution, I guess.

Johan

Johan Hovold (3):
gpio: sysfs: fix gpio-chip device-attribute leak
gpio: sysfs: fix gpio device-attribute leak
gpio: sysfs: fix gpio attribute-creation race

 drivers/gpio/gpiolib-sysfs.c | 92 +++++++++++++++++++++++++-------------------
 drivers/gpio/gpiolib.h       |  1 +
 2 files changed, 53 insertions(+), 40 deletions(-)
Signature · 1 line
2.0.5