Browse Source

[Fix] Prevent use-after-free in Redis callbacks after session cleanup

Set ud->terminated in lua_redis_fin() so async Redis callbacks
don't access task data after the task pool has been freed.
pull/5804/head
Vsevolod Stakhov 3 weeks ago
parent
commit
99ba65fc30
No known key found for this signature in database GPG Key ID: 7647B6790081437
  1. 2
      src/lua/lua_redis.c

2
src/lua/lua_redis.c

@ -272,6 +272,8 @@ lua_redis_fin(void *arg)
msg_debug_lua_redis("finished redis query %p from session %p; refcount=%d",
sp_ud, ctx, ctx->ref.refcount);
sp_ud->flags |= LUA_REDIS_SPECIFIC_FINISHED;
/* Prevent callbacks from accessing task data after session cleanup */
ud->terminated = 1;
REDIS_RELEASE(ctx);
}

Loading…
Cancel
Save