mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
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: e978de7a6d ("net: socket: Fix potential spectre v1 gadget in sock_is_registered")
Cc: Josh Poimboeuf <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Jeremy Cline <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
1c89a8e3d9
commit
66b51b0a03
2 changed files with 3 additions and 2 deletions
|
|
@ -2697,8 +2697,7 @@ EXPORT_SYMBOL(sock_unregister);
|
|||
|
||||
bool sock_is_registered(int family)
|
||||
{
|
||||
return family < NPROTO &&
|
||||
rcu_access_pointer(net_families[array_index_nospec(family, NPROTO)]);
|
||||
return family < NPROTO && rcu_access_pointer(net_families[family]);
|
||||
}
|
||||
|
||||
static int __init sock_init(void)
|
||||
|
|
|
|||
Loading…
Reference in a new issue