summaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorLucas Stach <l.stach@pengutronix.de>2018-04-06 17:23:23 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2018-04-09 08:56:51 +0200
commit395a0f57c5f30dd6e3967abec4510ab1de562574 (patch)
treee10ed3a26b78589d1cbd4b83c24437ee23039562 /drivers/video
parent5d4047e777f896d1390bb79cd6fb60a845831aa8 (diff)
downloadbarebox-395a0f57c5f30dd6e3967abec4510ab1de562574.tar.gz
barebox-395a0f57c5f30dd6e3967abec4510ab1de562574.tar.xz
fb: reject enable request when framebuffer has no mode
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 <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/fb.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/video/fb.c b/drivers/video/fb.c
index 5e829e832d..c9d184d502 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)