* [patch] mailbox: bcm-pdc: potential NULL dereference in pdc_shutdown()
@ 2016-08-04 5:30 Dan Carpenter
2016-08-04 11:10 ` Rob (William) Rice
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2016-08-04 5:30 UTC (permalink / raw)
To: Jassi Brar, Rob Rice; +Cc: linux-kernel, kernel-janitors
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);
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch] mailbox: bcm-pdc: potential NULL dereference in pdc_shutdown()
2016-08-04 5:30 [patch] mailbox: bcm-pdc: potential NULL dereference in pdc_shutdown() Dan Carpenter
@ 2016-08-04 11:10 ` Rob (William) Rice
0 siblings, 0 replies; 2+ messages in thread
From: Rob (William) Rice @ 2016-08-04 11:10 UTC (permalink / raw)
To: Dan Carpenter, Jassi Brar, Rob Rice; +Cc: linux-kernel, kernel-janitors
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);
> }
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-08-04 11:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-04 5:30 [patch] mailbox: bcm-pdc: potential NULL dereference in pdc_shutdown() Dan Carpenter
2016-08-04 11:10 ` Rob (William) Rice
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox