In the Linux kernel, the following vulnerability has been resolved:
iio: health: afe4404: Fix oob read in afe4404[read|write]raw
KASAN report out-of-bounds read as follows:
BUG: KASAN: global-out-of-bounds in afe4404readraw+0x2ce/0x380 Read of size 4 at addr ffffffffc00e4658 by task cat/278
Call Trace: afe4404readraw iioreadchannelinfo devattr_show
The buggy address belongs to the variable: afe4404channelleds+0x18/0xffffffffffffe9c0
This issue can be reproduce by singe command:
$ cat /sys/bus/i2c/devices/0-0058/iio\:device0/inintensity6raw
The array size of afe4404channelleds and afe4404channeloffdacs are less than channels, so access with chan->address cause OOB read in afe4404[read|write]raw. Fix it by moving access before use them.