]> git.baikalelectronics.ru Git - kernel.git/commit
net: sock_diag: Fix spectre v1 gadget in __sock_diag_cmd()
authorJeremy Cline <jcline@redhat.com>
Mon, 13 Aug 2018 22:23:13 +0000 (22:23 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 14 Aug 2018 17:01:24 +0000 (10:01 -0700)
commit20b34c14fbcd529c75e6860682ff724626157713
treefd78fd9cb07be5628896380c282ab7d0e841d7d8
parentfe3e278e718417fb8d74f49818387a065fd05829
net: sock_diag: Fix spectre v1 gadget in __sock_diag_cmd()

req->sdiag_family is a user-controlled value that's used as an array
index. Sanitize it after the bounds check to avoid speculative
out-of-bounds array access.

This also protects the sock_is_registered() call, so this removes the
sanitize call there.

Fixes: dc22e76df91c ("net: socket: Fix potential spectre v1 gadget in sock_is_registered")
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: konrad.wilk@oracle.com
Cc: jamie.iles@oracle.com
Cc: liran.alon@oracle.com
Cc: stable@vger.kernel.org
Signed-off-by: Jeremy Cline <jcline@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/sock_diag.c
net/socket.c