Skip to content

Commit 348b530

Browse files
committed
try to fix
Signed-off-by: Mykyta Yatsenko <[email protected]>
1 parent 8adf4e2 commit 348b530

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

kernel/bpf/helpers.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1348,7 +1348,7 @@ static int __bpf_async_init(struct bpf_async_kern *async, struct bpf_map *map, u
13481348
/* maps with timers must be either held by user space
13491349
* or pinned in bpffs.
13501350
*/
1351-
switch (type) {
1351+
switch (type) { //TODO: async may already have another cb attached
13521352
case BPF_ASYNC_TYPE_TIMER:
13531353
bpf_timer_cancel_and_free(async);
13541354
break;
@@ -1452,15 +1452,19 @@ static int __bpf_async_set_callback(struct bpf_async_kern *async, void *callback
14521452
{
14531453
struct bpf_prog *prog = aux->prog;
14541454
struct bpf_async_cb *cb;
1455+
int ret;
14551456

14561457
if (in_nmi())
14571458
return -EOPNOTSUPP;
14581459

1460+
guard(rcu)();
1461+
14591462
cb = READ_ONCE(async->cb);
14601463
if (!cb)
14611464
return -EINVAL;
14621465

1463-
return bpf_async_update_callback(cb, callback_fn, prog);
1466+
ret = bpf_async_update_callback(cb, callback_fn, prog);
1467+
return ret;
14641468
}
14651469

14661470
BPF_CALL_3(bpf_timer_set_callback, struct bpf_async_kern *, timer, void *, callback_fn,

0 commit comments

Comments
 (0)