Subject: Re: [PATCH 2/2] drm/meson: Uninstall IRQ handler

From: Neil Armstrong <[email-masked]>
Date: Sat, 23 Mar 2019 10:54:04 +0100

Hi Jean-Philippe,

Le 22/03/2019 16:26, Jean-Philippe Brucker a écrit :
> meson_drv_unbind() doesn't unregister the IRQ handler, which can lead to
> use-after-free if the IRQ fires after unbind:
> 
> [   64.656876] Unable to handle kernel paging request at virtual address ffff000011706dbc
> ...
> [   64.662001] pc : meson_irq+0x18/0x30 [meson_drm]
> 
> I'm assuming that a similar problem could happen on the error path of
> bind(), so uninstall the IRQ handler there as well.
> 
> Fixes: bbbe775ec5b5 ("drm: Add support for Amlogic Meson Graphic Controller")
> Signed-off-by: Jean-Philippe Brucker <[email-masked]>
> ---
>  drivers/gpu/drm/meson/meson_drv.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)

Thanks for working on this,
Acked-by: Neil Armstrong <[email-masked]>

I'll push it on drm-misc-fixes

> 
> diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
> index 7e85802c5398..8a4ebcb6405c 100644
> --- a/drivers/gpu/drm/meson/meson_drv.c
> +++ b/drivers/gpu/drm/meson/meson_drv.c
> @@ -337,12 +337,14 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)
>  
>  	ret = drm_dev_register(drm, 0);
>  	if (ret)
> -		goto free_drm;
> +		goto uninstall_irq;
>  
>  	drm_fbdev_generic_setup(drm, 32);
>  
>  	return 0;
>  
> +uninstall_irq:
> +	drm_irq_uninstall(drm);
>  free_drm:
>  	drm_dev_put(drm);
>  
> @@ -367,6 +369,7 @@ static void meson_drv_unbind(struct device *dev)
>  	}
>  
>  	drm_dev_unregister(drm);
> +	drm_irq_uninstall(drm);
>  	drm_kms_helper_poll_fini(drm);
>  	drm_mode_config_cleanup(drm);
>  	drm_dev_put(drm);
> 

_______________________________________________
linux-arm-kernel mailing list
[email-masked]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel