В ядре Linux была устранена следующая уязвимость: usb: gadget: f_mass_storage: fix null pointer dereference В fsg_common_set_num_buffers() Previously fsg_num_buffers_validate() была удалена уязвимость, так как в ней не было необходимости из-за установки Kconfig пределов для n от 2 до 256 с по умолчанию как 2. Однако, установка содержимого страницы таким образом, что kstrtou8() отражает n значение как 0 или 1, обходит эти ограничения, что приводит к нулевому удалению указателя, если n равно 0. Исправьте это, добавив проверку для n < 2 и возвращая -EINVAL, если n либо 0, либо 1 соответствует логике Kconfig.
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: usb: gadget: f_mass_storage: fix null pointer dereference in fsg_common_set_num_buffers() Previously fsg_num_buffers_validate() was removed as it was not necessary due to Kconfig setting the limits for n from 2 to 256 with default as 2. However, setting the page content in such a way that kstrtou8() reflects n value as either 0 or 1 bypasses these restrictions leading to a null pointer dereference if n is 0. Fix this by adding a check for n < 2 and returning -EINVAL if n is either 0 or 1 consistent with Kconfig logic.