Skip to content

Commit

Permalink
gpio: mockup: fix NULL pointer dereference when removing debugfs
Browse files Browse the repository at this point in the history
We now remove the device's debugfs entries when unbinding the driver.
This now causes a NULL-pointer dereference on module exit because the
platform devices are unregistered *after* the global debugfs directory
has been recursively removed. Fix it by unregistering the devices first.

Fixes: 303e6da ("gpio: mockup: remove gpio debugfs when remove device")
Cc: Wei Yongjun <[email protected]>
Cc: [email protected]
Signed-off-by: Bartosz Golaszewski <[email protected]>
  • Loading branch information
brgl committed Sep 20, 2022
1 parent 521a547 commit b7df41a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-mockup.c
Original file line number Diff line number Diff line change
Expand Up @@ -597,9 +597,9 @@ static int __init gpio_mockup_init(void)

static void __exit gpio_mockup_exit(void)
{
gpio_mockup_unregister_pdevs();
debugfs_remove_recursive(gpio_mockup_dbg_dir);
platform_driver_unregister(&gpio_mockup_driver);
gpio_mockup_unregister_pdevs();
}

module_init(gpio_mockup_init);
Expand Down

0 comments on commit b7df41a

Please sign in to comment.