* [PATCH 1/2] spi: rspi: Fix NULL pointer dereference on SH7757 @ 2013-12-23 18:34 Geert Uytterhoeven 2013-12-23 18:34 ` [PATCH 2/2] spi: rspi: Fix typo when clearing SPSR_OVRF Geert Uytterhoeven ` (2 more replies) 0 siblings, 3 replies; 9+ messages in thread From: Geert Uytterhoeven @ 2013-12-23 18:34 UTC (permalink / raw) To: Mark Brown; +Cc: linux-spi, linux-sh, Geert Uytterhoeven, Hiep Cao Minh SH7757 doesn't pass platform data, in which case spi-rspi uses default parameters. However, commit 5ce0ba88650f2606244a761d92e2b725f4ab3583 ("spi: rcar: add Renesas QSPI support on RSPI") added a new user of the platform data, but forgot to check for its validity first, causing a NULL pointer dereference on SH7757. Add the missing check to fix this. Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org> Cc: Hiep Cao Minh <cm-hiep@jinso.co.jp> --- This fixes a regression introduced in v3.13-rc1 drivers/spi/spi-rspi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c index cfdbb422a40a..9e0301014f48 100644 --- a/drivers/spi/spi-rspi.c +++ b/drivers/spi/spi-rspi.c @@ -948,8 +948,9 @@ static int rspi_probe(struct platform_device *pdev) INIT_WORK(&rspi->ws, rspi_work); init_waitqueue_head(&rspi->wait); - master->num_chipselect = rspi_pd->num_chipselect; - if (!master->num_chipselect) + if (rspi_pd && rspi_pd->num_chipselect) + master->num_chipselect = rspi_pd->num_chipselect; + else master->num_chipselect = 2; /* default */ master->bus_num = pdev->id; -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/2] spi: rspi: Fix typo when clearing SPSR_OVRF 2013-12-23 18:34 [PATCH 1/2] spi: rspi: Fix NULL pointer dereference on SH7757 Geert Uytterhoeven @ 2013-12-23 18:34 ` Geert Uytterhoeven [not found] ` <1387823664-32318-2-git-send-email-geert+renesas-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org> 2013-12-24 2:58 ` [PATCH 1/2] spi: rspi: Fix NULL pointer dereference on SH7757 Simon Horman 2013-12-24 13:12 ` Mark Brown 2 siblings, 1 reply; 9+ messages in thread From: Geert Uytterhoeven @ 2013-12-23 18:34 UTC (permalink / raw) To: Mark Brown; +Cc: linux-spi, linux-sh, Geert Uytterhoeven The overrun flag should be cleared in the SPI Status Register, not in the SPI Control Register, based on the SDK sample code. Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org> --- drivers/spi/spi-rspi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c index 9e0301014f48..b04835d809f5 100644 --- a/drivers/spi/spi-rspi.c +++ b/drivers/spi/spi-rspi.c @@ -517,7 +517,7 @@ static void rspi_receive_init(struct rspi_data *rspi) rspi_read16(rspi, RSPI_SPDR); /* dummy read */ if (spsr & SPSR_OVRF) rspi_write8(rspi, rspi_read8(rspi, RSPI_SPSR) & ~SPSR_OVRF, - RSPI_SPCR); + RSPI_SPSR); } static int rspi_receive_pio(struct rspi_data *rspi, struct spi_message *mesg, -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 9+ messages in thread
[parent not found: <1387823664-32318-2-git-send-email-geert+renesas-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>]
* Re: [PATCH 2/2] spi: rspi: Fix typo when clearing SPSR_OVRF [not found] ` <1387823664-32318-2-git-send-email-geert+renesas-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org> @ 2013-12-24 2:59 ` Simon Horman 2013-12-24 9:26 ` Geert Uytterhoeven 0 siblings, 1 reply; 9+ messages in thread From: Simon Horman @ 2013-12-24 2:59 UTC (permalink / raw) To: Geert Uytterhoeven Cc: Mark Brown, linux-spi-u79uwXL29TY76Z2rM5mHXA, linux-sh-u79uwXL29TY76Z2rM5mHXA On Mon, Dec 23, 2013 at 07:34:24PM +0100, Geert Uytterhoeven wrote: > The overrun flag should be cleared in the SPI Status Register, not in the > SPI Control Register, based on the SDK sample code. > > Signed-off-by: Geert Uytterhoeven <geert+renesas-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org> I don't believe that I have access to the sample code, but I do trust your judgement. Acked-by: Simon Horman <horms+renesas-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org> > --- > drivers/spi/spi-rspi.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c > index 9e0301014f48..b04835d809f5 100644 > --- a/drivers/spi/spi-rspi.c > +++ b/drivers/spi/spi-rspi.c > @@ -517,7 +517,7 @@ static void rspi_receive_init(struct rspi_data *rspi) > rspi_read16(rspi, RSPI_SPDR); /* dummy read */ > if (spsr & SPSR_OVRF) > rspi_write8(rspi, rspi_read8(rspi, RSPI_SPSR) & ~SPSR_OVRF, > - RSPI_SPCR); > + RSPI_SPSR); > } > > static int rspi_receive_pio(struct rspi_data *rspi, struct spi_message *mesg, > -- > 1.7.9.5 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-sh" in > the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] spi: rspi: Fix typo when clearing SPSR_OVRF 2013-12-24 2:59 ` Simon Horman @ 2013-12-24 9:26 ` Geert Uytterhoeven [not found] ` <CAMuHMdWiJPF2NU+ME=CLMygvABZ_fcTyr7ggdQtFKbOGhCA0+w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 9+ messages in thread From: Geert Uytterhoeven @ 2013-12-24 9:26 UTC (permalink / raw) To: Simon Horman Cc: Geert Uytterhoeven, Mark Brown, linux-spi, Linux-sh list, Magnus Damm On Tue, Dec 24, 2013 at 3:59 AM, Simon Horman <horms@verge.net.au> wrote: > On Mon, Dec 23, 2013 at 07:34:24PM +0100, Geert Uytterhoeven wrote: >> The overrun flag should be cleared in the SPI Status Register, not in the >> SPI Control Register, based on the SDK sample code. >> >> Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org> > > I don't believe that I have access to the sample code, > but I do trust your judgement. It's in the public RZLSP-V1.0.1 for RZ/A1H, available from https://oss.renesas.com/. Oh, today a new version got released. The issue is quite obvious: after clearing the bit, the new value should be written back to the same register. However, the fix is not in a v3.10-rc6 version I saw, so this may matter for LTSI. > Acked-by: Simon Horman <horms+renesas@verge.net.au> Thanks! Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <CAMuHMdWiJPF2NU+ME=CLMygvABZ_fcTyr7ggdQtFKbOGhCA0+w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH 2/2] spi: rspi: Fix typo when clearing SPSR_OVRF [not found] ` <CAMuHMdWiJPF2NU+ME=CLMygvABZ_fcTyr7ggdQtFKbOGhCA0+w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2013-12-27 2:16 ` Simon Horman [not found] ` <20131227021639.GD9184-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org> 0 siblings, 1 reply; 9+ messages in thread From: Simon Horman @ 2013-12-27 2:16 UTC (permalink / raw) To: Geert Uytterhoeven Cc: Geert Uytterhoeven, Mark Brown, linux-spi-u79uwXL29TY76Z2rM5mHXA, Linux-sh list, Magnus Damm On Tue, Dec 24, 2013 at 10:26:17AM +0100, Geert Uytterhoeven wrote: > On Tue, Dec 24, 2013 at 3:59 AM, Simon Horman <horms-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org> wrote: > > On Mon, Dec 23, 2013 at 07:34:24PM +0100, Geert Uytterhoeven wrote: > >> The overrun flag should be cleared in the SPI Status Register, not in the > >> SPI Control Register, based on the SDK sample code. > >> > >> Signed-off-by: Geert Uytterhoeven <geert+renesas-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org> > > > > I don't believe that I have access to the sample code, > > but I do trust your judgement. > > It's in the public RZLSP-V1.0.1 for RZ/A1H, available from > https://oss.renesas.com/. Oh, today a new version got released. Thanks, I was not aware of that. > > The issue is quite obvious: after clearing the bit, the new value should > be written back to the same register. > > However, the fix is not in a v3.10-rc6 version I saw, so this may matter > for LTSI. I believe that the LTSI-3.10 work from Renesas (so far mainly me) is independent of the sample code at the link above. So unless this fix ends up in v3.10 -stable, which should feed into LTSI-3.10, then it will need to be submitted to LTSI (probably be me or you) if we want it to be in LTSI. > > > Acked-by: Simon Horman <horms+renesas-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org> > > Thanks! > > Gr{oetje,eeting}s, > > Geert > > -- > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org > > In personal conversations with technical people, I call myself a hacker. But > when I'm talking to journalists I just say "programmer" or something like that. > -- Linus Torvalds > -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <20131227021639.GD9184-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org>]
* Re: [PATCH 2/2] spi: rspi: Fix typo when clearing SPSR_OVRF [not found] ` <20131227021639.GD9184-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org> @ 2014-01-09 9:41 ` Geert Uytterhoeven [not found] ` <CAMuHMdU+4qCc64CkJeLAhh4SHqbB0E8Cu=8dKpmaYbphTBJV6g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 9+ messages in thread From: Geert Uytterhoeven @ 2014-01-09 9:41 UTC (permalink / raw) To: Simon Horman Cc: Geert Uytterhoeven, Mark Brown, linux-spi-u79uwXL29TY76Z2rM5mHXA, Linux-sh list, Magnus Damm Hi Simon, On Fri, Dec 27, 2013 at 3:16 AM, Simon Horman <horms-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org> wrote: > On Tue, Dec 24, 2013 at 10:26:17AM +0100, Geert Uytterhoeven wrote: >> On Tue, Dec 24, 2013 at 3:59 AM, Simon Horman <horms-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org> wrote: >> > On Mon, Dec 23, 2013 at 07:34:24PM +0100, Geert Uytterhoeven wrote: >> >> The overrun flag should be cleared in the SPI Status Register, not in the >> >> SPI Control Register, based on the SDK sample code. >> >> >> >> Signed-off-by: Geert Uytterhoeven <geert+renesas-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org> >> >> The issue is quite obvious: after clearing the bit, the new value should >> be written back to the same register. >> >> However, the fix is not in a v3.10-rc6 version I saw, so this may matter >> for LTSI. > > I believe that the LTSI-3.10 work from Renesas (so far mainly me) is > independent of the sample code at the link above. So unless this fix ends > up in v3.10 -stable, which should feed into LTSI-3.10, then it will need to > be submitted to LTSI (probably be me or you) if we want it to be in LTSI. According to the documentation, this bit is valid only in SPI slave mode. As Linux supports SPI master mode only, this looks like a purely cosmetical issue to me, so it doesn't warrant applying to -stable or LTSI-3.10. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <CAMuHMdU+4qCc64CkJeLAhh4SHqbB0E8Cu=8dKpmaYbphTBJV6g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH 2/2] spi: rspi: Fix typo when clearing SPSR_OVRF [not found] ` <CAMuHMdU+4qCc64CkJeLAhh4SHqbB0E8Cu=8dKpmaYbphTBJV6g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2014-01-10 0:49 ` Simon Horman 0 siblings, 0 replies; 9+ messages in thread From: Simon Horman @ 2014-01-10 0:49 UTC (permalink / raw) To: Geert Uytterhoeven Cc: Geert Uytterhoeven, Mark Brown, linux-spi-u79uwXL29TY76Z2rM5mHXA, Linux-sh list, Magnus Damm On Thu, Jan 09, 2014 at 10:41:55AM +0100, Geert Uytterhoeven wrote: > Hi Simon, > > On Fri, Dec 27, 2013 at 3:16 AM, Simon Horman <horms-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org> wrote: > > On Tue, Dec 24, 2013 at 10:26:17AM +0100, Geert Uytterhoeven wrote: > >> On Tue, Dec 24, 2013 at 3:59 AM, Simon Horman <horms-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org> wrote: > >> > On Mon, Dec 23, 2013 at 07:34:24PM +0100, Geert Uytterhoeven wrote: > >> >> The overrun flag should be cleared in the SPI Status Register, not in the > >> >> SPI Control Register, based on the SDK sample code. > >> >> > >> >> Signed-off-by: Geert Uytterhoeven <geert+renesas-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org> > >> > >> The issue is quite obvious: after clearing the bit, the new value should > >> be written back to the same register. > >> > >> However, the fix is not in a v3.10-rc6 version I saw, so this may matter > >> for LTSI. > > > > I believe that the LTSI-3.10 work from Renesas (so far mainly me) is > > independent of the sample code at the link above. So unless this fix ends > > up in v3.10 -stable, which should feed into LTSI-3.10, then it will need to > > be submitted to LTSI (probably be me or you) if we want it to be in LTSI. > > According to the documentation, this bit is valid only in SPI slave mode. > As Linux supports SPI master mode only, this looks like a purely cosmetical > issue to me, so it doesn't warrant applying to -stable or LTSI-3.10. Thanks for the clarification. -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] spi: rspi: Fix NULL pointer dereference on SH7757 2013-12-23 18:34 [PATCH 1/2] spi: rspi: Fix NULL pointer dereference on SH7757 Geert Uytterhoeven 2013-12-23 18:34 ` [PATCH 2/2] spi: rspi: Fix typo when clearing SPSR_OVRF Geert Uytterhoeven @ 2013-12-24 2:58 ` Simon Horman 2013-12-24 13:12 ` Mark Brown 2 siblings, 0 replies; 9+ messages in thread From: Simon Horman @ 2013-12-24 2:58 UTC (permalink / raw) To: Geert Uytterhoeven; +Cc: Mark Brown, linux-spi, linux-sh, Hiep Cao Minh On Mon, Dec 23, 2013 at 07:34:23PM +0100, Geert Uytterhoeven wrote: > SH7757 doesn't pass platform data, in which case spi-rspi uses default > parameters. > > However, commit 5ce0ba88650f2606244a761d92e2b725f4ab3583 ("spi: rcar: add > Renesas QSPI support on RSPI") added a new user of the platform data, but > forgot to check for its validity first, causing a NULL pointer dereference > on SH7757. > > Add the missing check to fix this. > > Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org> > Cc: Hiep Cao Minh <cm-hiep@jinso.co.jp> Acked-by: Simon Horman <horms+renesas@verge.net.au> > --- > This fixes a regression introduced in v3.13-rc1 > > drivers/spi/spi-rspi.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c > index cfdbb422a40a..9e0301014f48 100644 > --- a/drivers/spi/spi-rspi.c > +++ b/drivers/spi/spi-rspi.c > @@ -948,8 +948,9 @@ static int rspi_probe(struct platform_device *pdev) > INIT_WORK(&rspi->ws, rspi_work); > init_waitqueue_head(&rspi->wait); > > - master->num_chipselect = rspi_pd->num_chipselect; > - if (!master->num_chipselect) > + if (rspi_pd && rspi_pd->num_chipselect) > + master->num_chipselect = rspi_pd->num_chipselect; > + else > master->num_chipselect = 2; /* default */ > > master->bus_num = pdev->id; > -- > 1.7.9.5 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-sh" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] spi: rspi: Fix NULL pointer dereference on SH7757 2013-12-23 18:34 [PATCH 1/2] spi: rspi: Fix NULL pointer dereference on SH7757 Geert Uytterhoeven 2013-12-23 18:34 ` [PATCH 2/2] spi: rspi: Fix typo when clearing SPSR_OVRF Geert Uytterhoeven 2013-12-24 2:58 ` [PATCH 1/2] spi: rspi: Fix NULL pointer dereference on SH7757 Simon Horman @ 2013-12-24 13:12 ` Mark Brown 2 siblings, 0 replies; 9+ messages in thread From: Mark Brown @ 2013-12-24 13:12 UTC (permalink / raw) To: Geert Uytterhoeven; +Cc: linux-spi, linux-sh, Hiep Cao Minh On Mon, Dec 23, 2013 at 07:34:23PM +0100, Geert Uytterhoeven wrote: > SH7757 doesn't pass platform data, in which case spi-rspi uses default > parameters. > > However, commit 5ce0ba88650f2606244a761d92e2b725f4ab3583 ("spi: rcar: add > Renesas QSPI support on RSPI") added a new user of the platform data, but > forgot to check for its validity first, causing a NULL pointer dereference > on SH7757. Applied both, thanks. ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2014-01-10 0:49 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-12-23 18:34 [PATCH 1/2] spi: rspi: Fix NULL pointer dereference on SH7757 Geert Uytterhoeven 2013-12-23 18:34 ` [PATCH 2/2] spi: rspi: Fix typo when clearing SPSR_OVRF Geert Uytterhoeven [not found] ` <1387823664-32318-2-git-send-email-geert+renesas-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org> 2013-12-24 2:59 ` Simon Horman 2013-12-24 9:26 ` Geert Uytterhoeven [not found] ` <CAMuHMdWiJPF2NU+ME=CLMygvABZ_fcTyr7ggdQtFKbOGhCA0+w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2013-12-27 2:16 ` Simon Horman [not found] ` <20131227021639.GD9184-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org> 2014-01-09 9:41 ` Geert Uytterhoeven [not found] ` <CAMuHMdU+4qCc64CkJeLAhh4SHqbB0E8Cu=8dKpmaYbphTBJV6g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2014-01-10 0:49 ` Simon Horman 2013-12-24 2:58 ` [PATCH 1/2] spi: rspi: Fix NULL pointer dereference on SH7757 Simon Horman 2013-12-24 13:12 ` Mark Brown
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).