CVE-2024-35825: usb: gadget: ncm: Fix handling of zero block length packets
In the Linux kernel, the following vulnerability has been resolved:
usb: gadget: ncm: Fix handling of zero block length packets
While connecting to a Linux host with CDCNCMNTBDEFSIZETX set to 65536, it has been observed that we receive short packets, which come at interval of 5-10 seconds sometimes and have block length zero but still contain 1-2 valid datagrams present.
According to the NCM spec:
"If wBlockLength = 0x0000, the block is terminated by a short packet. In this case, the USB transfer must still be shorter than dwNtbInMaxSize or dwNtbOutMaxSize. If exactly dwNtbInMaxSize or dwNtbOutMaxSize bytes are sent, and the size is a multiple of wMaxPacketSize for the given pipe, then no ZLP shall be sent.
wBlockLength= 0x0000 must be used with extreme care, because of the possibility that the host and device may get out of sync, and because of test issues.
wBlockLength = 0x0000 allows the sender to reduce latency by starting to send a very large NTB, and then shortening it when the sender discovers that there’s not sufficient data to justify sending a large NTB"
However, there is a potential issue with the current implementation, as it checks for the occurrence of multiple NTBs in a single giveback by verifying if the leftover bytes to be processed is zero or not. If the block length reads zero, we would process the same NTB infintely because the leftover bytes is never zero and it leads to a crash. Fix this by bailing out if block length reads zero.
Affected Software
Remediation
Event History
Frequently Asked Questions
What is the severity of CVE-2024-35825?
CVE-2024-35825 is considered to have a moderate severity due to its potential impact on data integrity during USB communication.
How do I fix CVE-2024-35825?
To fix CVE-2024-35825, upgrade your Linux kernel to either version 5.10.223-1, 5.10.226-1, 6.1.123-1, 6.1.119-1, 6.12.10-1, or 6.12.11-1 as applicable.
What systems are affected by CVE-2024-35825?
CVE-2024-35825 affects specific versions of the Linux kernel used in various distributions such as Debian.
What does CVE-2024-35825 involve?
CVE-2024-35825 involves a vulnerability related to improper handling of zero block length packets in the USB gadget subsystem of the Linux kernel.
Are there any workarounds for CVE-2024-35825?
There are currently no recommended workarounds for CVE-2024-35825; the best approach is to apply the necessary kernel updates.