Andy Shevchenko 6fda593f30 gpio: mockup: Convert to use software nodes
The gpio-mockup driver creates the properties that are shared between
platform and GPIO devices. Because of that, the properties may not
be removed at the proper point of time without provoking a use-after-free
as shown in the following backtrace:

  refcount_t: underflow; use-after-free.
  WARNING: CPU: 0 PID: 103 at lib/refcount.c:28 refcount_warn_saturate+0xd1/0x120
  ...
  Call Trace:
  kobject_put+0xdc/0xf0
  software_node_notify_remove+0xa8/0xc0
  device_del+0x15a/0x3e0

That's why the driver has to manage the lifetime of the software nodes
by itself.

The problem originates from the old device_add_properties() API, but
has been only revealed after the commit bd1e336aa853 ("driver core: platform:
Remove platform_device_add_properties()"). Hence, it's used as a landmark
for backporting.

Fixes: bd1e336aa853 ("driver core: platform: Remove platform_device_add_properties()")
Reported-by: Kent Gibson <warthog618@gmail.com>
Tested-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
[Bartosz: tweaked local variable placement]
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
2021-10-06 13:04:04 +02:00
..
2020-07-20 15:34:59 +02:00
2021-04-14 10:19:22 +01:00
2021-09-07 12:27:27 -07:00
2018-05-16 14:35:24 +02:00
2020-01-15 11:24:19 +01:00
2021-05-05 16:07:41 +02:00
2019-09-03 16:04:19 +02:00
2021-09-07 12:27:27 -07:00
2021-09-07 12:27:27 -07:00
2021-09-07 12:27:27 -07:00
2019-11-07 09:27:48 +01:00
2021-09-28 16:10:42 -07:00
2020-12-09 15:17:24 +01:00
2021-09-07 12:27:27 -07:00
2021-08-29 21:19:50 +02:00
2018-01-09 14:51:00 +01:00
2019-12-09 10:40:18 +01:00
2020-12-09 15:17:24 +01:00