Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2466890rdb; Wed, 4 Oct 2023 01:56:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEvKo3xHLjQM7t2XJFHGQlNFeYXVbNKUyawk6xYusYLIqw20gKudGmVnmi7xZsoI0XOSZxl X-Received: by 2002:a17:903:228e:b0:1c6:2655:625d with SMTP id b14-20020a170903228e00b001c62655625dmr8416019plh.15.1696409770025; Wed, 04 Oct 2023 01:56:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696409770; cv=none; d=google.com; s=arc-20160816; b=RyELXUUKzhToSEkxXI/2RB8laQpGAvVmT6I4EgAC34JMa1kp44JfnfWSAjbnoc8BYV 06YSxei2X967yiWUmobGVVOfyYkKOg/7rozspHfpITlOPqFVXWma0KRwWdTWWa+6Py2L h4W8SRAxt+s5DQc+WufEbMD/NKay5nToe53GkOxrR/rGzGQHgAeQeZE1mC3fiAqu8y31 vb5ZlZZzCvK3vM0jR3i/oEiGXajaOE07VnQaNOpb/sHJux58/ENoe4/eHfAVc8II0HK+ kRxaYuLSLC2YxLhknter+a0jDE2u6V9BJL7ZWsJ2unssUkF1E3XnfcpEvXa3j5pMkYNg ipOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=ATijuH7y5H6PUEJoPopW/MkDQejPGnsTpnLhmAD4eWk=; fh=n7dM+f7LjYuLx+o4gzxXNkEWC9u7qeJi6cmcRDZcVew=; b=pyH/7ugpjJzV38B8joZUwVylS6PSTcANsjx1R9sqy0MaILl9EM37rlU2xc0PcxVLlt biUCxR3Id0iVX4fyfSMJ0yyGTUOorvA1KEqyx4nH0ks/83HKMKWfTgeFqFv36Z8ITzMS ElMSYe4N5hQ7b1umE2YX/Cb4i7sFtbNF5hnZLF3oexpuWUUV53PAO3NzZaOaZvw9ksmw RRoW8u1NTVGsuRlo/HYREF1ZQ3erOdye56CoL8EuQXc5c3A1wJPXS7aHIviC1kzB3ad8 56dQWXpoVTnhEXMWwvkuHciZpe9QCCNllpSkNM1Q6oyxLh14WOLMecqhyueXNMTCF+E/ 0LoQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id ko8-20020a17090307c800b001c604fdbb14si3031527plb.81.2023.10.04.01.56.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 01:56:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id A2881808985B; Wed, 4 Oct 2023 01:55:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241827AbjJDIzj (ORCPT + 99 others); Wed, 4 Oct 2023 04:55:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232554AbjJDIzi (ORCPT ); Wed, 4 Oct 2023 04:55:38 -0400 Received: from muru.com (unknown [72.249.23.125]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 90EF3A6; Wed, 4 Oct 2023 01:55:32 -0700 (PDT) Received: from hillo.muru.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTP id 7C273810D; Wed, 4 Oct 2023 08:55:15 +0000 (UTC) From: Tony Lindgren To: Greg Kroah-Hartman , Jiri Slaby Cc: Andy Shevchenko , Dhruva Gole , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , John Ogness , Johan Hovold , Sebastian Andrzej Siewior , Vignesh Raghavendra , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Subject: [PATCH] serial: 8250: Check for valid console index Date: Wed, 4 Oct 2023 11:55:10 +0300 Message-ID: <20231004085511.42645-1-tony@atomide.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 04 Oct 2023 01:55:47 -0700 (PDT) Let's not allow negative numbers for console index. Signed-off-by: Tony Lindgren --- drivers/tty/serial/8250/8250_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c @@ -611,7 +611,7 @@ static int univ8250_console_setup(struct console *co, char *options) * if so, search for the first available port that does have * console support. */ - if (co->index >= UART_NR) + if (co->index < 0 || co->index >= UART_NR) co->index = 0; /* -- 2.42.0