Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp471722rwi; Thu, 20 Oct 2022 00:48:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7T3rQ4cP4IZt85XQ0dkIndWALCZY3ukBqX2KjPQSiMVRYGRn05SYG3kc61hW7BRWRR0mWG X-Received: by 2002:a17:903:2346:b0:183:3e95:6f5d with SMTP id c6-20020a170903234600b001833e956f5dmr12851193plh.165.1666252084351; Thu, 20 Oct 2022 00:48:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666252084; cv=none; d=google.com; s=arc-20160816; b=PoDZs4IDtkfLx0sXlNKXR/jd64NPeJpnKNlrMXxKtZUqnSFLt04n7GrqPdiQExZEjF TqcI6vSEENhEWyoAbqi5wH2lQT4u5o7GzsReqDkCQgzLlKeTuK1CrVTTIzL6OXKMKj9M pAlrRXrwSlReJXnARQS1EmdiN124uzk8RHM8hQHi9QS58Lmda1bq2Bh10VLzvfGjOkNm IainfKY5bakGHN4d1LlurobLKgLiROdBvZCyG5Zv3Kcq22+pUG1MvDpRhbl/2xZE3Avi hEbwKa1PZQ/UePQV5uBWIruxGnbUtGC5sEXOq4Kif3Po4Kw96iSbR2LY6yEHPELom+zw FScg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=NOCuL9RPwQHym7TI+cuEnUKCTdynbjXRn5EdMGpZhtk=; b=XXCCkULGzR5+Xorl4P3EOZNcaddnEnyhejtgQFbC1MIHU7vctAXUR22wfv0NP0ZQhR fqkMU0j9yftfpuBbzQd12JDaZzvQ0fibMnkanqiPcgXSNfKO6urc/1JRzJAVCqsL2jwN 9vtBtFF2HTWvAn7+2cc7a6i5H41wpPCuzlbIiwgYp4tBAWwM9PJkmE/ikIJyNpTkZB02 fjE6uBKdznp/jddyiqJ77CBUu8BzTpOL4AuwXkuw+61BtqtupU0YYOkxEqQJCzNwyrd3 sDC6NgYG94ljNSQ8mVf5G+r5GEmxITpFsJR3eKQ8rVDasJ9qAqFwn3A6aAv2hYxKUSQk 4xXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=s094BYtw; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p2-20020a170902e74200b00174665bbc29si24591749plf.161.2022.10.20.00.47.51; Thu, 20 Oct 2022 00:48:04 -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=@linuxfoundation.org header.s=korg header.b=s094BYtw; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230496AbiJTHnt (ORCPT + 99 others); Thu, 20 Oct 2022 03:43:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230407AbiJTHnU (ORCPT ); Thu, 20 Oct 2022 03:43:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39C5F16D55C; Thu, 20 Oct 2022 00:43:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 150F261A2A; Thu, 20 Oct 2022 07:43:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A68FC433D6; Thu, 20 Oct 2022 07:43:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666251786; bh=pWk3r8z6RKGfrsVoShtieMSY97GKros1KMV1t/HlkQE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=s094BYtwA8PaTjvwYY/XjaG1+vTXVGrLj42am8Y+Y0pW3fJWEf16ZpP9wYUghuNcf W+C26CALL10oLni4dybRNIOtTU8nNsyPE6MTd5DYAkUJAJFIVA6nPnY9DA9Kzw8Hes Uf1AopPu1EUeEv4J3Jq/wx1Rhf4YNGbmbQhvrvUk= Date: Thu, 20 Oct 2022 09:43:04 +0200 From: Greg Kroah-Hartman To: John Ogness Cc: Petr Mladek , Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH printk v2 02/38] printk: Convert console_drivers list to hlist Message-ID: References: <20221019145600.1282823-1-john.ogness@linutronix.de> <20221019145600.1282823-3-john.ogness@linutronix.de> <87r0z332r6.fsf@jogness.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87r0z332r6.fsf@jogness.linutronix.de> X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 On Wed, Oct 19, 2022 at 11:52:53PM +0206, John Ogness wrote: > On 2022-10-19, Greg Kroah-Hartman wrote: > >> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c > >> index e4f1e7478b52..867becc40021 100644 > >> --- a/kernel/printk/printk.c > >> +++ b/kernel/printk/printk.c > >> @@ -3229,32 +3244,30 @@ int unregister_console(struct console *console) > >> if (res > 0) > >> return 0; > >> > >> - res = -ENODEV; > >> console_lock(); > >> - if (console_drivers == console) { > >> - console_drivers=console->next; > >> - res = 0; > >> - } else { > >> - for_each_console(con) { > >> - if (con->next == console) { > >> - con->next = console->next; > >> - res = 0; > >> - break; > >> - } > >> - } > >> + > >> + /* Disable it unconditionally */ > >> + console->flags &= ~CON_ENABLED; > >> + > >> + if (hlist_unhashed(&console->node)) { > > > > How can this ever be hit? The console lock is held, so it shouldn't > > have gone away already. Or am I missing something else here? > > Mainline also has this check. I expect it is for the case that some code > tries to call unregister_console() for a console that is not > registered. > > Since register_console() does not return if it succeeded, I suppose some > code somewhere my try to unregister without knowing that it never > registered in the first place. Ick, ok, that's fine for now. What a mess, thanks for working to unwind it! greg k-h