From: Tony Lindgren <tony@atomide.com>
To: Wei Yongjun <weiyj.lk@gmail.com>
Cc: gregkh@linuxfoundation.org, jslaby@suse.cz,
grant.likely@linaro.org, rob.herring@calxeda.com,
sourav.poddar@ti.com, yongjun_wei@trendmicro.com.cn,
devicetree-discuss@lists.ozlabs.org,
linux-serial@vger.kernel.org
Subject: Re: [PATCH -next] serial: omap: fix potential NULL pointer dereference in serial_omap_runtime_suspend()
Date: Wed, 5 Jun 2013 08:28:56 -0700 [thread overview]
Message-ID: <20130605152856.GS3331@atomide.com> (raw)
In-Reply-To: <CAPgLHd-N6jTD_WvT2KgsG8vOtKCtpJET8ddyQBWUMp=qG_3G+Q@mail.gmail.com>
* Wei Yongjun <weiyj.lk@gmail.com> [130604 19:10]:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> The dereference to 'up' should be moved below the NULL test.
> Introduced by commit ddd85e225c8885b5e4419b0499ab27100e7c366a
> (serial: omap: prevent runtime PM for "no_console_suspend")
Acked-by: Tony Lindgren <tony@atomide.com>
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> ---
> drivers/tty/serial/omap-serial.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
> index 1aaeca8..156b5aa 100644
> --- a/drivers/tty/serial/omap-serial.c
> +++ b/drivers/tty/serial/omap-serial.c
> @@ -1613,6 +1613,9 @@ static int serial_omap_runtime_suspend(struct device *dev)
> struct uart_omap_port *up = dev_get_drvdata(dev);
> struct omap_uart_port_info *pdata = dev->platform_data;
>
> + if (!up)
> + return -EINVAL;
> +
> /*
> * When using 'no_console_suspend', the console UART must not be
> * suspended. Since driver suspend is managed by runtime suspend,
> @@ -1623,9 +1626,6 @@ static int serial_omap_runtime_suspend(struct device *dev)
> uart_console(&up->port))
> return -EBUSY;
>
> - if (!up)
> - return -EINVAL;
> -
> if (!pdata)
> return 0;
>
>
> _______________________________________________
> devicetree-discuss mailing list
> devicetree-discuss@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/devicetree-discuss
prev parent reply other threads:[~2013-06-05 15:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-05 2:04 [PATCH -next] serial: omap: fix potential NULL pointer dereference in serial_omap_runtime_suspend() Wei Yongjun
2013-06-05 15:28 ` Tony Lindgren [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130605152856.GS3331@atomide.com \
--to=tony@atomide.com \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=grant.likely@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.cz \
--cc=linux-serial@vger.kernel.org \
--cc=rob.herring@calxeda.com \
--cc=sourav.poddar@ti.com \
--cc=weiyj.lk@gmail.com \
--cc=yongjun_wei@trendmicro.com.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).