CVE-2021-47427: scsi: iscsi: Fix iscsi_task use after free
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
scsi: iscsi: Fix iscsi_task use after free
Commit d39df158518c ("scsi: iscsi: Have abort handler get ref to conn") added iscsi_get_conn()/iscsi_put_conn() calls during abort handling but then also changed the handling of the case where we detect an already completed task where we now end up doing a goto to the common put/cleanup code. This results in a iscsi_task use after free, because the common cleanup code will do a put on the iscsi_task.
This reverts the goto and moves the iscsi_get_conn() to after we've checked if the iscsi_task is valid.
The Linux kernel CVE team has assigned CVE-2021-47427 to this issue.
Affected and fixed versions
===========================
Issue introduced in 5.14 with commit d39df158518c and fixed in 5.14.12 with commit 1642f51ac0d4 Issue introduced in 5.14 with commit d39df158518c and fixed in 5.15 with commit 258aad75c621
Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.
Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at
https://cve.org/CVERecord/?id=CVE-2021-47427
will be updated if fixes are backported, please check that for the most up to date information about this issue.
Affected files
==============
The file(s) affected by this issue are:
drivers/scsi/libiscsi.c
Mitigation
==========
The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:
https://git.kernel.org/stable/c/1642f51ac0d4f2b55d5748094c49ff8f7191b93c https://git.kernel.org/stable/c/258aad75c62146453d03028a44f2f1590d58e1f6