Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cb2fc331 authored by Eric Holmberg's avatar Eric Holmberg
Browse files

soc: qcom: glink: fix channel context ref count updates



The logic for updating reference counts for the local channel is
backwards resulting in a NULL-pointer deference in the case that the
local channel does not exist and in a wrong reference count increment in
the case that the local channel does exist.

Fix the ref count updates to update the correct variables.

Change-Id: Ib10884362aaa22bdc9781c8cc82762afcf8d9010
Signed-off-by: default avatarEric Holmberg <eholmber@codeaurora.org>
parent 073af1cb
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -2918,10 +2918,10 @@ static bool ch_migrate(struct channel_ctx *l_ctx, struct channel_ctx *r_ctx)
	if (!l_ctx)
		l_ctx = find_l_ctx_get(r_ctx);
	else
		rwref_get(&r_ctx->ch_state_lhc0);
		rwref_get(&l_ctx->ch_state_lhc0);
	if (!l_ctx) {
		rwref_put(&l_ctx->ch_state_lhc0);
		goto exit;
		rwref_put(&r_ctx->ch_state_lhc0);
		return migrated;
	}

	if (l_ctx->local_xprt_req == r_ctx->remote_xprt_req &&