From: Joe Perches <joe@perches.com>
To: SF Markus Elfring <elfring@users.sourceforge.net>,
linux-serial@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Guilherme G. Piccoli" <gpiccoli@linux.vnet.ibm.com>,
Jiri Slaby <jslaby@suse.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] jsm_tty: Fix a possible null pointer dereference in two functions
Date: Wed, 29 Nov 2017 17:23:07 +0000 [thread overview]
Message-ID: <1511976187.19952.65.camel@perches.com> (raw)
In-Reply-To: <5c78db97-88f5-8655-9a47-eeee0a043fba@users.sourceforge.net>
On Wed, 2017-11-29 at 17:40 +0100, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 29 Nov 2017 17:30:36 +0100
>
> Move two debug messages so that a null pointer access can not happen
> for the variable "ch" in these functions.
An actual defect fix!
Here you could probably cc stable too.
>
> This issue was detected by using the Coccinelle software.
>
> Fixes: 669fef464468d3f02d60a5cf725fc097e03c5cb8 ("serial: jsm: Convert jsm_printk to jsm_dbg")
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/tty/serial/jsm/jsm_tty.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/tty/serial/jsm/jsm_tty.c b/drivers/tty/serial/jsm/jsm_tty.c
> index 469927d37b41..a34eed7344e5 100644
> --- a/drivers/tty/serial/jsm/jsm_tty.c
> +++ b/drivers/tty/serial/jsm/jsm_tty.c
> @@ -521,11 +521,10 @@ void jsm_input(struct jsm_channel *ch)
> int s = 0;
> int i = 0;
>
> - jsm_dbg(READ, &ch->ch_bd->pci_dev, "start\n");
> -
> if (!ch)
> return;
>
> + jsm_dbg(READ, &ch->ch_bd->pci_dev, "start\n");
> port = &ch->uart_port.state->port;
> tp = port->tty;
>
> @@ -647,10 +646,10 @@ static void jsm_carrier(struct jsm_channel *ch)
> int virt_carrier = 0;
> int phys_carrier = 0;
>
> - jsm_dbg(CARR, &ch->ch_bd->pci_dev, "start\n");
> if (!ch)
> return;
>
> + jsm_dbg(CARR, &ch->ch_bd->pci_dev, "start\n");
> bd = ch->ch_bd;
>
> if (!bd)
WARNING: multiple messages have this Message-ID (diff)
From: Joe Perches <joe@perches.com>
To: SF Markus Elfring <elfring@users.sourceforge.net>,
linux-serial@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Guilherme G. Piccoli" <gpiccoli@linux.vnet.ibm.com>,
Jiri Slaby <jslaby@suse.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] jsm_tty: Fix a possible null pointer dereference in two functions
Date: Wed, 29 Nov 2017 09:23:07 -0800 [thread overview]
Message-ID: <1511976187.19952.65.camel@perches.com> (raw)
In-Reply-To: <5c78db97-88f5-8655-9a47-eeee0a043fba@users.sourceforge.net>
On Wed, 2017-11-29 at 17:40 +0100, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 29 Nov 2017 17:30:36 +0100
>
> Move two debug messages so that a null pointer access can not happen
> for the variable "ch" in these functions.
An actual defect fix!
Here you could probably cc stable too.
>
> This issue was detected by using the Coccinelle software.
>
> Fixes: 669fef464468d3f02d60a5cf725fc097e03c5cb8 ("serial: jsm: Convert jsm_printk to jsm_dbg")
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/tty/serial/jsm/jsm_tty.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/tty/serial/jsm/jsm_tty.c b/drivers/tty/serial/jsm/jsm_tty.c
> index 469927d37b41..a34eed7344e5 100644
> --- a/drivers/tty/serial/jsm/jsm_tty.c
> +++ b/drivers/tty/serial/jsm/jsm_tty.c
> @@ -521,11 +521,10 @@ void jsm_input(struct jsm_channel *ch)
> int s = 0;
> int i = 0;
>
> - jsm_dbg(READ, &ch->ch_bd->pci_dev, "start\n");
> -
> if (!ch)
> return;
>
> + jsm_dbg(READ, &ch->ch_bd->pci_dev, "start\n");
> port = &ch->uart_port.state->port;
> tp = port->tty;
>
> @@ -647,10 +646,10 @@ static void jsm_carrier(struct jsm_channel *ch)
> int virt_carrier = 0;
> int phys_carrier = 0;
>
> - jsm_dbg(CARR, &ch->ch_bd->pci_dev, "start\n");
> if (!ch)
> return;
>
> + jsm_dbg(CARR, &ch->ch_bd->pci_dev, "start\n");
> bd = ch->ch_bd;
>
> if (!bd)
next prev parent reply other threads:[~2017-11-29 17:23 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-29 16:40 [PATCH] jsm_tty: Fix a possible null pointer dereference in two functions SF Markus Elfring
2017-11-29 16:40 ` SF Markus Elfring
2017-11-29 17:23 ` Joe Perches [this message]
2017-11-29 17:23 ` Joe Perches
2017-11-29 17:35 ` Greg Kroah-Hartman
2017-11-29 17:51 ` Joe Perches
2017-11-29 17:51 ` Joe Perches
2017-11-29 18:05 ` Greg Kroah-Hartman
2017-11-29 18:16 ` Joe Perches
2017-11-29 18:16 ` Joe Perches
2017-11-29 18:19 ` SF Markus Elfring
2017-11-29 18:19 ` SF Markus Elfring
2017-11-30 6:41 ` Jiri Slaby
2017-11-30 6:41 ` Jiri Slaby
2017-12-06 16:16 ` Guilherme G. Piccoli
2017-12-06 16:16 ` Guilherme G. Piccoli
2017-12-16 6:27 ` jsm_tty: Deletion of a null pointer check in two functions? SF Markus Elfring
2017-12-16 6:27 ` SF Markus Elfring
2017-12-18 14:36 ` Guilherme G. Piccoli
2017-12-18 14:36 ` Guilherme G. Piccoli
2017-12-18 17:14 ` SF Markus Elfring
2017-12-18 17:14 ` SF Markus Elfring
2017-11-29 19:16 ` [PATCH] jsm_tty: Fix a possible null pointer dereference in two functions Dan Carpenter
2017-11-29 19:16 ` Dan Carpenter
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=1511976187.19952.65.camel@perches.com \
--to=joe@perches.com \
--cc=elfring@users.sourceforge.net \
--cc=gpiccoli@linux.vnet.ibm.com \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.