[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <193c9eef-af13-219c-e5e0-2cc9469bf562@suse.de>
Date: Mon, 2 May 2022 15:20:23 +0200
From: Thomas Zimmermann <tzimmermann@...e.de>
To: Javier Martinez Canillas <javierm@...hat.com>,
linux-kernel@...r.kernel.org
Cc: linux-fbdev@...r.kernel.org, Helge Deller <deller@....de>,
Zheyu Ma <zheyuma97@...il.com>,
Changcheng Deng <deng.changcheng@....com.cn>,
dri-devel@...ts.freedesktop.org, Maxime Ripard <maxime@...no.tech>,
Zhen Lei <thunder.leizhen@...wei.com>,
Alex Deucher <alexander.deucher@....com>,
Sam Ravnborg <sam@...nborg.org>,
Guenter Roeck <linux@...ck-us.net>
Subject: Re: [PATCH 2/2] fbdev: Make fb_release() return -ENODEV if fbdev was
unregistered
Am 02.05.22 um 15:09 schrieb Javier Martinez Canillas:
> A reference to the framebuffer device struct fb_info is stored in the file
> private data, but this reference could no longer be valid and must not be
> accessed directly. Instead, the file_fb_info() accessor function must be
> used since it does sanity checking to make sure that the fb_info is valid.
>
> This can happen for example if the fbdev driver was one that is using a
> framebuffer provided by the system firmware. In that case, the fbdev core
> could unregister the framebuffer device if a real video driver is probed.
>
> Reported-by: Maxime Ripard <maxime@...no.tech>
> Signed-off-by: Javier Martinez Canillas <javierm@...hat.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@...e.de>
This seems like the correct thing to do in any case. Thanks for the
patch. Before merging, you should also add
Fixes: 27599aacbaef ("fbdev: Hot-unplug firmware fb devices on forced
removal")
Reported-by: Junxiao Chang <junxiao.chang@...el.com>
Best regards
Thomas
> ---
>
> drivers/video/fbdev/core/fbmem.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
> index 20d8929df79f..d68097105f93 100644
> --- a/drivers/video/fbdev/core/fbmem.c
> +++ b/drivers/video/fbdev/core/fbmem.c
> @@ -1439,7 +1439,10 @@ fb_release(struct inode *inode, struct file *file)
> __acquires(&info->lock)
> __releases(&info->lock)
> {
> - struct fb_info * const info = file->private_data;
> + struct fb_info * const info = file_fb_info(file);
> +
> + if (!info)
> + return -ENODEV;
>
> lock_fb_info(info);
> if (info->fbops->fb_release)
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
Download attachment "OpenPGP_signature" of type "application/pgp-signature" (841 bytes)
Powered by blists - more mailing lists