mutex_lock(&bpf_event_mutex);
if (event->prog)
- goto out;
+ goto unlock;
- old_array = rcu_dereference_protected(event->tp_event->prog_array,
- lockdep_is_held(&bpf_event_mutex));
+ old_array = event->tp_event->prog_array;
ret = bpf_prog_array_copy(old_array, NULL, prog, &new_array);
if (ret < 0)
- goto out;
+ goto unlock;
/* set the new array to event->tp_event and set event->prog */
event->prog = prog;
rcu_assign_pointer(event->tp_event->prog_array, new_array);
bpf_prog_array_free(old_array);
-out:
+unlock:
mutex_unlock(&bpf_event_mutex);
return ret;
}
mutex_lock(&bpf_event_mutex);
if (!event->prog)
- goto out;
-
- old_array = rcu_dereference_protected(event->tp_event->prog_array,
- lockdep_is_held(&bpf_event_mutex));
+ goto unlock;
+ old_array = event->tp_event->prog_array;
ret = bpf_prog_array_copy(old_array, event->prog, NULL, &new_array);
if (ret < 0) {
bpf_prog_array_delete_safe(old_array, event->prog);
bpf_prog_put(event->prog);
event->prog = NULL;
-out:
+unlock:
mutex_unlock(&bpf_event_mutex);
}