netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ptp_qoriq: fix NULL access if ptp dt node missing
@ 2019-05-09  3:07 Y.b. Lu
  2019-05-09  3:57 ` Richard Cochran
  2019-05-09 16:19 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Y.b. Lu @ 2019-05-09  3:07 UTC (permalink / raw)
  To: netdev@vger.kernel.org, Richard Cochran, David Miller
  Cc: Claudiu Manoil, Alexandru Marginean, Y.b. Lu

From: Claudiu Manoil <claudiu.manoil@nxp.com>

Make sure ptp dt node exists before accessing it in case
of NULL pointer call trace.

Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
---
 drivers/ptp/ptp_qoriq.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/ptp/ptp_qoriq.c b/drivers/ptp/ptp_qoriq.c
index 53775362aac6..e10642403b25 100644
--- a/drivers/ptp/ptp_qoriq.c
+++ b/drivers/ptp/ptp_qoriq.c
@@ -467,6 +467,9 @@ int ptp_qoriq_init(struct ptp_qoriq *ptp_qoriq, void __iomem *base,
 	unsigned long flags;
 	u32 tmr_ctrl;
 
+	if (!node)
+		return -ENODEV;
+
 	ptp_qoriq->base = base;
 	ptp_qoriq->caps = *caps;
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ptp_qoriq: fix NULL access if ptp dt node missing
  2019-05-09  3:07 [PATCH] ptp_qoriq: fix NULL access if ptp dt node missing Y.b. Lu
@ 2019-05-09  3:57 ` Richard Cochran
  2019-05-09 16:19 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Cochran @ 2019-05-09  3:57 UTC (permalink / raw)
  To: Y.b. Lu
  Cc: netdev@vger.kernel.org, David Miller, Claudiu Manoil,
	Alexandru Marginean

On Thu, May 09, 2019 at 03:07:12AM +0000, Y.b. Lu wrote:
> From: Claudiu Manoil <claudiu.manoil@nxp.com>
> 
> Make sure ptp dt node exists before accessing it in case
> of NULL pointer call trace.
> 
> Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
> Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>

Acked-by: Richard Cochran <richardcochran@gmail.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ptp_qoriq: fix NULL access if ptp dt node missing
  2019-05-09  3:07 [PATCH] ptp_qoriq: fix NULL access if ptp dt node missing Y.b. Lu
  2019-05-09  3:57 ` Richard Cochran
@ 2019-05-09 16:19 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-05-09 16:19 UTC (permalink / raw)
  To: yangbo.lu; +Cc: netdev, richardcochran, claudiu.manoil, alexandru.marginean

From: "Y.b. Lu" <yangbo.lu@nxp.com>
Date: Thu, 9 May 2019 03:07:12 +0000

> From: Claudiu Manoil <claudiu.manoil@nxp.com>
> 
> Make sure ptp dt node exists before accessing it in case
> of NULL pointer call trace.
> 
> Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
> Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-05-09 16:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-09  3:07 [PATCH] ptp_qoriq: fix NULL access if ptp dt node missing Y.b. Lu
2019-05-09  3:57 ` Richard Cochran
2019-05-09 16:19 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).