Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1303475rwb; Wed, 28 Sep 2022 16:38:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6syoowC1y13io6nED/pZ8AzG5cv8vetRM6d8vTHnyKhuEyYDPS7NH6LhNEDJKSMiOEy0/+ X-Received: by 2002:a17:907:7fa0:b0:782:948b:e212 with SMTP id qk32-20020a1709077fa000b00782948be212mr282794ejc.231.1664408314126; Wed, 28 Sep 2022 16:38:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664408314; cv=none; d=google.com; s=arc-20160816; b=T6m2U0cutrOASVm6R7hRF/6J/vtOtg9EINQjrzUQmL9behV3l5IuG9PfWUaqOjYB6U vUrkoksoisRVKZuzZnqWWPUeIvcVy0bPqVFzXrup7HuzvKTLY+IJtWj4KSr7glQuq0jV JqXU7VLi/swNqq7jRYPHKQFV3MhdSI0LC+P1RONPcZnZ0WdwbBlqv8zV3ZjAuxTn0PJ+ sOVh5jCD1REL3fLvAhGdT/QoAPrgquVnA60AL6X2A3UXAYszd7X2PLDVT6ssMqik9wgW toKGVJiAgaQfEy7l3EHFnSkFNHblHtMx+TpSa+8eT7bGEn7cLf1E2Lv2rHcQWh24spAM 7PpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=q74yArMABpzeLkr74sIBfXXMxk7/EMgQ3hoGRYitxYU=; b=oDsZ2KcRUkwOXJDBrlcGsvEHIgOrzGI0erQ1ey1JnDHJ3T5qUgFTysrJqDBPljojPq HP1esF4ZPHYSvi0pIUxwuVGbAbKVPxo2qqBpeTOVMp/HJlOOT+ohkXr9k/E92KNbuAE4 j96yleLCgZyMJWlpk9WdjC3qgUYSPcxGEPQBlHFfwkvznH4c7KcIUMYWdie+UQK2NKfo s+GeAPTUgdCpF/i27KO2mtyCw9atfGYeWRRkfQ+xgb8dPgCevyIoK3m3K5DLZTiyToiM gOLfuhYEqZ8lEIyXEqMGBzuCeqEp8aEsjdVqyG+qzY2ZRXIMg1UB5vIDRXLiSaRUKHBE SbBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=U0Q8SQFH; 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=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id co28-20020a0564020c1c00b00451e1aae675si4378974edb.547.2022.09.28.16.38.07; Wed, 28 Sep 2022 16:38:34 -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=@chromium.org header.s=google header.b=U0Q8SQFH; 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=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233235AbiI1XdL (ORCPT + 99 others); Wed, 28 Sep 2022 19:33:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233585AbiI1XdI (ORCPT ); Wed, 28 Sep 2022 19:33:08 -0400 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49E12EF08C for ; Wed, 28 Sep 2022 16:33:07 -0700 (PDT) Received: by mail-ej1-x631.google.com with SMTP id l14so30179936eja.7 for ; Wed, 28 Sep 2022 16:33:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=q74yArMABpzeLkr74sIBfXXMxk7/EMgQ3hoGRYitxYU=; b=U0Q8SQFHSkScbj4cM4pTg7Yzb04zm5WgomM/5gs7MQUTxOnAoEjVy5BjCW7Lo5/BUi xVGQd3n/TGijftlrmbedS+TIFC4PIQ4GVxgHSTo1Hxqh7rav4zS5xPPOiO0U6zV/NMl4 5n8EmZnC9tTRHnX8rS/uqie8PD5M0KehiVHl4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=q74yArMABpzeLkr74sIBfXXMxk7/EMgQ3hoGRYitxYU=; b=HHcKM2N26y1/LBA5bO31ggTNleaQWjM6xDwz+OUNSH3RBPvOFfnh4uhZoly/RuJ6NA uWkhImOrZU+puBX2vS4QwqrbQjg1FzpZgGBYjcMONhhXTUzbK/PDQBpAnl5cZDJfGHaD DOo9Nz4Z5j3CEZJnhpJdxeSdwNf2vPIXlJBZ2XBj6zw7CdAMF9gC2T9oRZrK1ZOCk6+G kRT+rLqfDcTGQD55jf1H1lpuqOfZMIcP3osRtv4OoMmuwdNG+xf943gu4PWbak+D9kvj vetHbBuji0DCfBrd+sj7CaF9iruUHe9wIkip4yPrDFGmOjvjblYaLh0lWHR3lZMCGJOv FbGA== X-Gm-Message-State: ACrzQf1a92pTgBbQjtkeyg7BinM7Q2wkevCn8Ng2y3LRpYPTKJGEa3Zb eFH2pzUnuUVXaogjT41UzJjTm3GVvuEZCApZ X-Received: by 2002:a17:907:7202:b0:783:1bed:c5db with SMTP id dr2-20020a170907720200b007831bedc5dbmr315200ejc.124.1664407985511; Wed, 28 Sep 2022 16:33:05 -0700 (PDT) Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com. [209.85.221.43]) by smtp.gmail.com with ESMTPSA id kx9-20020a170907774900b0073dc8d0eabesm3023511ejc.15.2022.09.28.16.33.03 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 28 Sep 2022 16:33:04 -0700 (PDT) Received: by mail-wr1-f43.google.com with SMTP id m4so7668113wrr.5 for ; Wed, 28 Sep 2022 16:33:03 -0700 (PDT) X-Received: by 2002:a5d:522f:0:b0:228:dc7f:b9a8 with SMTP id i15-20020a5d522f000000b00228dc7fb9a8mr145687wra.617.1664407983299; Wed, 28 Sep 2022 16:33:03 -0700 (PDT) MIME-Version: 1.0 References: <20220924000454.3319186-1-john.ogness@linutronix.de> <20220924000454.3319186-10-john.ogness@linutronix.de> In-Reply-To: <20220924000454.3319186-10-john.ogness@linutronix.de> From: Doug Anderson Date: Wed, 28 Sep 2022 16:32:51 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH printk 09/18] serial: kgdboc: Lock console list in probe function To: John Ogness Cc: Petr Mladek , Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , LKML , Jason Wessel , Daniel Thompson , Greg Kroah-Hartman , Jiri Slaby , kgdb-bugreport@lists.sourceforge.net, linux-serial@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Fri, Sep 23, 2022 at 5:05 PM John Ogness wrote: > > 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(); Seems right to me, thanks! Reviewed-by: Douglas Anderson