aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/linux/cpu_rmap.h
diff options
context:
space:
mode:
authorEli Cohen <elic@nvidia.com>2023-02-14 09:29:46 +0200
committerSaeed Mahameed <saeedm@nvidia.com>2023-03-24 16:04:10 -0700
commit9821d8d4628e630ab56f47a8e6b878a2576e069b (patch)
tree06cbe34a046e0ec777302047d7b710b724f6f73e /include/linux/cpu_rmap.h
parentlib: cpu_rmap: Avoid use after free on rmap->obj array entries (diff)
downloadwireguard-linux-9821d8d4628e630ab56f47a8e6b878a2576e069b.tar.xz
wireguard-linux-9821d8d4628e630ab56f47a8e6b878a2576e069b.zip
lib: cpu_rmap: Use allocator for rmap entries
Use a proper allocator for rmap entries using a naive for loop. The allocator relies on whether an entry is NULL to be considered free. Remove the used field of rmap which is not needed. Also, avoid crashing the kernel if an entry is not available. Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Eli Cohen <elic@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Diffstat (limited to 'include/linux/cpu_rmap.h')
-rw-r--r--include/linux/cpu_rmap.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/include/linux/cpu_rmap.h b/include/linux/cpu_rmap.h
index be8aea04d023..0ec745e6cd36 100644
--- a/include/linux/cpu_rmap.h
+++ b/include/linux/cpu_rmap.h
@@ -16,14 +16,13 @@
* struct cpu_rmap - CPU affinity reverse-map
* @refcount: kref for object
* @size: Number of objects to be reverse-mapped
- * @used: Number of objects added
* @obj: Pointer to array of object pointers
* @near: For each CPU, the index and distance to the nearest object,
* based on affinity masks
*/
struct cpu_rmap {
struct kref refcount;
- u16 size, used;
+ u16 size;
void **obj;
struct {
u16 index;