2021-10-27 21:26:09

by YE Chengfeng

[permalink] [raw]
Subject: drivers/crypto: suspected missing null check in hisi_qm_pre_init

Hi,

https://github.com/torvalds/linux/blob/master/drivers/crypto/hisilicon/qm.c#L3286

We notice that at #line 3286, the return pointer of ACPI_COMPANION is not null-checked, and then it's dereferenced in acpi_device_power_manageable. Seems that it could be a potential null-pointer-dereference issue.

This is detected by our experimental static analysis tool, it could be false positive, so we manually check and report those we think may be true bugs. Would you like to have a look at them? If it's real bug, we could like to provide patch to ease your workflow.

Thanks so much,
Chengfeng


2021-10-28 01:26:24

by Zhou Wang

[permalink] [raw]
Subject: Re: drivers/crypto: suspected missing null check in hisi_qm_pre_init

> Hi,
>
> https://github.com/torvalds/linux/blob/master/drivers/crypto/hisilicon/qm.c#L3286
>
> We notice that at #line 3286, the return pointer of ACPI_COMPANION is not null-checked, and then it's dereferenced in acpi_device_power_manageable. Seems that it could be a potential null-pointer-dereference issue.
>
> This is detected by our experimental static analysis tool, it could be false positive, so we manually check and report those we think may be true bugs. Would you like to have a look at them? If it's real bug, we could like to provide patch to ease your workflow.

Hi Chengfeng,

It will reture NULL when ACPI is disabled, however this driver deponds on
ACPI, which is already set in Kconfig. So no need do null-checked here.

Thanks,
Zhou

>
> Thanks so much,
> Chengfeng
> .
>

2021-10-28 02:22:07

by YE Chengfeng

[permalink] [raw]
Subject: 回复: drivers/crypto: suspected missing null check in hisi_qm_pre_init

Got it.
Thanks for your reply.

Best regards,
Chengfeng

-----?ʼ?ԭ??-----
??????: Zhou Wang <[email protected]>
????ʱ??: 2021??10??28?? 9:24
?ռ???: YE Chengfeng <[email protected]>; [email protected]; [email protected]
????: [email protected]
????: Re: drivers/crypto: suspected missing null check in hisi_qm_pre_init

> Hi,
>
> https://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgith
> ub.com%2Ftorvalds%2Flinux%2Fblob%2Fmaster%2Fdrivers%2Fcrypto%2Fhisilic
> on%2Fqm.c%23L3286&amp;data=04%7C01%7Ccyeaa%40connect.ust.hk%7C98c99b9b
> 25084a3fac8d08d999b1a9cb%7C6c1d415239d044ca88d9b8d6ddca0708%7C1%7C0%7C
> 637709810602673947%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjo
> iV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=e3p0PP1tp%2BA
> %2BrUALUgrowuYEZT3L21WoQBqfAn5iKac%3D&amp;reserved=0
>
> We notice that at #line 3286, the return pointer of ACPI_COMPANION is not null-checked, and then it's dereferenced in acpi_device_power_manageable. Seems that it could be a potential null-pointer-dereference issue.
>
> This is detected by our experimental static analysis tool, it could be false positive, so we manually check and report those we think may be true bugs. Would you like to have a look at them? If it's real bug, we could like to provide patch to ease your workflow.

Hi Chengfeng,

It will reture NULL when ACPI is disabled, however this driver deponds on ACPI, which is already set in Kconfig. So no need do null-checked here.

Thanks,
Zhou

>
> Thanks so much,
> Chengfeng
> .
>