linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3][POWERPC][V2] of_serial: Fix possible null dereference.
@ 2008-04-02 16:52 John Linn
  2008-04-02 17:46 ` Grant Likely
  0 siblings, 1 reply; 5+ messages in thread
From: John Linn @ 2008-04-02 16:52 UTC (permalink / raw)
  To: linuxppc-dev, grant.likely; +Cc: John Linn

From: Stephen Neuendorffer <stephen.neuendorffer@xilinx.com>

The of_serial driver queries the current-speed property and attempts
to use it to register the custom_divisor property of the uart_port.
However, if current-speed is not set, then this code will dereference
a bad pointer.  The fix is to only set custom_divisor when a
current-speed property appears in the device tree.

Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer@xilinx.com>
Signed-off-by: John Linn <john.linn@xilinx.com>
---
 drivers/serial/of_serial.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/serial/of_serial.c b/drivers/serial/of_serial.c
index a64d858..2efb892 100644
--- a/drivers/serial/of_serial.c
+++ b/drivers/serial/of_serial.c
@@ -56,7 +56,9 @@ static int __devinit of_platform_serial_setup(struct of_device *ofdev,
 	port->flags = UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF | UPF_IOREMAP
 		| UPF_FIXED_PORT;
 	port->dev = &ofdev->dev;
-	port->custom_divisor = *clk / (16 * (*spd));
+	/* If current-speed was set, then try not to change it. */
+	if (spd)
+		port->custom_divisor = *clk / (16 * (*spd));
 
 	return 0;
 }
-- 
1.5.2.1

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

* Re: [PATCH 1/3][POWERPC][V2] of_serial: Fix possible null dereference.
  2008-04-02 16:52 [PATCH 1/3][POWERPC][V2] of_serial: Fix possible null dereference John Linn
@ 2008-04-02 17:46 ` Grant Likely
  2008-04-02 23:39   ` Arnd Bergmann
  0 siblings, 1 reply; 5+ messages in thread
From: Grant Likely @ 2008-04-02 17:46 UTC (permalink / raw)
  To: John Linn, Paul Mackerras; +Cc: linuxppc-dev

On Wed, Apr 2, 2008 at 10:52 AM, John Linn <john.linn@xilinx.com> wrote:
> From: Stephen Neuendorffer <stephen.neuendorffer@xilinx.com>
>
>  The of_serial driver queries the current-speed property and attempts
>  to use it to register the custom_divisor property of the uart_port.
>  However, if current-speed is not set, then this code will dereference
>  a bad pointer.  The fix is to only set custom_divisor when a
>  current-speed property appears in the device tree.
>
>  Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer@xilinx.com>
>  Signed-off-by: John Linn <john.linn@xilinx.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>

Paul, can you please pick this one up for .25?  It is pure bug fix.

Thanks,
g.

>  ---
>   drivers/serial/of_serial.c |    4 +++-
>   1 files changed, 3 insertions(+), 1 deletions(-)
>
>  diff --git a/drivers/serial/of_serial.c b/drivers/serial/of_serial.c
>  index a64d858..2efb892 100644
>  --- a/drivers/serial/of_serial.c
>  +++ b/drivers/serial/of_serial.c
>  @@ -56,7 +56,9 @@ static int __devinit of_platform_serial_setup(struct of_device *ofdev,
>         port->flags = UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF | UPF_IOREMAP
>                 | UPF_FIXED_PORT;
>         port->dev = &ofdev->dev;
>  -       port->custom_divisor = *clk / (16 * (*spd));
>  +       /* If current-speed was set, then try not to change it. */
>  +       if (spd)
>  +               port->custom_divisor = *clk / (16 * (*spd));
>
>         return 0;
>   }
>  --
>  1.5.2.1
>
>
>
>



-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

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

* Re: [PATCH 1/3][POWERPC][V2] of_serial: Fix possible null dereference.
  2008-04-02 17:46 ` Grant Likely
@ 2008-04-02 23:39   ` Arnd Bergmann
  2008-04-03  0:56     ` Josh Boyer
  0 siblings, 1 reply; 5+ messages in thread
From: Arnd Bergmann @ 2008-04-02 23:39 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Paul Mackerras, John Linn

On Wednesday 02 April 2008, Grant Likely wrote:
> On Wed, Apr 2, 2008 at 10:52 AM, John Linn <john.linn@xilinx.com> wrote:
> > From: Stephen Neuendorffer <stephen.neuendorffer@xilinx.com>
> >
> > =A0The of_serial driver queries the current-speed property and attempts
> > =A0to use it to register the custom_divisor property of the uart_port.
> > =A0However, if current-speed is not set, then this code will dereference
> > =A0a bad pointer. =A0The fix is to only set custom_divisor when a
> > =A0current-speed property appears in the device tree.
> >
> > =A0Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer@xilinx.com>
> > =A0Signed-off-by: John Linn <john.linn@xilinx.com>
> Acked-by: Grant Likely <grant.likely@secretlab.ca>

Acked-by: Arnd Bergmann <arnd@arndb.de>

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

* Re: [PATCH 1/3][POWERPC][V2] of_serial: Fix possible null dereference.
  2008-04-02 23:39   ` Arnd Bergmann
@ 2008-04-03  0:56     ` Josh Boyer
  2008-04-03  2:18       ` Arnd Bergmann
  0 siblings, 1 reply; 5+ messages in thread
From: Josh Boyer @ 2008-04-03  0:56 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: linuxppc-dev, Paul Mackerras, John Linn

On Thu, 3 Apr 2008 01:39:04 +0200
Arnd Bergmann <arnd@arndb.de> wrote:

> On Wednesday 02 April 2008, Grant Likely wrote:
> > On Wed, Apr 2, 2008 at 10:52 AM, John Linn <john.linn@xilinx.com> wrote:
> > > From: Stephen Neuendorffer <stephen.neuendorffer@xilinx.com>
> > >
> > > =C2=A0The of_serial driver queries the current-speed property and att=
empts
> > > =C2=A0to use it to register the custom_divisor property of the uart_p=
ort.
> > > =C2=A0However, if current-speed is not set, then this code will deref=
erence
> > > =C2=A0a bad pointer. =C2=A0The fix is to only set custom_divisor when=
 a
> > > =C2=A0current-speed property appears in the device tree.
> > >
> > > =C2=A0Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer@xilin=
x.com>
> > > =C2=A0Signed-off-by: John Linn <john.linn@xilinx.com>
> > Acked-by: Grant Likely <grant.likely@secretlab.ca>
>=20
> Acked-by: Arnd Bergmann <arnd@arndb.de>

This is the second time all three of us have Acked this.  I'm pulling
it in my tree.

josh

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

* Re: [PATCH 1/3][POWERPC][V2] of_serial: Fix possible null dereference.
  2008-04-03  0:56     ` Josh Boyer
@ 2008-04-03  2:18       ` Arnd Bergmann
  0 siblings, 0 replies; 5+ messages in thread
From: Arnd Bergmann @ 2008-04-03  2:18 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Paul Mackerras, John Linn

On Thursday 03 April 2008, Josh Boyer wrote:
> > > > =C2=A0Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer@xil=
inx.com>
> > > > =C2=A0Signed-off-by: John Linn <john.linn@xilinx.com>
> > > Acked-by: Grant Likely <grant.likely@secretlab.ca>
> >=20
> > Acked-by: Arnd Bergmann <arnd@arndb.de>
>=20
> This is the second time all three of us have Acked this. =C2=A0I'm pulling
> it in my tree.
>=20

Hehe, thanks!

I never know what the right thing to do with of_serial patches is.
In the past, I've sent them to akpm, in the absense of a dedicated
serial driver maintainer, but I'm just as happy when they get into
mainline any other way.

Of course, it feels a bit wrong for me to forward a patch that
was never sent to me personally.

	Arnd <><

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

end of thread, other threads:[~2008-04-03  2:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-02 16:52 [PATCH 1/3][POWERPC][V2] of_serial: Fix possible null dereference John Linn
2008-04-02 17:46 ` Grant Likely
2008-04-02 23:39   ` Arnd Bergmann
2008-04-03  0:56     ` Josh Boyer
2008-04-03  2:18       ` Arnd Bergmann

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).