Commit 2dc8b6af authored by Lukas Braun's avatar Lukas Braun Committed by Simon Ruderich
Browse files

slsm: grab the tree mutex while serializing

slsm_serialize_subtree allocates, so we can't rely on RCU.
parent bd943b31
......@@ -263,7 +263,6 @@ ssize_t slsm_serialize_subtree(struct slsm_str *buf, struct slsm_str *path_buf,
}
ssize_t slsm_serialize_tree(char **retbuf) {
struct tree_node *t;
ssize_t ret;
struct slsm_str buf;
struct slsm_str path_buf;
......@@ -278,10 +277,9 @@ ssize_t slsm_serialize_tree(char **retbuf) {
if (ret)
return ret;
rcu_read_lock();
t = rcu_dereference(rules);
ret = slsm_serialize_subtree(&buf, &path_buf, t);
rcu_read_unlock();
mutex_lock(&mutex);
ret = slsm_serialize_subtree(&buf, &path_buf, rules);
mutex_unlock(&mutex);
if (ret)
return ret;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment