回复: drivers/cxl: suspected null pointer dereference in core/bus.c

From: YE Chengfeng
Date: Wed Oct 27 2021 - 22:20:58 EST


Got it.
Thanks for your reply.

Best regards,
Chengfeng

-----邮件原件-----
发件人: Ben Widawsky <ben.widawsky@xxxxxxxxx>
发送时间: 2021年10月27日 23:04
收件人: YE Chengfeng <cyeaa@xxxxxxxxxxxxxx>
抄送: alison.schofield@xxxxxxxxx; vishal.l.verma@xxxxxxxxx; ira.weiny@xxxxxxxxx; dan.j.williams@xxxxxxxxx; Jonathan.Cameron@xxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; linux-cxl@xxxxxxxxxxxxxxx
主题: Re: drivers/cxl: suspected null pointer dereference in core/bus.c

On 21-10-27 11:35:25, YE Chengfeng wrote:
> Hi,
>
> https://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgith
> ub.com%2Ftorvalds%2Flinux%2Fblob%2Fmaster%2Fdrivers%2Fcxl%2Fcore%2Fbus
> .c%23L98&amp;data=04%7C01%7Ccyeaa%40connect.ust.hk%7C778468ba05844313f
> f7108d9995b19ad%7C6c1d415239d044ca88d9b8d6ddca0708%7C1%7C0%7C637709438
> 820451633%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIi
> LCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=Tz4HyXAH6ov5wZ7ijhLBva
> IyEC9JojDZMWMSUY7pHLg%3D&amp;reserved=0
>
> We notice that in multiple call sites, the return pointer of to_cxl_decoder is not null-checked, could it be a potential null-pointer-dereference problem?
>
> This is detected by our experimental static analysis tool, it could be false positive, we manually check and report those we think may be true issues. Would you like to have a look at them?
>
> Thanks so much,
> Chengfeng

add linux-cxl...

If NULL is returned, it's a driver bug. The WARN_ON and subsequent NULL deref oops is desirable.