В ядре Linux устранена следующая уязвимость: scsi: qla2xxx: Fix BSG job leak on validate flash image error path qla28xx_validate_flash_image() возвращает QLA_SUCCESS (0) безоговорочно, сообщая FC BSG transport (fc_bsg_host_dispatch()), что драйвер владеет и выполнит запрос. Но bsg_job_done() охраняется «if (!rval)», поэтому на пути ошибки (rval -EINVAL) ни водитель, ни транспорт не завершают работу. Запрос зависает до тех пор, пока не закончится, что приводит к утечке ресурсов блочного уровня.
Commit c2c68225b145 («scsi: qla2xxx: Fix bsg_done(), вызывающий двойное освобождение») добавил защиту «if (!rval)» в партию обработчиков BSG. Это верно для обработчиков, которые также возвращают код ошибки (транспорт затем завершает работу один раз через fail_host_msg), но эта функция возвращает QLA_SUCCESS безоговорочно, поэтому охранник превратил правильное одиночное завершение в утечку. Всегда вызывайте bsg_job_done(): bsg_reply->result - это DID_OK, и ошибка сообщается в vendor_rsp[0], и, поскольку функция возвращает 0, транспорт не завершит работу во второй раз.
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: scsi: qla2xxx: Fix BSG job leak on validate flash image error path qla28xx_validate_flash_image() returns QLA_SUCCESS (0) unconditionally, telling the FC BSG transport (fc_bsg_host_dispatch()) that the driver owns and will complete the request. But bsg_job_done() is guarded by "if (!rval)", so on the error path (rval == -EINVAL) neither the driver nor the transport completes the job. The request dangles until it times out, leaking block layer resources. Commit c2c68225b145 ("scsi: qla2xxx: Fix bsg_done() causing double free") added the "if (!rval)" guard to a batch of BSG handlers. That is correct for handlers that also return the error code (the transport then completes the job once via fail_host_msg), but this function returns QLA_SUCCESS unconditionally, so the guard turned a correct single completion into a leak. Always call bsg_job_done(): bsg_reply->result is DID_OK and the error is reported in vendor_rsp[0], and since the function returns 0 the transport will not complete the job a second time.