[PATCH] drm: omapdrm: Fix oops on rmmod

Tony Lindgren tony at atomide.com
Thu Mar 23 17:04:59 UTC 2017


Looks like in Linux next we can now get an oops when unloading omapdrm:

Unable to handle kernel NULL pointer dereference at virtual address
00000000
...
LR is at omap_drm_irq_uninstall+0xb0/0xe0 [omapdrm]
...
[<bf6806a8>] (omap_drm_irq_uninstall [omapdrm]) from [<bf67f260>]
(pdev_remove+0x50/0x88 [omapdrm])
[<bf67f260>] (pdev_remove [omapdrm]) from [<c058fa28>]
(platform_drv_remove+0x24/0x3c)
[<c058fa28>] (platform_drv_remove) from [<c058ddb8>]
(device_release_driver_internal+0x160/0x1f4)
[<c058ddb8>] (device_release_driver_internal) from [<c058de90>]
(driver_detach+0x38/0x6c)
[<c058de90>] (driver_detach) from [<c058d0b8>]
(bus_remove_driver+0x4c/0xa0)
[<c058d0b8>] (bus_remove_driver) from [<c058fb1c>]
(platform_unregister_drivers+0x24/0x30)
[<c058fb1c>] (platform_unregister_drivers) from [<c01e26e8>]
(SyS_delete_module+0x150/0x218)
[<c01e26e8>] (SyS_delete_module) from [<c01077a0>]
(ret_fast_syscall+0x0/0x1c)

Fix the issue by checking get_vblank_counter() before trying to
call it.

Signed-off-by: Tony Lindgren <tony at atomide.com>
---
 drivers/gpu/drm/omapdrm/omap_irq.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_irq.c b/drivers/gpu/drm/omapdrm/omap_irq.c
--- a/drivers/gpu/drm/omapdrm/omap_irq.c
+++ b/drivers/gpu/drm/omapdrm/omap_irq.c
@@ -303,8 +303,9 @@ void omap_drm_irq_uninstall(struct drm_device *dev)
 		for (i = 0; i < dev->num_crtcs; i++) {
 			wake_up(&dev->vblank[i].queue);
 			dev->vblank[i].enabled = false;
-			dev->vblank[i].last =
-				dev->driver->get_vblank_counter(dev, i);
+			if (dev->driver->get_vblank_counter)
+				dev->vblank[i].last =
+					dev->driver->get_vblank_counter(dev, i);
 		}
 		spin_unlock_irqrestore(&dev->vbl_lock, irqflags);
 	}
-- 
2.11.1


More information about the dri-devel mailing list