In the Linux kernel, the following vulnerability has been resolved:
spi: spi-fsl-lpspi: fix teardown order issue (UAF)
There is a teardown order issue in the driver. The SPI controller is
registered using devm_spi_register_controller(), which delays
unregistration of the SPI controller until after the fsl_lpspi_remove()
function returns.
As the fsl_lpspi_remove() function synchronously tears down the DMA
channels, a running SPI transfer triggers the following NULL pointer
dereference due to use after free:
| fsl_lpspi 42550000.spi: I/O Error in DMA RX
| Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
[...]
| Call trace:
| fsl_lpspi_dma_transfer+0x260/0x340 [spi_fsl_lpspi]
| fsl_lpspi_transfer_one+0x198/0x448 [spi_fsl_lpspi]
| spi_transfer_one_message+0x49c/0x7c8
| __spi_pump_transfer_message+0x120/0x420
| __spi_sync+0x2c4/0x520
| spi_sync+0x34/0x60
| spidev_message+0x20c/0x378 [spidev]
| spidev_ioctl+0x398/0x750 [spidev]
[...]
Switch from devm_spi_register_controller() to spi_register_controller() in
fsl_lpspi_probe() and add the corresponding spi_unregister_controller() in
fsl_lpspi_remove().
CVE-2026-31485 is a use-after-free (UAF) vulnerability in the Linux kernel's FSL LPSPI SPI controller driver caused by incorrect teardown ordering. When the SPI controller is unregistered, DMA channels are torn down while SPI transfers may still be in progress, leading to NULL pointer dereference and kernel crashes. This affects systems using Freescale/NXP LPSPI controllers, particularly in embedded and IoT deployments common in Saudi industrial and energy sectors.
IMMEDIATE ACTIONS:
1. Identify systems running Linux kernel versions 4.10 through 7.0-rc2 with FSL LPSPI driver enabled
2. Check kernel configuration: grep CONFIG_SPI_FSL_LPSPI /boot/config-$(uname -r)
3. Monitor system logs for 'fsl_lpspi' errors and NULL pointer dereferences
PATCHING GUIDANCE:
1. Apply kernel patch that switches from devm_spi_register_controller() to spi_register_controller() with explicit spi_unregister_controller() in driver removal
2. Update to patched kernel version (7.0-rc3 or later, or stable backport)
3. Test SPI transfers after patching to verify DMA operations complete without crashes
COMPENSATING CONTROLS (if immediate patching unavailable):
1. Disable FSL LPSPI driver if not essential: echo 'blacklist spi_fsl_lpspi' >> /etc/modprobe.d/blacklist.conf
2. Implement watchdog monitoring for SPI-related kernel panics
3. Configure automatic system restart on kernel panic: echo 'kernel.panic=10' >> /etc/sysctl.conf
4. Restrict SPI device access to trusted applications only
DETECTION RULES:
1. Monitor kernel logs: grep -i 'fsl_lpspi.*NULL\|fsl_lpspi.*dereference' /var/log/kern.log
2. Alert on kernel panic messages containing 'fsl_lpspi_dma_transfer'
3. Track system reboots correlated with SPI activity
4. Monitor dmesg for 'I/O Error in DMA RX' messages
الإجراءات الفورية:
1. تحديد الأنظمة التي تقوم بتشغيل إصدارات نواة Linux من 4.10 إلى 7.0-rc2 مع تفعيل برنامج تشغيل FSL LPSPI
2. التحقق من تكوين النواة: grep CONFIG_SPI_FSL_LPSPI /boot/config-$(uname -r)
3. مراقبة سجلات النظام للأخطاء المتعلقة بـ 'fsl_lpspi' وإلغاء مؤشرات NULL
إرشادات التصحيح:
1. تطبيق رقعة النواة التي تتحول من devm_spi_register_controller() إلى spi_register_controller() مع spi_unregister_controller() الصريح في إزالة برنامج التشغيل
2. التحديث إلى إصدار نواة مصحح (7.0-rc3 أو أحدث، أو backport مستقر)
3. اختبار عمليات نقل SPI بعد التصحيح للتحقق من اكتمال عمليات DMA بدون أعطال
الضوابط البديلة (إذا لم يكن التصحيح الفوري متاحاً):
1. تعطيل برنامج تشغيل FSL LPSPI إذا لم يكن ضروريًا: echo 'blacklist spi_fsl_lpspi' >> /etc/modprobe.d/blacklist.conf
2. تنفيذ مراقبة watchdog لأعطال النواة المتعلقة بـ SPI
3. تكوين إعادة تشغيل النظام التلقائية عند حدوث panic في النواة: echo 'kernel.panic=10' >> /etc/sysctl.conf
4. تقييد الوصول إلى جهاز SPI للتطبيقات الموثوقة فقط
قواعد الكشف:
1. مراقبة سجلات النواة: grep -i 'fsl_lpspi.*NULL\|fsl_lpspi.*dereference' /var/log/kern.log
2. التنبيه على رسائل panic في النواة التي تحتوي على 'fsl_lpspi_dma_transfer'
3. تتبع إعادة تشغيل النظام المرتبطة بنشاط SPI
4. مراقبة dmesg للرسائل 'I/O Error in DMA RX'