From patchwork Wed Oct 19 14:55:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Ogness X-Patchwork-Id: 616689 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B15AC4332F for ; Wed, 19 Oct 2022 15:03:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229484AbiJSPC7 (ORCPT ); Wed, 19 Oct 2022 11:02:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231282AbiJSPCq (ORCPT ); Wed, 19 Oct 2022 11:02:46 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A777C15D0A5; Wed, 19 Oct 2022 07:57:25 -0700 (PDT) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1666191363; 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=NEhmZhH2pnDE6WuTxQwMCcvi/RbMP+L4l7DVKXhScfQ=; b=WkJA4pqmnV5juPN/ttgFR+jALEcs6JiTFkAuj55fv1Kc9Cx9UAm1N2rezLQc4WaDTdI/Ez m/HFdf7pZqHhdxeVSxmJ/wOoDKSjiMkAqJ8syecbdqYLzx9aZNdxjA9PJjkX7XcCeN9bSn bNe0JNx3plnLRTHu6/TZEDVzHEPTgZuc1wDuCH0zd719J7sckLPTqVJ2fAeNX8P7melcni 0q6XH6+z5F33XWbnvc5mJtt5eRYubPRu1pN8zAtwSWT7NlR9AjihtUMfpyxtPV4FPukpwg awmFOtjaGtFa430Q5t3JRNOLPoKJdpHRQeR0xyjB/xzpitnezB7/EUhmrWpzGg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1666191363; 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=NEhmZhH2pnDE6WuTxQwMCcvi/RbMP+L4l7DVKXhScfQ=; b=aDl1Im9QlC7jXBpafB/JPa5shMExjhVLO58+NwKbR8EV60/QUyHkbiIXWH+jwcsUkqMUn9 dwjFqk2pmsScIoAQ== 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 v2 01/38] serial: kgdboc: Lock console list in probe function Date: Wed, 19 Oct 2022 17:01:23 +0206 Message-Id: <20221019145600.1282823-2-john.ogness@linutronix.de> In-Reply-To: <20221019145600.1282823-1-john.ogness@linutronix.de> References: <20221019145600.1282823-1-john.ogness@linutronix.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@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: Petr Mladek Reviewed-by: Greg Kroah-Hartman --- drivers/tty/serial/kgdboc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/tty/serial/kgdboc.c b/drivers/tty/serial/kgdboc.c index 7aa37be3216a..e76f0186c335 100644 --- a/drivers/tty/serial/kgdboc.c +++ b/drivers/tty/serial/kgdboc.c @@ -193,6 +193,7 @@ static int configure_kgdboc(void) if (!p) goto noconfig; + console_lock(); for_each_console(cons) { int idx; if (cons->device && cons->device(cons, &idx) == p && @@ -201,6 +202,7 @@ static int configure_kgdboc(void) break; } } + console_unlock(); kgdb_tty_driver = p; kgdb_tty_line = tty_line;