Return-Path: Received: from wx-out-0506.google.com (wx-out-0506.google.com [66.249.82.232]) by ozlabs.org (Postfix) with ESMTP id DDADADDE1B for ; Thu, 3 Apr 2008 04:46:32 +1100 (EST) Received: by wx-out-0506.google.com with SMTP id h27so2669729wxd.15 for ; Wed, 02 Apr 2008 10:46:30 -0700 (PDT) Message-ID: Date: Wed, 2 Apr 2008 11:46:30 -0600 From: "Grant Likely" Sender: glikely@secretlab.ca To: "John Linn" , "Paul Mackerras" Subject: Re: [PATCH 1/3][POWERPC][V2] of_serial: Fix possible null dereference. In-Reply-To: <20080402165216.8FD2BC9807F@mail21-dub.bigfish.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 References: <20080402165216.8FD2BC9807F@mail21-dub.bigfish.com> Cc: linuxppc-dev@ozlabs.org List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Wed, Apr 2, 2008 at 10:52 AM, John Linn wrote: > From: Stephen Neuendorffer > > 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 > Signed-off-by: John Linn Acked-by: Grant Likely 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.