mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rob (William) Rice" <rob.rice@broadcom.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	Jassi Brar <jassisinghbrar@gmail.com>,
	Rob Rice <rrice@broadcom.com>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] mailbox: bcm-pdc: potential NULL dereference in pdc_shutdown()
Date: Thu, 4 Aug 2016 07:10:10 -0400	[thread overview]
Message-ID: <d8b35410-b5cc-b025-a943-d35614a52091@broadcom.com> (raw)
In-Reply-To: <20160804053030.GJ775@mwanda>

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);
>   }
>   

      reply	other threads:[~2016-08-04 11:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-04  5:30 Dan Carpenter
2016-08-04 11:10 ` Rob (William) Rice [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=d8b35410-b5cc-b025-a943-d35614a52091@broadcom.com \
    --to=rob.rice@broadcom.com \
    --cc=dan.carpenter@oracle.com \
    --cc=jassisinghbrar@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rrice@broadcom.com \
    /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

all inboxes | Powered by JetHome®