]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
misc: hmc6352: fix potential Spectre v1
authorGustavo A. R. Silva <gustavo@embeddedor.com>
Wed, 15 Aug 2018 15:50:41 +0000 (10:50 -0500)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 24 Apr 2019 08:09:08 +0000 (10:09 +0200)
commit94a746cdfbcb904a87ec060b58c708a681f6a709
tree320e6dd233da9dd1b42c57193929dd9a954eaca4
parentb8d9c3cae438623e38287d53d03debd9cdeb330e
misc: hmc6352: fix potential Spectre v1

val is indirectly controlled by user-space, hence leading to a
potential exploitation of the Spectre variant 1 vulnerability.

This issue was detected with the help of Smatch:

drivers/misc/hmc6352.c:54 compass_store() warn: potential spectre issue
'map' [r]

Fix this by sanitizing val before using it to index map

Notice that given that speculation windows are large, the policy is
to kill the speculation on the first load and not worry if it can be
completed with a dependent load/store [1].

[1] https://marc.info/?l=linux-kernel&m=152449131114778&w=2

Cc: stable@vger.kernel.org
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
CVE-2017-5753

(cherry picked from commit de916736aaaadddbd6061472969f667b14204aa9)
Signed-off-by: Juerg Haefliger <juergh@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/misc/hmc6352.c