X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=kernel%2Fbpf%2Fmap_in_map.c;h=3248ff5d816172b945918ef03279c83f87dc709a;hb=refs%2Fheads%2Faccepted%2Ftizen_unified_x;hp=cd5eafaba97e224a63dbd2a69fb0012a4b7c68d5;hpb=d81c203e61780f3635e5eddd03f00d8bdcd7c3df;p=platform%2Fkernel%2Flinux-rpi.git diff --git a/kernel/bpf/map_in_map.c b/kernel/bpf/map_in_map.c index cd5eafa..3248ff5 100644 --- a/kernel/bpf/map_in_map.c +++ b/kernel/bpf/map_in_map.c @@ -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)