lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87r0z332r6.fsf@jogness.linutronix.de>
Date:   Wed, 19 Oct 2022 23:52:53 +0206
From:   John Ogness <john.ogness@...utronix.de>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     Petr Mladek <pmladek@...e.com>,
        Sergey Senozhatsky <senozhatsky@...omium.org>,
        Steven Rostedt <rostedt@...dmis.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH printk v2 02/38] printk: Convert console_drivers list to
 hlist

On 2022-10-19, Greg Kroah-Hartman <gregkh@...uxfoundation.org> 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.

> Other than that minor question, looks good to me!
>
> Reviewed-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>

Thanks!

John

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ