From: Dan Carpenter <dan.carpenter@oracle.com>
To: Colin King <colin.king@canonical.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jslaby@suse.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Phil Elwell <phil@raspberrypi.org>,
Jan Kiszka <jan.kiszka@siemens.com>,
Eric Anholt <eric@anholt.net>,
Thor Thayer <tthayer@opensource.altera.com>,
Rafael Gago <rafael.gago@gmail.com>,
David Lechner <david@lechnology.com>,
linux-serial@vger.kernel.org, kernel-janitors@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH][serial-next] serial: 8250: don't dereference em485 until it has been null checked
Date: Tue, 29 Aug 2017 23:04:11 +0300 [thread overview]
Message-ID: <20170829200411.wbqdsihcnhpg2gmr@mwanda> (raw)
In-Reply-To: <20170829165815.23429-1-colin.king@canonical.com>
On Tue, Aug 29, 2017 at 05:58:15PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Currently, the pointer em485 is dereferenced to get p and then later
> em485 is checked to see if it is null before calling __start_tx. In
> the case where em485 is null, we get a null pointer dereference. Fix
> this by moving the deference and the associated spinlock/unlocks on
> p to the code block where em485 is known to be not null.
>
> Detected by CoverityScan, CID#14555001 ("Dereference before null check")
>
> Fixes 6e0a5de2136b ("serial: 8250: Use hrtimers for rs485 delays")
I don't understand which tree this commit is from. I have it fetched
but when I do a git log on drivers/tty/serial/8250/8250_port.c then I
don't see it. I have today's linux-next.
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/tty/serial/8250/8250_port.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
> index 4726aa276968..c20b581313f0 100644
> --- a/drivers/tty/serial/8250/8250_port.c
> +++ b/drivers/tty/serial/8250/8250_port.c
> @@ -1606,18 +1606,18 @@ static inline void start_tx_rs485(struct uart_port *port)
> static enum hrtimer_restart serial8250_em485_handle_start_tx(struct hrtimer *t)
I'm pretty sure "t" isn't ever NULL.
regards,
dan carpenter
next prev parent reply other threads:[~2017-08-29 20:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-29 16:58 [PATCH][serial-next] serial: 8250: don't dereference em485 until it has been null checked Colin King
2017-08-29 19:57 ` Andy Shevchenko
2017-08-29 20:04 ` Dan Carpenter [this message]
2017-08-29 20:22 ` Andy Shevchenko
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=20170829200411.wbqdsihcnhpg2gmr@mwanda \
--to=dan.carpenter@oracle.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=colin.king@canonical.com \
--cc=david@lechnology.com \
--cc=eric@anholt.net \
--cc=gregkh@linuxfoundation.org \
--cc=jan.kiszka@siemens.com \
--cc=jslaby@suse.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=phil@raspberrypi.org \
--cc=rafael.gago@gmail.com \
--cc=tthayer@opensource.altera.com \
/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