Ad

CVE-2026-90125

NONE EPSS 0.21%
Обновлено 30 октября 2026
Linux
Параметр Значение
Поставщик Linux
Публичный эксплойт Нет

В ядре Linux была устранена следующая уязвимость: smb: client: fix request buffer leak in smb2_new_read_req() smb2_new_read_req() выделяет буфер запроса с smb2_plain_req_init(), но публикует его только вызывающему абоненту с *buf req в самом конце функции. Две ошибки возврата сидят между: rc smb2_plain_req_init(SMB2_READ, io_parms->tcon, сервер, (void **) &req, total_len; если (rc) возврат rc; если (сервер NULL) возврат -ECONNABORTED; [...] rdata->mr smbd_register_mr(server->smbd_conn, &rdata->subreq.io_iter, true, need_invalidate); если (!rdata->mr) возврат -EAGAIN; На любом из них буфер не выпущен и не возвращен, так. Звонящий не может очиститься после него: smb2_async_readv () делает «goto out» при ненулевом возврате, который пропускает cifs_small_buf_release(buf) в async_readv_out, и buf не был назначен в этот момент в любом случае.

Путь записи никогда не имел этой проблемы. smb2_async_writev() регистрирует область памяти и переходит к ее метке выпуска вместо того, чтобы возвращаться: wdata->mr smbd_register_mr(...); if (!wdata->mr) rc -EAGAIN; goto async_writev_out; Commit b7972092199f ("cifs: smbd: Retry on memory regressing failure") в каждой из двух сторон. Только возврат -EAGAIN доступен на практике, потому что smb2_plain_req_init() сначала вызывает smb2_reconnect(), и это уже не работает с -EIO, когда сервер NULL, прежде чем что-либо будет выделено. Оба возврата получают здесь одинаковое лечение, а не оставляют одно из них правильным только случайно.

Поскольку -EAGAIN является воспроизводимой ошибкой, сбой также достигает блока повторных попыток в конце smb2_async_readv(), который отмечает подзапрос NETFS_SREQ_NEED_RETRY, поэтому неудачная регистрация может быть повторена, а не окончание ввода-вывода, и каждая попытка, которая достигает ее, теряет другой буфер. smb2_should_replay() короткое замыкание на tcon->retry, поэтому на жестком креплении количество попыток не ограничено. Затрагивается только асинхронный путь чтения. Синхронный абонент SMB2_read() передает rdata NULL и блок регистрации памяти охраняется на rdata.

Путь отказа регистрации памяти был указан рецензентом Sashiko AI, когда он просматривал не связанный патч к smb2_async_readv().

Показать оригинальное описание (EN)

In the Linux kernel, the following vulnerability has been resolved: smb: client: fix request buffer leak in smb2_new_read_req() smb2_new_read_req() allocates the request buffer with smb2_plain_req_init() but only publishes it to the caller with *buf = req at the very end of the function. Two error returns sit in between: rc = smb2_plain_req_init(SMB2_READ, io_parms->tcon, server, (void **) &req, total_len); if (rc) return rc; if (server == NULL) return -ECONNABORTED; [...] rdata->mr = smbd_register_mr(server->smbd_conn, &rdata->subreq.io_iter, true, need_invalidate); if (!rdata->mr) return -EAGAIN; On either of them the buffer is neither released nor handed back, so it is leaked. The caller cannot clean up after it: smb2_async_readv() does 'goto out' on a non-zero return, which skips the cifs_small_buf_release(buf) at async_readv_out, and buf has not been assigned at that point in any case. The write path has never had this problem. smb2_async_writev() registers the memory region inline and jumps to its release label instead of returning: wdata->mr = smbd_register_mr(...); if (!wdata->mr) { rc = -EAGAIN; goto async_writev_out; } Commit b7972092199f ("cifs: smbd: Retry on memory registration failure") changed both sides from -ENOBUFS to -EAGAIN in a single patch, which puts the two shapes next to each other. Only the -EAGAIN return is reachable in practice, because smb2_plain_req_init() calls smb2_reconnect() first and that already fails with -EIO when server is NULL, before anything is allocated. Both returns are given the same treatment here rather than leaving one of them correct only by accident. Because -EAGAIN is a replayable error, the failure also reaches the retry block at the end of smb2_async_readv(), which marks the subrequest NETFS_SREQ_NEED_RETRY, so a failing registration can be retried rather than ending the I/O, and every attempt that reaches it leaks another buffer. smb2_should_replay() short-circuits on tcon->retry, so on a hard mount the attempt count is not bounded by the retrans setting. Only the asynchronous read path is affected. The synchronous SMB2_read() caller passes rdata == NULL and the memory registration block is guarded on rdata. The memory registration failure path was pointed out by the Sashiko AI reviewer while it was reviewing an unrelated patch to smb2_async_readv().