diff mbox

drm: omapdrm: Fix oops on rmmod

Message ID 20170323170459.20906-1-tony@atomide.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tony Lindgren March 23, 2017, 5:04 p.m. UTC
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@atomide.com>
---
 drivers/gpu/drm/omapdrm/omap_irq.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Tomi Valkeinen March 24, 2017, 7:13 a.m. UTC | #1
On 23/03/17 19:04, Tony Lindgren wrote:
> 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.

Yep, there was a change in the DRM core that broke omapdrm. I've been
trying to understand how to fix this. I hope I can send a patch today.

 Tomi
diff mbox

Patch

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);
 	}