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: <87h6ze7nyu.fsf@jogness.linutronix.de>
Date:   Fri, 04 Nov 2022 16:18:41 +0106
From:   John Ogness <john.ogness@...utronix.de>
To:     Petr Mladek <pmladek@...e.com>
Cc:     Sergey Senozhatsky <senozhatsky@...omium.org>,
        Steven Rostedt <rostedt@...dmis.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        linux-kernel@...r.kernel.org,
        "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>, netdev@...r.kernel.org
Subject: Re: [PATCH printk v2 09/38] netconsole: use console_is_enabled()

On 2022-10-21, Petr Mladek <pmladek@...e.com> wrote:
>> diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
>> index bdff9ac5056d..073e59a06f21 100644
>> --- a/drivers/net/netconsole.c
>> +++ b/drivers/net/netconsole.c
>> @@ -332,7 +332,7 @@ static ssize_t enabled_store(struct config_item *item,
>>  	}
>>  
>>  	if (enabled) {	/* true */
>> -		if (nt->extended && !(netconsole_ext.flags & CON_ENABLED)) {
>> +		if (nt->extended && !console_is_enabled(&netconsole_ext)) {
>>  			netconsole_ext.flags |= CON_ENABLED;
>>  			register_console(&netconsole_ext);
>>  		}
>> @@ -915,7 +915,7 @@ static int __init init_netconsole(void)
>>  	if (err)
>>  		goto undonotifier;
>>  
>> -	if (netconsole_ext.flags & CON_ENABLED)
>> +	if (console_is_enabled(&netconsole_ext))
>>  		register_console(&netconsole_ext);
>>  	register_console(&netconsole);
>>  	pr_info("network logging started\n");
>
> This looks like a (mis)use of CON_ENABLED flag.

Yes. When @netconsole_ext is registered, CON_ENABLED is always set. So
it should be set in the static initialization. The first hunk should be
using the new console_is_registered(). The second hunk should be using a
local @extended bool variable. Also, in cleanup_netconsole() it should
check if the console is registered:

if (console_is_registered(&netconsole_ext))
        unregister_console(&netconsole_ext);

I will make all of these changes for v3. Then there will be no
checking/setting of CON_ENABLED in the driver.

John Ogness

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ