lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180407171951.122759-2-tony@atomide.com>
Date:   Sat,  7 Apr 2018 10:19:51 -0700
From:   Tony Lindgren <tony@...mide.com>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     linux-kernel@...r.kernel.org, linux-serial@...r.kernel.org,
        Alan Cox <alan@...yncelyn.cymru>,
        Dan Williams <dcbw@...hat.com>,
        Jiri Prchal <jiri.prchal@...ignal.cz>,
        Jiri Slaby <jslaby@...e.cz>, Marcel Partap <mpartap@....net>,
        Merlijn Wajer <merlijn@...zup.org>,
        Michael Nazzareno Trimarchi <michael@...rulasolutions.com>,
        Michael Scott <michael.scott@...aro.org>,
        Pavel Machek <pavel@....cz>,
        Peter Hurley <peter@...leysoftware.com>,
        Russ Gorby <russ.gorby@...el.com>,
        Sascha Hauer <s.hauer@...gutronix.de>,
        Sebastian Reichel <sre@...nel.org>
Subject: [PATCH 2/2] tty: n_gsm: Fix DLCI handling for ADM mode if debug & 2 is not set

At least on droid 4 with control channel in ADM mode, there is no response
to Modem Status Command (MSC). Currently gsmtty_modem_update() expects to
have data in dlci->modem_rx unless debug & 2 is set. This means that on
droid 4, things only work if debug & 2 is set.

Let's fix the issue by ignoring empty dlci->modem_rx for ADM mode. In
the AMD mode, CMD_MSC will never respond and gsm_process_modem() won't
get called to set dlci->modem_rx.

And according to ts_127010v140000p.pdf, MSC is only relevant if basic
option is chosen, so let's test for that too.

Fixes: ea3d8465ab9b ("tty: n_gsm: Allow ADM response in addition to UA for
control dlci")
Cc: linux-serial@...r.kernel.org
Cc: Alan Cox <alan@...yncelyn.cymru>
Cc: Dan Williams <dcbw@...hat.com>
Cc: Jiri Prchal <jiri.prchal@...ignal.cz>
Cc: Jiri Slaby <jslaby@...e.cz>
Cc: Marcel Partap <mpartap@....net>
Cc: Merlijn Wajer <merlijn@...zup.org>
Cc: Michael Nazzareno Trimarchi <michael@...rulasolutions.com>
Cc: Michael Scott <michael.scott@...aro.org>
Cc: Pavel Machek <pavel@....cz>
Cc: Peter Hurley <peter@...leysoftware.com>
Cc: Russ Gorby <russ.gorby@...el.com>
Cc: Sascha Hauer <s.hauer@...gutronix.de>
Cc: Sebastian Reichel <sre@...nel.org>
Signed-off-by: Tony Lindgren <tony@...mide.com>
---
 drivers/tty/n_gsm.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -2871,11 +2871,22 @@ static int gsmtty_modem_update(struct gsm_dlci *dlci, u8 brk)
 static int gsm_carrier_raised(struct tty_port *port)
 {
 	struct gsm_dlci *dlci = container_of(port, struct gsm_dlci, port);
+	struct gsm_mux *gsm = dlci->gsm;
+
 	/* Not yet open so no carrier info */
 	if (dlci->state != DLCI_OPEN)
 		return 0;
 	if (debug & 2)
 		return 1;
+
+	/*
+	 * Basic mode with control channel in ADM mode may not respond
+	 * to CMD_MSC at all and modem_rx is empty.
+	 */
+	if (gsm->encoding == 0 && gsm->dlci[0]->mode == DLCI_MODE_ADM &&
+	    !dlci->modem_rx)
+		return 1;
+
 	return dlci->modem_rx & TIOCM_CD;
 }
 
-- 
2.17.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ