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

Commit bc98884b authored by Ajay Prathi's avatar Ajay Prathi Committed by Gerrit - the friendly Code Review server
Browse files

msm: mhi_dev: Skip mhi channel state info change



Fix Null pointer access when host rescans the device
by not changing the channel state info if channel is
already in disconnected or configured state.

Change-Id: I5e897d7694f958e2b9613abfd23cbc0e975e81a3
Signed-off-by: default avatarAjay Prathi <aprathi@codeaurora.org>
parent 6b42a54e
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -2045,6 +2045,14 @@ static void mhi_update_state_info_all(enum mhi_ctrl_info info)

	mhi_ctx->ctrl_info = info;
	for (i = 0; i < MHI_MAX_SOFTWARE_CHANNELS; ++i) {
		/*
		 * Skip channel state info change
		 * if channel is already in the desired state.
		 */
		if (channel_state_info[i].ctrl_info == info ||
		    (info == MHI_STATE_DISCONNECTED &&
		    channel_state_info[i].ctrl_info == MHI_STATE_CONFIGURED))
			continue;
		channel_state_info[i].ctrl_info = info;
		/* Notify kernel clients */
		mhi_dev_trigger_cb(i);