]> git.baikalelectronics.ru Git - kernel.git/commit
dma-buf: heaps: Fix potential spectre v1 gadget
authorJordy Zomer <jordy@pwning.systems>
Sat, 29 Jan 2022 15:06:04 +0000 (16:06 +0100)
committerSumit Semwal <sumit.semwal@linaro.org>
Tue, 1 Feb 2022 07:48:09 +0000 (13:18 +0530)
commit92c4cfaee6872038563c5b6f2e8e613f9d84d47d
tree6ce6eacdcc10c27bf52fe84152d9f8712fded63a
parent1b777d4d9e383d2744fc9b3a09af6ec1893c8b1a
dma-buf: heaps: Fix potential spectre v1 gadget

It appears like nr could be a Spectre v1 gadget as it's supplied by a
user and used as an array index. Prevent the contents
of kernel memory from being leaked to userspace via speculative
execution by using array_index_nospec.

Signed-off-by: Jordy Zomer <jordy@pwning.systems>
Fixes: c02a81fba74f ("dma-buf: Add dma-buf heaps framework")
Cc: <stable@vger.kernel.org> # v5.6+
Acked-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
 [sumits: added fixes and cc: stable tags]
Link: https://patchwork.freedesktop.org/patch/msgid/20220129150604.3461652-1-jordy@pwning.systems
drivers/dma-buf/dma-heap.c