tizen: Use unique directory prefix for baselibs packages
[platform/kernel/linux-rpi.git] / kernel / bpf / map_in_map.c
index cd5eafa..3248ff5 100644 (file)
@@ -127,12 +127,17 @@ void *bpf_map_fd_get_ptr(struct bpf_map *map,
        return inner_map;
 }
 
-void bpf_map_fd_put_ptr(void *ptr)
+void bpf_map_fd_put_ptr(struct bpf_map *map, void *ptr, bool need_defer)
 {
-       /* ptr->ops->map_free() has to go through one
-        * rcu grace period by itself.
+       struct bpf_map *inner_map = ptr;
+
+       /* The inner map may still be used by both non-sleepable and sleepable
+        * bpf program, so free it after one RCU grace period and one tasks
+        * trace RCU grace period.
         */
-       bpf_map_put(ptr);
+       if (need_defer)
+               WRITE_ONCE(inner_map->free_after_mult_rcu_gp, true);
+       bpf_map_put(inner_map);
 }
 
 u32 bpf_map_fd_sys_lookup_elem(void *ptr)