| From bippy-5f407fcff5a0 Mon Sep 17 00:00:00 2001 |
| From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
| To: <linux-cve-announce@vger.kernel.org> |
| Reply-to: <cve@kernel.org>, <linux-kernel@vger.kernel.org> |
| Subject: CVE-2021-47412: block: don't call rq_qos_ops->done_bio if the bio isn't tracked |
| |
| Description |
| =========== |
| |
| In the Linux kernel, the following vulnerability has been resolved: |
| |
| block: don't call rq_qos_ops->done_bio if the bio isn't tracked |
| |
| rq_qos framework is only applied on request based driver, so: |
| |
| 1) rq_qos_done_bio() needn't to be called for bio based driver |
| |
| 2) rq_qos_done_bio() needn't to be called for bio which isn't tracked, |
| such as bios ended from error handling code. |
| |
| Especially in bio_endio(): |
| |
| 1) request queue is referred via bio->bi_bdev->bd_disk->queue, which |
| may be gone since request queue refcount may not be held in above two |
| cases |
| |
| 2) q->rq_qos may be freed in blk_cleanup_queue() when calling into |
| __rq_qos_done_bio() |
| |
| Fix the potential kernel panic by not calling rq_qos_ops->done_bio if |
| the bio isn't tracked. This way is safe because both ioc_rqos_done_bio() |
| and blkcg_iolatency_done_bio() are nop if the bio isn't tracked. |
| |
| The Linux kernel CVE team has assigned CVE-2021-47412 to this issue. |
| |
| |
| Affected and fixed versions |
| =========================== |
| |
| Fixed in 5.14.11 with commit 004b8f8a691205a93d9e80d98b786b2b97424d6e |
| Fixed in 5.15 with commit a647a524a46736786c95cdb553a070322ca096e3 |
| |
| 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-47412 |
| 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: |
| block/bio.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/004b8f8a691205a93d9e80d98b786b2b97424d6e |
| https://git.kernel.org/stable/c/a647a524a46736786c95cdb553a070322ca096e3 |