Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1691141rwb; Fri, 23 Sep 2022 17:20:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4L7y1C8+ddfjGokepLgYNrFDDOQ8wng4eofuEamzqcC1Yozyw454CHokMFaV7lsmc5z3F0 X-Received: by 2002:a05:6402:5ca:b0:445:c80a:3c2 with SMTP id n10-20020a05640205ca00b00445c80a03c2mr10825769edx.247.1663978828144; Fri, 23 Sep 2022 17:20:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663978828; cv=none; d=google.com; s=arc-20160816; b=nX0CEia+7AnbP0xI3Jx0Fn6BXnva3KtTKOtGHCXYgZOATvj9dB6PMMKM/i5pMs/72R X1yF8WkCMOnLOhWmHSw1twQTCGi9/iL+2dMOUneGNn3UrbnAcQsvbWlaqxrMnmyQf/yD IB6pncuWdiuME7wK7ZQnoVOsDuY53I/iTYMllcVmIMXgEhb1JA9nDL2eI6jMS1BXLqLr o4DJkpco32SQrg6pKNvaVAVlFIPgbg4+34Qj+vT3Y/siER9dC5gYO8bXeXrgJWMUtahJ nY2okRlsJ7Dx93sYKZc6M63QoTvsGXw59ko0yffaS7pjHhtspka38wc4D0ZnGYGiZit9 3F3Q== 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 :references:in-reply-to:message-id:date:subject:cc:to:dkim-signature :dkim-signature:from; bh=z4lcvDU/MemQOUY1h+3uqj4PoL4kor3zog3zDG/QSnM=; b=NwEFAlY3uqQwsEkBu1DvTcs3crjUl+cfy8z6bGXGHSm6jKiC6yPQpbuFf0szgkSzZt eoIgri2FbfnZywqdo9i5qKTuLfsa3UqicUtWV0z75MFGec9AQqpxm2kAgo3kYGm3h57D ahaltDwS2O9hAhtRvDvug0P4349NUdxMKJzZsIeCa4KnSoTYy44483EbNJKBmR7GkRIX hixw24UIjAvWPYXjTqgX2/ntI1yeU0Sthuza81EeOqmWvmrgFdX24MHGpIR1QctgEQ/n wlZwZcGOuOLWkPCe1ZmTBX/n+oyjYbPMCEOVjhT2eU+QoafhVZz1of/AEMtNS6qJXLBY 58Aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="R2t99lC/"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u26-20020a50a41a000000b00451bd163c57si7741925edb.534.2022.09.23.17.20.02; Fri, 23 Sep 2022 17:20:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="R2t99lC/"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230089AbiIXAFy (ORCPT + 99 others); Fri, 23 Sep 2022 20:05:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232315AbiIXAFK (ORCPT ); Fri, 23 Sep 2022 20:05:10 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F1C89DFAB; Fri, 23 Sep 2022 17:05:06 -0700 (PDT) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1663977901; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=z4lcvDU/MemQOUY1h+3uqj4PoL4kor3zog3zDG/QSnM=; b=R2t99lC/EqCbqaf4XF8cFgE7FcfLjsAb+kOQ1Wfu6XGekrw/NG4KpclPNhRdYDcMjxba9S 78wtU8Ef2nRNsdoPjknjYM97lBHcPccJzPh241MNm5DeUXghIbK2Jp/Ezbmtgg/FZpwuE2 AVMTTTn5/Oprhvg3BBwZ7ddjTB23kOCIegspaNmHwvknTV2/n9FuEI/tTNP97VY3G3G9gq QtgvZF1bWUY91LCrfZ1ohbqtKc/gAfCur1rGkbJ6bVKnf+WVlnZC6mQuvsw5P7HPWEPWI2 2fuY49WOYSv6DT7AQUzsTYH1uDNqC86UTmVNkaxH7WnCSrp84o4SwlY4WIzd9g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1663977901; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=z4lcvDU/MemQOUY1h+3uqj4PoL4kor3zog3zDG/QSnM=; b=q7Tw6vty0oiILbyIcxbEZIBR6eTBTnRqhvzIU7ymOMavEnHnaBtUi5gMC7dJEYydCUR6Uj CRe60J2Koibhy6BQ== To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, Jason Wessel , Daniel Thompson , Douglas Anderson , Greg Kroah-Hartman , Jiri Slaby , kgdb-bugreport@lists.sourceforge.net, linux-serial@vger.kernel.org Subject: [PATCH printk 09/18] serial: kgdboc: Lock console list in probe function Date: Sat, 24 Sep 2022 02:10:45 +0206 Message-Id: <20220924000454.3319186-10-john.ogness@linutronix.de> In-Reply-To: <20220924000454.3319186-1-john.ogness@linutronix.de> References: <20220924000454.3319186-1-john.ogness@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,INVALID_DATE_TZ_ABSURD, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Thomas Gleixner Unprotected list walks are not necessarily safe. Signed-off-by: Thomas Gleixner Signed-off-by: John Ogness Reviewed-by: Sergey Senozhatsky --- drivers/tty/serial/kgdboc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/kgdboc.c b/drivers/tty/serial/kgdboc.c index 79b7db8580e0..af2aa76bae15 100644 --- a/drivers/tty/serial/kgdboc.c +++ b/drivers/tty/serial/kgdboc.c @@ -193,7 +193,8 @@ static int configure_kgdboc(void) if (!p) goto noconfig; - for_each_console(cons) { + console_list_lock(); + for_each_registered_console(cons) { int idx; if (cons->device && cons->device(cons, &idx) == p && idx == tty_line) { @@ -201,6 +202,7 @@ static int configure_kgdboc(void) break; } } + console_list_unlock(); kgdb_tty_driver = p; kgdb_tty_line = tty_line; -- 2.30.2