iio: accel: bmc150: clamp the device-reported FIFO frame count
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 3bbec9773389112330954a6a64422eaa78d546c1 · < 3e766526827acd542bcd36c20c4d5f397e0f6521| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
iio: accel: bmc150: clamp the device-reported FIFO frame count
__bmc150_accel_fifo_flush() copies the number of samples the device reports in its hardware FIFO into an on-stack buffer
u16 buffer[BMC150_ACCEL_FIFO_LENGTH * 3];
which is sized for at most BMC150_ACCEL_FIFO_LENGTH (32) samples. The frame count is read from the FIFO_STATUS register and only masked to its 7 valid bits:
count = val & 0x7F;
so it can be 0..127. The only other limit applied to it is the optional caller-supplied sample budget:
if (samples && count > samples) count = samples;
From the CVE record · Linux
The Linux kernel’s bmc150 accelerometer driver can copy more FIFO samples into a stack buffer than it can hold. A malfunctioning, malicious, or counterfeit accelerometer, or an attacker tampering with its I2C/SPI bus, can trigger a stack out-of-bounds write by reporting too many frames.
Engineers running Linux kernels with the bmc150 accelerometer driver should check their kernel; affected versions are not specified.