Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2340390ybz; Thu, 23 Apr 2020 16:20:20 -0700 (PDT) X-Google-Smtp-Source: APiQypKW4UQZKVrvrjFxdr36Gm8k+TD8xxI7KQlQh7LB0sOONiTOUPRCp+gPRYfImlo2yWWArBY5 X-Received: by 2002:a17:906:315a:: with SMTP id e26mr4653704eje.53.1587684020621; Thu, 23 Apr 2020 16:20:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587684020; cv=none; d=google.com; s=arc-20160816; b=mbWEUIEoLSMmOYDEiNxQMncP+FUJZAhuf7T/NyrzlXolIsU48UqsMplkdTtFwyYvyc rLvy3UUHbW1OmWJ7hl5IMO+1ceDNgH7PG1fkZ159E4RWLLYwc34eHDNVFU9ZhfYxYG53 0viV8b3selYkIPrhqQD1zisdKyEQXPgcc2uuKlau/Y8Ufyig905eFqMvJLz1O8/bq07M YT01shwx/mqge2lHv0wtFL9xac9SzwiSkxsB9Qd+gub5PtwR6cpNJ0UuiiDeCAp7MUTI 1YVwXMJ76j7zA1yu5sqMKWNe2qFRaBQffNK23m4HRpHYjSSB3f9ciMvRsbvZc1iy3GvB 4j+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=4ZxRlCuDf4IwIshRg0xVipLSFS9/iIXWRULHgE87xJM=; b=TIFFiiCQG3wjmkK2aAqA6qndD/sMgELjHEotLeYtMmf0/ovcxPmoKEzTSP6aQKJWoP +W6H1XxwUGcUQNjf+I6JvVUCKp7dnxDBSJyXxueKsl2mfvG14gjavNqppbmxkod9ttS3 6PVMFRmS3BnmmQTceTRQuS8E4jgY7sZhVLjoj9yPsGNoZ09jXiUiSueXwCkfE/IHcEFv r8mhM/a66OwDUbeBwgnb9Cbt/z2NQFam2l3KyFaupsx7kihthJTt8Cp4gUF0nY9DvnQ8 zsmdJb2TXU79QIv83W2etl5jjS07m+Llx8ti+UXQvzW6q1LQqL1GdfcOe2FJtXV8kmYY IshA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z18si1978581edx.121.2020.04.23.16.19.57; Thu, 23 Apr 2020 16:20:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729171AbgDWXP4 (ORCPT + 99 others); Thu, 23 Apr 2020 19:15:56 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:49634 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728396AbgDWXGq (ORCPT ); Thu, 23 Apr 2020 19:06:46 -0400 Received: from [192.168.4.242] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1jRkvT-0004h9-Ne; Fri, 24 Apr 2020 00:06:35 +0100 Received: from ben by deadeye with local (Exim 4.93) (envelope-from ) id 1jRkvS-00E6qc-2v; Fri, 24 Apr 2020 00:06:34 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, Denis Kirjanov , "Greg Kroah-Hartman" , "Kenneth R. Crudup" , "Sudip Mukherjee" Date: Fri, 24 Apr 2020 00:06:11 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) X-Patchwork-Hint: ignore Subject: [PATCH 3.16 144/245] tty: always relink the port In-Reply-To: X-SA-Exim-Connect-IP: 192.168.4.242 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.83-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Sudip Mukherjee commit 273f632912f1b24b642ba5b7eb5022e43a72f3b5 upstream. If the serial device is disconnected and reconnected, it re-enumerates properly but does not link it. fwiw, linking means just saving the port index, so allow it always as there is no harm in saving the same value again even if it tries to relink with the same port. Fixes: fb2b90014d78 ("tty: link tty and port before configuring it as console") Reported-by: Kenneth R. Crudup Signed-off-by: Sudip Mukherjee Link: https://lore.kernel.org/r/20191227174434.12057-1-sudipm.mukherjee@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Ben Hutchings --- drivers/tty/tty_port.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/drivers/tty/tty_port.c +++ b/drivers/tty/tty_port.c @@ -49,8 +49,7 @@ void tty_port_link_device(struct tty_por { if (WARN_ON(index >= driver->num)) return; - if (!driver->ports[index]) - driver->ports[index] = port; + driver->ports[index] = port; } EXPORT_SYMBOL_GPL(tty_port_link_device);