From patchwork Fri Sep 9 22:37:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 75922 Delivered-To: patch@linaro.org Received: by 10.140.106.11 with SMTP id d11csp569704qgf; Fri, 9 Sep 2016 15:37:18 -0700 (PDT) X-Received: by 10.66.72.106 with SMTP id c10mr10732676pav.18.1473460638484; Fri, 09 Sep 2016 15:37:18 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w125si5972706pfb.167.2016.09.09.15.37.18; Fri, 09 Sep 2016 15:37:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-serial-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-serial-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-serial-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754934AbcIIWhQ (ORCPT + 2 others); Fri, 9 Sep 2016 18:37:16 -0400 Received: from mail-oi0-f65.google.com ([209.85.218.65]:34544 "EHLO mail-oi0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753756AbcIIWhO (ORCPT ); Fri, 9 Sep 2016 18:37:14 -0400 Received: by mail-oi0-f65.google.com with SMTP id a144so4267969oii.1; Fri, 09 Sep 2016 15:37:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=moNP/bAfqkF56S4NrjGPO0himlQoYp1r5t/fDQj7uWE=; b=QQaAm5EctVRcMbx+pEs9TvUkQVExyv+7Z7u1sPqrM+UElVZc2YG35rgawWM8OPSVxM pEvGUqAKdQ0JpExOdxayEofW0qltc+9BQDG7r7FUXV3D/FYzIGIkOFqZhuH3W9tmuapM +jBjjTuVeizxXycNgq/cAjh4F2nQFLwuarZZLEC6Cy8NhicTVKT/HDwaCM/pwRUBOD0b /nHneL+dmzW+BdOLzXIdDC2hA/u1PmORsKUeqx5ZAt4R49XLeMtx/r9mr+0RZ6DNAjji V+MaQMKlM1IJhy+JmdSxycfgfET0uRspxMFc4GYYuu1+cPicJPG7cHlZcgylfZPImzH/ keoA== X-Gm-Message-State: AE9vXwME/y/ujUelC/TmOHLv9W8ofyF2ZTJUtqWdyYPOJW40kqzQ/MaFRm7B8tQoXoYJxg== X-Received: by 10.202.182.130 with SMTP id g124mr9280327oif.106.1473460633728; Fri, 09 Sep 2016 15:37:13 -0700 (PDT) Received: from rob-hp-laptop.herring.priv (72-48-98-129.dyn.grandenetworks.net. [72.48.98.129]) by smtp.googlemail.com with ESMTPSA id v185sm1902378oie.24.2016.09.09.15.37.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Sep 2016 15:37:13 -0700 (PDT) From: Rob Herring To: Alan Cox , Greg Kroah-Hartman , Jiri Slaby , Peter Hurley Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Subject: [PATCH 1/9] tty: serial_core: add tty NULL check to uart_tx_stopped Date: Fri, 9 Sep 2016 17:37:02 -0500 Message-Id: <20160909223711.26238-2-robh@kernel.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20160909223711.26238-1-robh@kernel.org> References: <20160909223711.26238-1-robh@kernel.org> Sender: linux-serial-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Commit 761ed4a94582 ("tty: serial_core: convert uart_close to use tty_port_close") created a case where a port used for a console does not get shutdown on tty closing. Then a call to uart_tx_stopped() segfaults because the tty is NULL. This could be fixed to restore old behavior, but we also want to allow tty_ports to work without a tty attached. So this change to allow a NULL tty_struct is needed either way. Fixes: 761ed4a94582 ("tty: serial_core: convert uart_close to use tty_port_close") Reported-by: kernel test robot Signed-off-by: Rob Herring --- include/linux/serial_core.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index cdba6f144f72..378d80a8dd43 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -412,7 +412,7 @@ int uart_resume_port(struct uart_driver *reg, struct uart_port *port); static inline int uart_tx_stopped(struct uart_port *port) { struct tty_struct *tty = port->state->port.tty; - if (tty->stopped || port->hw_stopped) + if ((tty && tty->stopped) || port->hw_stopped) return 1; return 0; }