File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -694,6 +694,7 @@ static void bpf_map_free_deferred(struct work_struct *work)
694
694
{
695
695
struct bpf_map * map = container_of (work , struct bpf_map , work );
696
696
struct btf_record * rec = map -> record ;
697
+ struct btf * btf = map -> btf ;
697
698
698
699
security_bpf_map_free (map );
699
700
bpf_map_release_memcg (map );
@@ -709,6 +710,10 @@ static void bpf_map_free_deferred(struct work_struct *work)
709
710
* template bpf_map struct used during verification.
710
711
*/
711
712
btf_record_free (rec );
713
+ /* Delay freeing of btf for maps, as map_free callback may need
714
+ * struct_meta info which will be freed with btf_put().
715
+ */
716
+ btf_put (btf );
712
717
}
713
718
714
719
static void bpf_map_put_uref (struct bpf_map * map )
@@ -749,7 +754,6 @@ void bpf_map_put(struct bpf_map *map)
749
754
if (atomic64_dec_and_test (& map -> refcnt )) {
750
755
/* bpf_map_free_id() must be called first */
751
756
bpf_map_free_id (map );
752
- btf_put (map -> btf );
753
757
754
758
WARN_ON_ONCE (atomic64_read (& map -> sleepable_refcnt ));
755
759
if (READ_ONCE (map -> free_after_mult_rcu_gp ))
You can’t perform that action at this time.
0 commit comments