Received: by 10.223.176.5 with SMTP id f5csp2842803wra; Mon, 5 Feb 2018 10:47:44 -0800 (PST) X-Google-Smtp-Source: AH8x227Iz0/GvG3dV0v7B2UCOqzJh60hDloaGot33GO5xZXPEWfYcMtEDAOuemiyN72AjitLHxOK X-Received: by 2002:a17:902:9683:: with SMTP id n3-v6mr13688142plp.177.1517856464382; Mon, 05 Feb 2018 10:47:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517856464; cv=none; d=google.com; s=arc-20160816; b=jBKxQH7yhWI9kn6xOpzs7j1utG/oB8+Oo2gvDJ4DAcoYky0GDYk0DEBj7Phus++GN1 LqWWOR2BmVdcDAtMXMdkVV0t5+ABTfFl+hfvueHyisKsb/IqkXSM3ZSLTwbt9seuQtW1 VKTa2vbozvEYwtWsNt9IhZdt7UAkhjSDotaFgQcRdmclF6gjg80WWL5aF1vBSHCybaX1 kWKBG0qLILG2RM2gNXVmqhOuQNRPUKEF6Pq11x0L3A8Ta0K+jPnhXVYCyHXnwpD5EOLA 5Rdnxc8c4WthKow55YPXVbn4hpOx+WUOFsYsQ/M8WlO/qla98CA/bOGfXHimy0beZDtI ThkQ== 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 :arc-authentication-results; bh=JoIHCS4/6vhqLWeGLpObunBp7nQPO5oAzkZD2tqXdGI=; b=v6udyAWRP8bDTfDZaLLLwZ1ODmvMzAucgPPrSmvyZ4yG6rqJOwy4h2CwinrfUTBvj4 VabudwkrF16/h/LeGJ45fnxidwtvtnTQFBGNWvLEiDBGddKaZqmM6/ax0GQrZx9ifLqV UUK2jXcPCStfq5qAjIws8Xq1pk6tCKxiRIQcqp+KxKEZewwzK1p0hI3wxKdXdjOB6fBe HANpilSGYIcQg44LVIs7o1a3HkeG3obNRSD+Ab6PEYu3WmajlVzmg7//hTb4rXLiAgax 24j8KmgRWKJNICTuUuGl52x8GO3IMJ4h7MXEAhdNWe1MLU/xYqu40WQ8GWhp7sqbC0SR FWnQ== 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 h130si753013pgc.787.2018.02.05.10.47.29; Mon, 05 Feb 2018 10:47:44 -0800 (PST) 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 S1753307AbeBESpk (ORCPT + 99 others); Mon, 5 Feb 2018 13:45:40 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:53306 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753866AbeBES0J (ORCPT ); Mon, 5 Feb 2018 13:26:09 -0500 Received: from localhost (unknown [104.132.1.108]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 505661126; Mon, 5 Feb 2018 18:25:56 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sebastian Andrzej Siewior Subject: [PATCH 4.15 59/60] serial: core: mark port as initialized after successful IRQ change Date: Mon, 5 Feb 2018 10:23:32 -0800 Message-Id: <20180205182217.167848860@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180205182213.902626065@linuxfoundation.org> References: <20180205182213.902626065@linuxfoundation.org> User-Agent: quilt/0.65 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.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sebastian Andrzej Siewior commit 44117a1d1732c513875d5a163f10d9adbe866c08 upstream. setserial changes the IRQ via uart_set_info(). It invokes uart_shutdown() which free the current used IRQ and clear TTY_PORT_INITIALIZED. It will then update the IRQ number and invoke uart_startup() before returning to the caller leaving TTY_PORT_INITIALIZED cleared. The next open will crash with | list_add double add: new=ffffffff839fcc98, prev=ffffffff839fcc98, next=ffffffff839fcc98. since the close from the IOCTL won't free the IRQ (and clean the list) due to the TTY_PORT_INITIALIZED check in uart_shutdown(). There is same pattern in uart_do_autoconfig() and I *think* it also needs to set TTY_PORT_INITIALIZED there. Is there a reason why uart_startup() does not set the flag by itself after the IRQ has been acquired (since it is cleared in uart_shutdown)? Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/serial_core.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -974,6 +974,8 @@ static int uart_set_info(struct tty_stru } } else { retval = uart_startup(tty, state, 1); + if (retval == 0) + tty_port_set_initialized(port, true); if (retval > 0) retval = 0; }