summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNikolay Aleksandrov <nikolay@cumulusnetworks.com>2020-05-26 21:56:15 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-06-03 09:21:37 +0300
commit88e81db5509b32a1fb3b1efc82757cd8990ea484 (patch)
tree4dd7d40bb44d37ec12bc9f6712da89e6fd19a297 /include
parent8398275f7aed243e287f6eaf0c829ade0f2803ba (diff)
downloadlinux-88e81db5509b32a1fb3b1efc82757cd8990ea484.tar.xz
nexthops: don't modify published nexthop groups
commit 90f33bffa382598a32cc82abfeb20adc92d041b6 upstream. We must avoid modifying published nexthop groups while they might be in use, otherwise we might see NULL ptr dereferences. In order to do that we allocate 2 nexthoup group structures upon nexthop creation and swap between them when we have to delete an entry. The reason is that we can't fail nexthop group removal, so we can't handle allocation failure thus we move the extra allocation on creation where we can safely fail and return ENOMEM. Fixes: 430a049190de ("nexthop: Add support for nexthop groups") Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com> Signed-off-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/net/nexthop.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/net/nexthop.h b/include/net/nexthop.h
index 331ebbc94fe7..2e334dfa99f7 100644
--- a/include/net/nexthop.h
+++ b/include/net/nexthop.h
@@ -70,6 +70,7 @@ struct nh_grp_entry {
};
struct nh_group {
+ struct nh_group *spare; /* spare group for removals */
u16 num_nh;
bool mpath;
bool has_v4;