From: Lucas Stach <l.stach@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH] fb: reject enable request when framebuffer has no mode
Date: Fri, 6 Apr 2018 17:23:23 +0200 [thread overview]
Message-ID: <20180406152323.16879-1-l.stach@pengutronix.de> (raw)
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>
---
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
next reply other threads:[~2018-04-06 15:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-06 15:23 Lucas Stach [this message]
2018-04-09 6:57 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180406152323.16879-1-l.stach@pengutronix.de \
--to=l.stach@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox