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  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Sat, 18 May 2019 15:40:31 +0800
From:   Kefeng Wang <wangkefeng.wang@...wei.com>
To:     <minyard@....org>
CC:     Arnd Bergmann <arnd@...db.de>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        <openipmi-developer@...ts.sourceforge.net>,
        <linux-kernel@...r.kernel.org>, Hulk Robot <hulkci@...wei.com>
Subject: Re: [PATCH] ipmi_si: fix unexpected driver unregister warning


On 2019/5/18 0:18, Corey Minyard wrote:
> On Fri, May 17, 2019 at 06:12:44PM +0800, Kefeng Wang wrote:
>> If ipmi_si_platform_init()->platform_driver_register() fails,
>> platform_driver_unregister() called unconditionally will trigger
>> following warning,
>>
>> ipmi_platform: Unable to register driver: -12
>> ------------[ cut here ]------------
>> Unexpected driver unregister!
>> WARNING: CPU: 1 PID: 7210 at drivers/base/driver.c:193 driver_unregister+0x60/0x70 drivers/base/driver.c:193
>>
>> Fix it by adding platform_registered variable, only unregister platform
>> driver when it is already successfully registered.
> This is good, but have you found out why the driver was unable to
> register in the first place?  That really shouldn't happen.

Yes, it is hard to happen inĀ  real scene, the test robot found this issue

when FAULT_INJECTION enabled.

>
> This patch is queued for 5.3.
>
> -corey
>
>> Reported-by: Hulk Robot <hulkci@...wei.com>
>> Signed-off-by: Kefeng Wang <wangkefeng.wang@...wei.com>
>> ---
>>  drivers/char/ipmi/ipmi_si_platform.c | 6 +++++-
>>  1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/char/ipmi/ipmi_si_platform.c b/drivers/char/ipmi/ipmi_si_platform.c
>> index f2a91c4d8cab..0cd849675d99 100644
>> --- a/drivers/char/ipmi/ipmi_si_platform.c
>> +++ b/drivers/char/ipmi/ipmi_si_platform.c
>> @@ -19,6 +19,7 @@
>>  #include "ipmi_si.h"
>>  #include "ipmi_dmi.h"
>>  
>> +static bool platform_registered;
>>  static bool si_tryplatform = true;
>>  #ifdef CONFIG_ACPI
>>  static bool          si_tryacpi = true;
>> @@ -469,9 +470,12 @@ void ipmi_si_platform_init(void)
>>  	int rv = platform_driver_register(&ipmi_platform_driver);
>>  	if (rv)
>>  		pr_err("Unable to register driver: %d\n", rv);
>> +	else
>> +		platform_registered = true;
>>  }
>>  
>>  void ipmi_si_platform_shutdown(void)
>>  {
>> -	platform_driver_unregister(&ipmi_platform_driver);
>> +	if (platform_registered)
>> +		platform_driver_unregister(&ipmi_platform_driver);
>>  }
>> -- 
>> 2.20.1
>>
> .
>

Powered by blists - more mailing lists