Commit 6fda593
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 bd1e336 ("driver core: platform:
Remove platform_device_add_properties()"). Hence, it's used as a landmark
for backporting.
Fixes: bd1e336 ("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>1 parent 55a9968 commit 6fda593
1 file changed
Lines changed: 18 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
476 | 476 | | |
477 | 477 | | |
478 | 478 | | |
| 479 | + | |
| 480 | + | |
479 | 481 | | |
480 | 482 | | |
481 | | - | |
482 | | - | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
483 | 492 | | |
484 | 493 | | |
485 | 494 | | |
| |||
508 | 517 | | |
509 | 518 | | |
510 | 519 | | |
| 520 | + | |
511 | 521 | | |
512 | 522 | | |
513 | 523 | | |
| |||
536 | 546 | | |
537 | 547 | | |
538 | 548 | | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
539 | 553 | | |
540 | 554 | | |
541 | | - | |
| 555 | + | |
542 | 556 | | |
543 | 557 | | |
544 | 558 | | |
545 | 559 | | |
| 560 | + | |
546 | 561 | | |
547 | 562 | | |
548 | 563 | | |
| |||
0 commit comments