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

Commit bd6b3989 authored by Chris Lew's avatar Chris Lew Committed by Gerrit - the friendly Code Review server
Browse files

diag: Remove null pointer dereference from diag_md_session_close



Remove reference to session_info after handle is closed.
Store the peripheral masks in a local variable before closing the
session. Use stored value instead of closed session_info handle.

CRs-fixed: 930676
Change-Id: I08179b100926883f0cb84e0de35cc356e9cc9a03
Signed-off-by: default avatarChris Lew <clew@codeaurora.org>
parent cbac2b43
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -372,6 +372,7 @@ fail:
static void diag_close_logging_process(const int pid)
{
	int i;
	int session_peripheral_mask;
	struct diag_md_session_t *session_info = NULL;
	struct diag_logging_mode_param_t params;

@@ -379,9 +380,10 @@ static void diag_close_logging_process(const int pid)
	if (!session_info)
		return;

	session_peripheral_mask = session_info->peripheral_mask;
	diag_md_session_close(session_info);
	for (i = 0; i < NUM_MD_SESSIONS; i++)
		if (MD_PERIPHERAL_MASK(i) & session_info->peripheral_mask)
		if (MD_PERIPHERAL_MASK(i) & session_peripheral_mask)
			diag_mux_close_peripheral(DIAG_LOCAL_PROC, i);

	params.req_mode = USB_MODE;