From bb73294fb71f02da055bc3d6222b89ed7cd46291 Mon Sep 17 00:00:00 2001 From: Dhoat Harpal Date: Fri, 12 May 2017 20:33:21 +0530 Subject: soc: qcom: glink: Move ctx initialization of xprt ptr In glink_open function, channel context initialization with transport pointer is done quite after after its creation. This create race condition, if parallel thread try to use transport pointer of ctx. Ctx is initialized with transport pointer right at the time of its creation. CRs-Fixed: 2061645 Change-Id: Idcddf1ab10b8673a20bc1f23d8702bf870f79dbd Signed-off-by: Dhoat Harpal --- drivers/soc/qcom/glink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/soc/qcom/glink.c b/drivers/soc/qcom/glink.c index 29e67d9fa389..ee0fe1622645 100644 --- a/drivers/soc/qcom/glink.c +++ b/drivers/soc/qcom/glink.c @@ -1935,6 +1935,7 @@ check_ctx: kfree(flcid); } + ctx->transport_ptr = xprt_ctx; list_add_tail(&ctx->port_list_node, &xprt_ctx->channels); GLINK_INFO_PERF_CH_XPRT(ctx, xprt_ctx, @@ -2640,7 +2641,6 @@ void *glink_open(const struct glink_open_config *cfg) ctx->local_xprt_req = best_id; ctx->no_migrate = cfg->transport && !(cfg->options & GLINK_OPT_INITIAL_XPORT); - ctx->transport_ptr = transport_ptr; ctx->local_open_state = GLINK_CHANNEL_OPENING; GLINK_INFO_PERF_CH(ctx, "%s: local:GLINK_CHANNEL_CLOSED->GLINK_CHANNEL_OPENING\n", -- cgit v1.2.3