В ядре Linux устранена следующая уязвимость:
xen/gntdev: исправлена обработка ошибок в ioctl
Когда gntdev_ioctl_map_grant_ref() не может скопировать результат операции
вернуться в пространство пользователя после успешного добавления сопоставления в список,
путь ошибки возвращает -EFAULT без освобождения ссылки
получено gntdev_alloc_map(). Сопоставление остается в priv->maps.
с счетчиком ссылок 1, вызывающим утечку памяти и висячий список
вход. Кроме того, gntdev_add_map() может изменить карту->index, чтобы избежать перекрытия.
с существующими отображениями.
Поэтому индекс вернулся в пользовательское пространство
должно быть получено после завершения gntdev_add_map(). Исправьте это, удерживая мьютекс в gntdev_add_map() и получая
правильный индекс и copy_to_user(). Если copy_to_user() завершается неудачно,
удалите сопоставление из списка и освободите ссылку, пока
все еще держит замок.
Устраните эти проблемы, правильно обрабатывая все случаи ошибок.
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: xen/gntdev: fix error handling in ioctl When gntdev_ioctl_map_grant_ref() fails to copy the operation result back to userspace after successfully adding the mapping to the list, the error path returns -EFAULT without releasing the reference acquired by gntdev_alloc_map(). The mapping remains in priv->maps with a refcount of 1, causing a memory leak and a dangling list entry. Additionally, gntdev_add_map() may modify map->index to avoid overlap with existing mappings. Therefore, the index returned to userspace must be obtained after gntdev_add_map() completes. Fix this by holding the mutex across gntdev_add_map(), retrieving the correct index, and copy_to_user(). If copy_to_user() fails, remove the mapping from the list and release the reference while still holding the lock. Fix these issues by properly handling all error cases.