mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: barebox@lists.infradead.org, bst@pengutronix.de
Subject: Re: [PATCH 1/3] video/ssd1307fb: fix NULL pointer dereference in probe
Date: Mon, 9 Mar 2020 08:31:06 +0100	[thread overview]
Message-ID: <20200309073106.GE3335@pengutronix.de> (raw)
In-Reply-To: <20200302114955.13897-1-a.fatoum@pengutronix.de>

On Mon, Mar 02, 2020 at 12:49:53PM +0100, Ahmad Fatoum wrote:
> info->priv is dereferenced before a valid value has been set leading to
> a NULL pointer dereference in the probe function. Fix this.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---

Applied, thanks

Sascha

> Cc: bst@pengutronix.de
> Cc: str@pengutronix.de
> 
> Hi,
> 
> how did this ever work? Does the platform that you used this on not trap
> on NULL-pointer dereference?
> 
> Cheers,
> ---
>  drivers/video/ssd1307fb.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/video/ssd1307fb.c b/drivers/video/ssd1307fb.c
> index 70077e43a879..83a561a3e1fc 100644
> --- a/drivers/video/ssd1307fb.c
> +++ b/drivers/video/ssd1307fb.c
> @@ -405,8 +405,9 @@ static int ssd1307fb_probe(struct device_d *dev)
>  	}
>  
>  	info = xzalloc(sizeof(struct fb_info));
> +	par = xzalloc(sizeof(*par));
>  
> -	par = info->priv;
> +	info->priv = par;
>  	par->info = info;
>  	par->client = client;
>  
> @@ -574,6 +575,7 @@ reset_oled_error:
>  	free(vmem);
>  fb_alloc_error:
>  	regulator_disable(par->vbat);
> +	free(par);
>  	free(info);
>  	return ret;
>  }
> -- 
> 2.25.0
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

      parent reply	other threads:[~2020-03-09  7:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-02 11:49 Ahmad Fatoum
2020-03-02 11:49 ` [PATCH 2/3] video/ssd1307fb: drop unneeded regulator NULL checks Ahmad Fatoum
2020-03-02 11:49 ` [PATCH 3/3] video/ssd1307fb: make reset GPIO optional Ahmad Fatoum
2020-03-09  7:31 ` Sascha Hauer [this message]

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=20200309073106.GE3335@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=bst@pengutronix.de \
    /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