[Skiboot] [PATCH] flash: Handle nullptr dereference of system_flash

Aditya Gupta adityag at linux.ibm.com
Sun Mar 9 05:12:53 AEDT 2025


On 07/03/25 19:33, Mahesh J Salgaonkar wrote:
> On 2025-03-07 11:01:02 Fri, Aditya Gupta wrote:
>> <...snip...>
>>
>> --- a/core/flash.c
>> +++ b/core/flash.c
>> @@ -88,7 +88,16 @@ void flash_release(void)
>>   
>>   bool flash_unregister(void)
>>   {
>> -	struct blocklevel_device *bl = system_flash->bl;
>> +	struct blocklevel_device *bl;
>> +
>> +	if (!system_flash) {
>> +		prlog(PR_WARNING, "System Flash is not registered, ignoring"\
>> +				" unregister request\n");
>> +
>> +		return true;
>> +	}
>> +
>> +	bl = system_flash->bl;
>>   
>>   	if (bl->exit)
>>   		return bl->exit(bl);
>> -- 
> Looks good to me.
>
> Reviewed-by: Mahesh Salgaonkar <mahesh at linux.ibm.com>

Thanks for the review !

- Aditya G

> Thanks,
> -Mahesh.


More information about the Skiboot mailing list