回复: drivers/crypto: suspected null-pointer dereference at atmel_sha_init

From: YE Chengfeng
Date: Wed Oct 27 2021 - 07:11:48 EST


Thanks for your reply!

Do you need us help you to provide a patch to fix it?

Best regards,
Chengfeng

-----邮件原件-----
发件人: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
发送时间: 2021年10月27日 10:56
收件人: YE Chengfeng <cyeaa@xxxxxxxxxxxxxx>
抄送: davem@xxxxxxxxxxxxx; nicolas.ferre@xxxxxxxxxxxxx; alexandre.belloni@xxxxxxxxxxx; ludovic.desroches@xxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx
主题: Re: drivers/crypto: suspected null-pointer dereference at atmel_sha_init

On Tue, Oct 26, 2021 at 09:07:43AM +0000, YE Chengfeng wrote:
> Hi,
>
> https://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgith
> ub.com%2Ftorvalds%2Flinux%2Fblob%2Fmaster%2Fdrivers%2Fcrypto%2Fatmel-s
> ha.c%23L431&amp;data=04%7C01%7Ccyeaa%40connect.ust.hk%7C83edd64969f444
> 64edf608d998f54ac1%7C6c1d415239d044ca88d9b8d6ddca0708%7C1%7C0%7C637709
> 001562266287%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luM
> zIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=5HYshMZFegruxmG%2Bu
> nxw%2F2LF5lrTGFt%2FgTaKbNIKiv8%3D&amp;reserved=0
>
> We notice that the return pointer of atmel_sha_find_dev could be null, and it seems that null-check is missing at #line 431. If it returns null pointer, there will be a null pointer dereference problem at #line 437. We check that other call sites of this interface perform null-check, while this doesn't, so we suspect that this could be a problem.
>
> 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?

It could be a real issue when the device is hot unplugged.

Cheers,
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> Home Page: https://apc01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgondor.apana.org.au%2F~herbert%2F&amp;data=04%7C01%7Ccyeaa%40connect.ust.hk%7C83edd64969f44464edf608d998f54ac1%7C6c1d415239d044ca88d9b8d6ddca0708%7C1%7C0%7C637709001562266287%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=5h6aT%2FpRjy3GRzb%2FGbGTA3INxe8xsSEENTVa1Jl09Qg%3D&amp;reserved=0
PGP Key: https://apc01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgondor.apana.org.au%2F~herbert%2Fpubkey.txt&amp;data=04%7C01%7Ccyeaa%40connect.ust.hk%7C83edd64969f44464edf608d998f54ac1%7C6c1d415239d044ca88d9b8d6ddca0708%7C1%7C0%7C637709001562276244%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=PYlSTQdb0j9gdasnQ0YJq3ktqNlxalxyKetM%2BJCKiFc%3D&amp;reserved=0