Received: by 10.192.165.148 with SMTP id m20csp4168865imm; Mon, 30 Apr 2018 13:05:17 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo3brMtp5Ajg/y/Isf5EZmKzT6JD2f/kq2KXDeLC5C6FFMtAffyj/8aFmAnnuny14yUF/Z1 X-Received: by 2002:a63:b105:: with SMTP id r5-v6mr10669983pgf.186.1525118717522; Mon, 30 Apr 2018 13:05:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525118717; cv=none; d=google.com; s=arc-20160816; b=pNLckQkq+h4PGokKhhbLUjuBAfxsOHW2U2N+gLMiEDXRna01yvmXQ9HQsJCAnlNflh 9/RuIR7LvjeojrS00InqrfVbS16mqXzFrOQxz1iYw3edLms4ZRATDviOVfQqdPMfICYh EObX603vQ5rXbj295u1Qf4tx++zlXYr5DxWGzhSnE+8G3Y5FN2VtNzN7/DCxRes1DUqM L5ZHcGlpgvM9WTgCsZ+dGIwvwdWwq3OMBf4GxIlG6LLBdaa+qZA6MffkVQS4/fmutrGj 5tvwRtWJCA70NC053xTbI294LcLPun2qKW2besDSDL/+tvFEgjPPRJ7Y0Dg4jC3wmmED iGOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dmarc-filter :arc-authentication-results; bh=wZtaPTmw8OcgYO8X5YL9W4vkrayL010G6rujZZB6gvk=; b=i0kw9AynLDg7t8fBAjKWNdl/0wMwPJJzm4g2k7tqfuCT6b0i/MW0HKrtm5puE0/rko kLfAqASWhi+00WWgHUJG1Pm+UiF8nNus6/p6PrC6BB88uirYbG54J4wDIa1PoJtocZa7 Yc5ck7OrhP6r77suW7CCMZ+LjMVtcGXbpPvmFiQBABqBEbk7f8oSpFTj2WanXeyLG6Pe jSNz9Me2FZsS+/4L5Aq1amxAr9llcfNm+7+0npIC/jx1rHjhwKPfIw8fpENr8tOeLFvO CCQCg0PkUTh70S0NDk9an/Bwlv+CdInf9wC1alSSoNzF52sqkMAzL1Vu5vKUeq8olPmm ksaA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s36-v6si7918778pld.114.2018.04.30.13.05.03; Mon, 30 Apr 2018 13:05:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756025AbeD3UEi (ORCPT + 99 others); Mon, 30 Apr 2018 16:04:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:34126 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755985AbeD3T1c (ORCPT ); Mon, 30 Apr 2018 15:27:32 -0400 Received: from localhost (unknown [104.132.1.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8982522DAC; Mon, 30 Apr 2018 19:27:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8982522DAC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=fail smtp.mailfrom=gregkh@linuxfoundation.org From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, linux-serial@vger.kernel.org, Alan Cox , Dan Williams , Jiri Prchal , Jiri Slaby , Marcel Partap , Merlijn Wajer , Michael Nazzareno Trimarchi , Michael Scott , Pavel Machek , Peter Hurley , Russ Gorby , Sascha Hauer , Sebastian Reichel , Tony Lindgren Subject: [PATCH 4.14 31/91] tty: n_gsm: Fix DLCI handling for ADM mode if debug & 2 is not set Date: Mon, 30 Apr 2018 12:24:13 -0700 Message-Id: <20180430184005.798978596@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180430184004.216234025@linuxfoundation.org> References: <20180430184004.216234025@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tony Lindgren commit b2d89ad9c9682e795ed6eeb9ed455789ad6cedf1 upstream. 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@vger.kernel.org Cc: Alan Cox Cc: Dan Williams Cc: Jiri Prchal Cc: Jiri Slaby Cc: Marcel Partap Cc: Merlijn Wajer Cc: Michael Nazzareno Trimarchi Cc: Michael Scott Cc: Pavel Machek Cc: Peter Hurley Cc: Russ Gorby Cc: Sascha Hauer Cc: Sebastian Reichel Signed-off-by: Tony Lindgren Cc: stable Signed-off-by: Greg Kroah-Hartman --- drivers/tty/n_gsm.c | 11 +++++++++++ 1 file changed, 11 insertions(+) --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -2885,11 +2885,22 @@ static int gsmtty_modem_update(struct gs 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; }