aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-03-17 05:54:16 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-03-17 05:54:16 +0000
commit16b7572c49fc859f29006dfa0e4212db3a4b4a8b (patch)
treeedbbe567eaef26da6d27200691f9893b95fb0d94 /main
parent3ac94aa8c900b478a46798ab1e1e2fd8f2703570 (diff)
Merged revisions 182450 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ................ r182450 | tilghman | 2009-03-17 00:51:54 -0500 (Tue, 17 Mar 2009) | 14 lines Merged revisions 182449 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r182449 | tilghman | 2009-03-17 00:50:52 -0500 (Tue, 17 Mar 2009) | 7 lines Fix race in astdb The underlying db1 implementation does not fully isolate the pages retrieved from astdb, so the lock protecting accesses needs to be extended until the copy from the shared memory structure is done. (closes issue #14682) Reported by: makoto ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.2@182453 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/db.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/main/db.c b/main/db.c
index 46601dc41..6528aa246 100644
--- a/main/db.c
+++ b/main/db.c
@@ -180,10 +180,8 @@ int ast_db_get(const char *family, const char *keys, char *value, int valuelen)
memset(value, 0, valuelen);
key.data = fullkey;
key.size = fullkeylen + 1;
-
+
res = astdb->get(astdb, &key, &data, 0);
-
- ast_mutex_unlock(&dblock);
/* Be sure to NULL terminate our data either way */
if (res) {
@@ -200,6 +198,11 @@ int ast_db_get(const char *family, const char *keys, char *value, int valuelen)
ast_log(LOG_NOTICE, "Strange, empty value for /%s/%s\n", family, keys);
}
}
+
+ /* Data is not fully isolated for concurrency, so the lock must be extended
+ * to after the copy to the output buffer. */
+ ast_mutex_unlock(&dblock);
+
return res;
}