Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1456179 > unrolled thread

[patch] mailbox: bcm-pdc: potential NULL dereference in pdc_shutdown()

Started byDan Carpenter <dan.carpenter@oracle.com>
First post2016-08-04 07:40 +0200
Last post2016-08-04 13:20 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [patch] mailbox: bcm-pdc: potential NULL dereference in  pdc_shutdown() Dan Carpenter <dan.carpenter@oracle.com> - 2016-08-04 07:40 +0200
    Re: [patch] mailbox: bcm-pdc: potential NULL dereference in  pdc_shutdown() "Rob (William) Rice" <rob.rice@broadcom.com> - 2016-08-04 13:20 +0200

#1456179 — [patch] mailbox: bcm-pdc: potential NULL dereference in pdc_shutdown()

FromDan Carpenter <dan.carpenter@oracle.com>
Date2016-08-04 07:40 +0200
Subject[patch] mailbox: bcm-pdc: potential NULL dereference in pdc_shutdown()
Message-ID<s2jxT-4Ea-7@gated-at.bofh.it>
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);
 }
 

[toc] | [next] | [standalone]


#1456341

From"Rob (William) Rice" <rob.rice@broadcom.com>
Date2016-08-04 13:20 +0200
Message-ID<s2oQW-8bN-13@gated-at.bofh.it>
In reply to#1456179
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);
>   }
>   

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web