Skip to content

Commit b7df41a

Browse files
committed
gpio: mockup: fix NULL pointer dereference when removing debugfs
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 <weiyongjun1@huawei.com> Cc: stable@vger.kernel.org Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
1 parent 521a547 commit b7df41a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/gpio/gpio-mockup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,9 +597,9 @@ static int __init gpio_mockup_init(void)
597597

598598
static void __exit gpio_mockup_exit(void)
599599
{
600+
gpio_mockup_unregister_pdevs();
600601
debugfs_remove_recursive(gpio_mockup_dbg_dir);
601602
platform_driver_unregister(&gpio_mockup_driver);
602-
gpio_mockup_unregister_pdevs();
603603
}
604604

605605
module_init(gpio_mockup_init);

0 commit comments

Comments
 (0)