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

Commit 22e3f5ee authored by Katish Paran's avatar Katish Paran Committed by Ravi Aravamudhan
Browse files

diag: Mutex protect the command list while traversing



During peripheral subsystem restart apps diag remove the entries
registered for the peripheral. In the meantime, tool can send
command designated to that peripheral. Mutex protect the list
so that stale data is not accessed.

Change-Id: Icca4b43506544b54e516110fbed97c8f39602861
Signed-off-by: default avatarKatish Paran <kparan@codeaurora.org>
parent 58d6bfbe
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -774,12 +774,16 @@ int diag_process_apps_pkt(unsigned char *buf, int len)
		return 0;
	}

	mutex_lock(&driver->cmd_reg_mutex);
	temp_entry = diag_cmd_search(&entry, ALL_PROC);
	if (temp_entry) {
		reg_item = container_of(temp_entry, struct diag_cmd_reg_t,
								entry);
		return diag_send_data(reg_item, buf, len);
		write_len = diag_send_data(reg_item, buf, len);
		mutex_unlock(&driver->cmd_reg_mutex);
		return write_len;
	}
	mutex_unlock(&driver->cmd_reg_mutex);

#if defined(CONFIG_DIAG_OVER_USB)
	/* Check for the command/respond msg for the maximum packet length */