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

Commit d1afa883 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "diag: Fix for possible stale task entries"

parents 626aa661 3f4178bf
Loading
Loading
Loading
Loading
+19 −8
Original line number Diff line number Diff line
@@ -117,20 +117,31 @@ void diag_notify_md_client(uint8_t peripheral, int data)
	if (driver->logging_mode != DIAG_MEMORY_DEVICE_MODE)
		return;

	mutex_lock(&driver->diag_file_mutex);
	mutex_lock(&driver->md_session_lock);
	memset(&info, 0, sizeof(struct siginfo));
	info.si_code = SI_QUEUE;
	info.si_int = (PERIPHERAL_MASK(peripheral) | data);
	info.si_signo = SIGCONT;
	if (driver->md_session_map[peripheral] &&
		driver->md_session_map[peripheral]->task) {
		if (driver->md_session_map[peripheral]->pid ==
			driver->md_session_map[peripheral]->task->tgid) {
			DIAG_LOG(DIAG_DEBUG_PERIPHERALS,
				"md_session %d pid = %d, md_session %d task tgid = %d\n",
				peripheral,
				driver->md_session_map[peripheral]->pid,
				peripheral,
				driver->md_session_map[peripheral]->task->tgid);
			stat = send_sig_info(info.si_signo, &info,
				driver->md_session_map[peripheral]->task);
			if (stat)
				pr_err("diag: Err sending signal to memory device client, signal data: 0x%x, stat: %d\n",
					info.si_int, stat);
		} else
			pr_err("diag: md_session_map[%d] data is corrupted, signal data: 0x%x, stat: %d\n",
				peripheral, info.si_int, stat);
	}
	mutex_unlock(&driver->diag_file_mutex);
	mutex_unlock(&driver->md_session_lock);
}

static void process_pd_status(uint8_t *buf, uint32_t len,