2021-10-27 21:24:35

by YE Chengfeng

[permalink] [raw]
Subject: drivers/cxl: suspected null pointer dereference in core/bus.c

Hi,

https://github.com/torvalds/linux/blob/master/drivers/cxl/core/bus.c#L98

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


2021-10-27 21:27:38

by Ben Widawsky

[permalink] [raw]
Subject: Re: drivers/cxl: suspected null pointer dereference in core/bus.c

On 21-10-27 11:35:25, YE Chengfeng wrote:
> Hi,
>
> https://github.com/torvalds/linux/blob/master/drivers/cxl/core/bus.c#L98
>
> 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.

2021-10-28 02:23:26

by YE Chengfeng

[permalink] [raw]
Subject: 回复: drivers/cxl: suspected null pointer der eference in core/bus.c

Got it.
Thanks for your reply.

Best regards,
Chengfeng

-----?ʼ?ԭ??-----
??????: Ben Widawsky <[email protected]>
????ʱ??: 2021??10??27?? 23:04
?ռ???: YE Chengfeng <[email protected]>
????: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
????: 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.