lkml.org 
[lkml]   [2016]   [Aug]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [patch] mailbox: bcm-pdc: potential NULL dereference in pdc_shutdown()
From
Date
Dan,

The fix looks good to me. Thanks for finding and fixing.

Rob

On 8/4/2016 1:30 AM, Dan Carpenter wrote:
> We can't pass NULL pointers to pdc_ring_free() so I moved the check for
> NULL.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/mailbox/bcm-pdc-mailbox.c b/drivers/mailbox/bcm-pdc-mailbox.c
> index cbe0c1e..c56d4d0 100644
> --- a/drivers/mailbox/bcm-pdc-mailbox.c
> +++ b/drivers/mailbox/bcm-pdc-mailbox.c
> @@ -1191,10 +1191,11 @@ static void pdc_shutdown(struct mbox_chan *chan)
> {
> struct pdc_state *pdcs = chan->con_priv;
>
> - if (pdcs)
> - dev_dbg(&pdcs->pdev->dev,
> - "Shutdown mailbox channel for PDC %u", pdcs->pdc_idx);
> + if (!pdcs)
> + return;
>
> + dev_dbg(&pdcs->pdev->dev,
> + "Shutdown mailbox channel for PDC %u", pdcs->pdc_idx);
> pdc_ring_free(pdcs);
> }
>

\
 
 \ /
  Last update: 2016-08-04 13:41    [W:0.046 / U:0.424 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site