diff options
author | Antoine Tenart <atenart@kernel.org> | 2021-03-18 21:37:44 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-03-19 00:56:22 +0300 |
commit | 5478fcd0f48322e04ae6c173ad3a1959e066dc83 (patch) | |
tree | 3228f7adfc6ee6a37638d546d563a628a3c7ec2f /include/linux/netdevice.h | |
parent | 255c04a87f4381849fce9ed81e5efabf78a71a30 (diff) | |
download | linux-5478fcd0f48322e04ae6c173ad3a1959e066dc83.tar.xz |
net: embed nr_ids in the xps maps
Embed nr_ids (the number of cpu for the xps cpus map, and the number of
rxqs for the xps cpus map) in dev_maps. That will help not accessing out
of bound memory if those values change after dev_maps was allocated.
Suggested-by: Alexander Duyck <alexander.duyck@gmail.com>
Signed-off-by: Antoine Tenart <atenart@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/netdevice.h')
-rw-r--r-- | include/linux/netdevice.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index c38534c55ea1..09e73f5a8c78 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -772,6 +772,9 @@ struct xps_map { /* * This structure holds all XPS maps for device. Maps are indexed by CPU. * + * We keep track of the number of cpus/rxqs used when the struct is allocated, + * in nr_ids. This will help not accessing out-of-bound memory. + * * We keep track of the number of traffic classes used when the struct is * allocated, in num_tc. This will be used to navigate the maps, to ensure we're * not crossing its upper bound, as the original dev->num_tc can be updated in @@ -779,6 +782,7 @@ struct xps_map { */ struct xps_dev_maps { struct rcu_head rcu; + unsigned int nr_ids; s16 num_tc; struct xps_map __rcu *attr_map[]; /* Either CPUs map or RXQs map */ }; |