Commit 798c6525 authored by Elena Reshetova's avatar Elena Reshetova Committed by Kleber Sacilotto de Souza

net: mpls: prevent speculative execution

CVE-2017-5753 (Spectre v1 Intel)

Since the index value in function mpls_route_input_rcu()
seems to be controllable by userspace and later on
conditionally (upon bound check) used to resolve
platform_label, insert an observable speculation
barrier before its usage. This should prevent
observable speculation on that branch and avoid
kernel memory leak.
Signed-off-by: default avatarElena Reshetova <elena.reshetova@intel.com>
Signed-off-by: default avatarAndy Whitcroft <apw@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 8661e7a7
...@@ -43,6 +43,8 @@ static struct mpls_route *mpls_route_input_rcu(struct net *net, unsigned index) ...@@ -43,6 +43,8 @@ static struct mpls_route *mpls_route_input_rcu(struct net *net, unsigned index)
if (index < net->mpls.platform_labels) { if (index < net->mpls.platform_labels) {
struct mpls_route __rcu **platform_label = struct mpls_route __rcu **platform_label =
rcu_dereference(net->mpls.platform_label); rcu_dereference(net->mpls.platform_label);
osb();
rt = rcu_dereference(platform_label[index]); rt = rcu_dereference(platform_label[index]);
} }
return rt; return rt;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment