]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
gpio: mockup: fix NULL pointer dereference when removing debugfs
authorBartosz Golaszewski <brgl@bgdev.pl>
Tue, 20 Sep 2022 07:18:41 +0000 (09:18 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 23 Nov 2022 14:11:38 +0000 (15:11 +0100)
commit8f6db0ab37ce039b9fc39e0e608c6bc4e22c1a1c
tree4fbd05c3a2e76c70b97b0aaa5348bb7d959537da
parent3c21595b8a4b1c7273ef312ca50c254f7a26e457
gpio: mockup: fix NULL pointer dereference when removing debugfs

BugLink: https://bugs.launchpad.net/bugs/1995420
commit b7df41a6f79dfb18ba2203f8c5f0e9c0b9b57f68 upstream.

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: 303e6da99429 ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/gpio/gpio-mockup.c