Re: [PATCH] fb: reject enable request when framebuffer has no mode

2018-04-09 Thread Sascha Hauer
On Fri, Apr 06, 2018 at 05:23:23PM +0200, Lucas Stach wrote:
> If no display is connected or the display modes are incompatible with
> the scanout hardware we might end up with a registered framebuffer with
> no modes. Trying to enable such a framebuffer will blow up with NULL
> ptr dereferences in various places, so just don't do it.
> 
> Signed-off-by: Lucas Stach 
> ---
>  drivers/video/fb.c | 3 +++
>  1 file changed, 3 insertions(+)

Applied, thanks

Sascha

> 
> diff --git a/drivers/video/fb.c b/drivers/video/fb.c
> index 004df1e604d6..599ac5b75e0a 100644
> --- a/drivers/video/fb.c
> +++ b/drivers/video/fb.c
> @@ -124,6 +124,9 @@ static int fb_enable_set(struct param_d *param, void 
> *priv)
>   struct fb_info *info = priv;
>   int enable;
>  
> + if (!info->mode)
> + return -EINVAL;
> +
>   enable = info->p_enable;
>  
>   if (enable)
> -- 
> 2.16.1
> 
> 
> ___
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] fb: reject enable request when framebuffer has no mode

2018-04-06 Thread Lucas Stach
If no display is connected or the display modes are incompatible with
the scanout hardware we might end up with a registered framebuffer with
no modes. Trying to enable such a framebuffer will blow up with NULL
ptr dereferences in various places, so just don't do it.

Signed-off-by: Lucas Stach 
---
 drivers/video/fb.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/video/fb.c b/drivers/video/fb.c
index 004df1e604d6..599ac5b75e0a 100644
--- a/drivers/video/fb.c
+++ b/drivers/video/fb.c
@@ -124,6 +124,9 @@ static int fb_enable_set(struct param_d *param, void *priv)
struct fb_info *info = priv;
int enable;
 
+   if (!info->mode)
+   return -EINVAL;
+
enable = info->p_enable;
 
if (enable)
-- 
2.16.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox