]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
interconnect: Add locking in icc_set_tag()
authorGeorgi Djakov <georgi.djakov@linaro.org>
Fri, 18 Oct 2019 14:17:50 +0000 (17:17 +0300)
committerGeorgi Djakov <georgi.djakov@linaro.org>
Sun, 20 Oct 2019 09:14:41 +0000 (12:14 +0300)
We must ensure that the tag is not changed while we aggregate the
requests. Currently the icc_set_tag() is not using any locks and this
may cause the values to be aggregated incorrectly. Fix this by acquiring
the icc_lock while we set the tag.

Link: https://lore.kernel.org/lkml/20191018141750.17032-1-georgi.djakov@linaro.org/
Fixes: 127ab2cc5f19 ("interconnect: Add support for path tags")
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
drivers/interconnect/core.c

index 7b971228df38667f8983572922ad8a971b79fe3c..c498796adc074d5c42fdae5b95bbb809a43850b3 100644 (file)
@@ -405,8 +405,12 @@ void icc_set_tag(struct icc_path *path, u32 tag)
        if (!path)
                return;
 
+       mutex_lock(&icc_lock);
+
        for (i = 0; i < path->num_nodes; i++)
                path->reqs[i].tag = tag;
+
+       mutex_unlock(&icc_lock);
 }
 EXPORT_SYMBOL_GPL(icc_set_tag);