lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8a76d144-f8ba-bbbc-9177-53088f6dc73a@suse.de>
Date:   Mon, 2 Nov 2020 13:09:39 +0100
From:   Thomas Zimmermann <tzimmermann@...e.de>
To:     Tian Tao <tiantao6@...ilicon.com>,
        maarten.lankhorst@...ux.intel.com, mripard@...nel.org,
        airlied@...ux.ie, daniel@...ll.ch, dri-devel@...ts.freedesktop.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drm/irq: Add irq as false detection

Hi

Am 02.11.20 um 12:19 schrieb Tian Tao:
> Add the detection of false for irq, so that the EINVAL is not
> returned when dev->irq_enabled is false.
> 
> Signed-off-by: Tian Tao <tiantao6@...ilicon.com>
> ---
>  drivers/gpu/drm/drm_irq.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
> index 09d6e9e..7537a3d 100644
> --- a/drivers/gpu/drm/drm_irq.c
> +++ b/drivers/gpu/drm/drm_irq.c
> @@ -172,6 +172,9 @@ int drm_irq_uninstall(struct drm_device *dev)
>  	bool irq_enabled;
>  	int i;
>  
> +	if (!dev->irq_enabled || !dev)
> +		return 0;
> +

Dereferencing a pointer before NULL-checking it, is Yoda programming. :)
I'd just drop the test for !dev and assume that dev is always valid.

I suggest to change the int return value to void and return nothing.

Re-reading the actual implementation of this function, this location
might be too early. Further below there already is a test for
irq_enabled. Put a drm_WARN_ON around it and it should be fine. This way
the vblank handlers will be disabled and erroneous callers will see a
warning in the kernel's log.

Best regards
Thomas

>  	irq_enabled = dev->irq_enabled;
>  	dev->irq_enabled = false;
>  
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer

Download attachment "OpenPGP_0x680DC11D530B7A23.asc" of type "application/pgp-keys" (4202 bytes)

Download attachment "OpenPGP_signature" of type "application/pgp-signature" (496 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ