Browse Source
MT#55283 redis: cover a usage of write DB with lock
Just cover it with already existing lock
used below, but move upper.
Fixes Covery Scan detected defect:
*** CID 1621443: Concurrent data access violations (MISSING_LOCK)
/daemon/redis.c: 2232 in json_restore_call()
2226 call_destroy(c);
2227 release_closed_sockets();
2228 if (must_release_pop) // avoid deadlock with redis_notify->lock below
2229 redis_ports_release_pop(false);
2230 must_release_pop = false;
2231
>>> CID 1621443: Concurrent data access violations (MISSING_LOCK)
>>> Accessing "rtpe_redis_write->db" without holding lock "redis.lock".
>>> Elsewhere, "redis.db" is written to with "redis.lock" held 1 out of 1 times.
2232 redis_select_db(rtpe_redis_write, rtpe_redis_write->db);
2233
2234 mutex_lock(&rtpe_redis_write->lock);
2235 redisCommandNR(rtpe_redis_write->ctx, "DEL " PB, PBSTR(callid));
2236 mutex_unlock(&rtpe_redis_write->lock);
2237
Change-Id: Iff3425451f82218480dcc08f42ea7bddbd6f672f
pull/1931/head