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

Commit 4f36d854 authored by Hardik Arya's avatar Hardik Arya
Browse files

diag: Add protection before accessing md_session_map



Currently protection is missing while accessing global
variable md_session_map. The patch adds protection before
accessing the same.

Change-Id: I165b9a7900cec20ca7970b37ca4823e2186fe27c
Signed-off-by: default avatarHardik Arya <harya@codeaurora.org>
parent 11ee621a
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1747,15 +1747,18 @@ static int diag_switch_logging(struct diag_logging_mode_param_t *param)

		i = upd - UPD_WLAN;

		mutex_lock(&driver->md_session_lock);
		if (driver->md_session_map[peripheral] &&
			(MD_PERIPHERAL_MASK(peripheral) &
			diag_mux->mux_mask) &&
			!driver->pd_session_clear[i]) {
			DIAG_LOG(DIAG_DEBUG_USERSPACE,
			"diag_fr: User PD is already logging onto active peripheral logging\n");
			mutex_unlock(&driver->md_session_lock);
			driver->pd_session_clear[i] = 0;
			return -EINVAL;
		}
		mutex_unlock(&driver->md_session_lock);
		peripheral_mask =
			diag_translate_mask(param->pd_mask);
		param->peripheral_mask = peripheral_mask;