Received: by 10.192.165.148 with SMTP id m20csp4156114imm; Mon, 30 Apr 2018 12:50:40 -0700 (PDT) X-Google-Smtp-Source: AB8JxZouxAMPH39kmjouZNO5jglivFwRJ0EHtypE68aUoKJ8eqBVI8aC4z9Lkdf1bxmwyCrnia57 X-Received: by 2002:a65:602f:: with SMTP id p15-v6mr10930534pgu.430.1525117840374; Mon, 30 Apr 2018 12:50:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525117840; cv=none; d=google.com; s=arc-20160816; b=JLbDNnQAaoHFcug5XFvnRnSqlSTJt3I4sy92Tav3cJRMzNVbzE8hvzgf1ZpgToWTUI OJ5MgVLVLi0n/Jy14x8NVeJvEZfx+H33EulNQI7m7NdegcYaTRjFUtD3fJfyNwcKnC+b GzUwtQyqe5vI0BYrJbpRv5AlIrfz7KRC61PL1tHUpfXQwSRsxpi3zjYD0K9yDua2Zmz6 7nk/e4r7rKovI5yh/C+Rupdr+jC1eBw2i1zWphp1HtyZoScbAfa1gNqLDZ6x+AU3DJsg RaW90txPwt/jn7owYuHbm0geELkyp6ImLy/R+wjpCfJd1p43lxpfJ/WpkIoOwZKQJQkp 9dkw== 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=+C0rQve0zF3Md3alzfS703VWhHOfbuDQ2BTC55lprKM=; b=rWqTyB6CoQb84U9Zf80MfPcCGYQMmv5tGMcKygh/nO3uADpReuMezckalpX09yMmCr 4SJI58f8DblZBvPqq+Q2KxibgfymspWOyEHIPVqBW7dZdk5mjW8mItwlMupVlCUzOyMa wx6IzAQDq/tihlZhtRXOKx895aZxehtTAX5jlzLSe0yA8New/9meRyFck6MzfarAykYo TuooKRh4qUrVJ8FJh9MvEFQ4CjvitKs+adXAUBaDP5kdmA8sRZme033DrHNianv2pYHP Ot1W6fzQdASTgJPanU1ho+3xH5DaKkyycV2oUwzgC1qkt2xbJKqmhA7i5ePYWTEsg1BW C1Qg== 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 f35-v6si7845826plh.193.2018.04.30.12.50.26; Mon, 30 Apr 2018 12:50:40 -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 S1755256AbeD3T2O (ORCPT + 99 others); Mon, 30 Apr 2018 15:28:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:35494 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755211AbeD3T2J (ORCPT ); Mon, 30 Apr 2018 15:28:09 -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 7FB9C22DBF; Mon, 30 Apr 2018 19:28:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7FB9C22DBF 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.16 033/113] tty: n_gsm: Fix DLCI handling for ADM mode if debug & 2 is not set Date: Mon, 30 Apr 2018 12:24:04 -0700 Message-Id: <20180430184016.459739950@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180430184015.043892819@linuxfoundation.org> References: <20180430184015.043892819@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.16-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 @@ -2871,11 +2871,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; }