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

Commit 9d1a0931 authored by Manoj Prabhu B's avatar Manoj Prabhu B Committed by Gerrit - the friendly Code Review server
Browse files

diag: dci: Add NULL pointer checks for dci buffers



The patch initializes dci peripheral buffers to NULL
to prevent access before allocation by validating buffer status.

CRs-Fixed: 2048635
Change-Id: I9be46e751da81cbbbae4fe0333c23101fdbf79ed
Signed-off-by: default avatarManoj Prabhu B <bmanoj@codeaurora.org>
parent c97f5cfd
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -2792,6 +2792,8 @@ int diag_dci_register_client(struct diag_dci_reg_tbl_t *reg_entry)
		new_entry->num_buffers = 1;
		break;
	}

	new_entry->buffers = NULL;
	new_entry->real_time = MODE_REALTIME;
	new_entry->in_service = 0;
	INIT_LIST_HEAD(&new_entry->list_write_buf);
@@ -2865,7 +2867,8 @@ int diag_dci_register_client(struct diag_dci_reg_tbl_t *reg_entry)

fail_alloc:
	if (new_entry) {
		for (i = 0; i < new_entry->num_buffers; i++) {
		for (i = 0; ((i < new_entry->num_buffers) &&
			new_entry->buffers); i++) {
			proc_buf = &new_entry->buffers[i];
			if (proc_buf) {
				mutex_destroy(&proc_buf->health_mutex);