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

Commit fe005cce authored by Hardik Arya's avatar Hardik Arya
Browse files

diag: Enable flushing of mdlog table entries for multi logging mode



Currently in case of multi logging mode, there is a possibility of
accessing freed up buffer address after reallocation due to not flushing
mdlog entry table. The patch enable flushing of mdlog table entries in
case of multi logging mode before reallocation of data buffer.

CRs-Fixed: 2151723
Change-Id: I9aa44aea199c28d890a3b0ce38e9eb4f6e2fdd02
Signed-off-by: default avatarHardik Arya <harya@codeaurora.org>
parent bcbb35dd
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1682,10 +1682,10 @@ static int diagfwd_mux_write_done(unsigned char *buf, int len, int buf_ctxt,
		break;
	case TYPE_CMD:
		if (peripheral >= 0 && peripheral < NUM_PERIPHERALS) {
			diagfwd_write_done(peripheral, type, num);
			DIAG_LOG(DIAG_DEBUG_PERIPHERALS,
			"Marking buffer as free after write done p: %d, t: %d, buf_num: %d\n",
				peripheral, type, num);
			diagfwd_write_done(peripheral, type, num);
		}
		if (peripheral == APPS_DATA ||
				ctxt == DIAG_MEMORY_DEVICE_MODE) {
+6 −1
Original line number Diff line number Diff line
@@ -205,7 +205,8 @@ static int check_bufsize_for_encoding(struct diagfwd_buf_t *buf, uint32_t len)
		}

		if (buf->len < max_size) {
			if (driver->logging_mode == DIAG_MEMORY_DEVICE_MODE) {
			if (driver->logging_mode == DIAG_MEMORY_DEVICE_MODE ||
				driver->logging_mode == DIAG_MULTI_MODE) {
				ch = &diag_md[DIAG_LOCAL_PROC];
				for (i = 0; ch != NULL &&
						i < ch->num_tbl_entries; i++) {
@@ -1631,6 +1632,10 @@ void diagfwd_channel_read(struct diagfwd_info *fwd_info)
fail_return:
	diag_ws_release();
	atomic_set(&temp_buf->in_busy, 0);
	DIAG_LOG(DIAG_DEBUG_PERIPHERALS,
	"Buffer for core PD is marked free, p: %d, t: %d, buf_num: %d\n",
		fwd_info->peripheral, fwd_info->type,
		GET_BUF_NUM(temp_buf->ctxt));
}

static void diagfwd_queue_read(struct diagfwd_info *fwd_info)