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

Commit afe20da3 authored by Manoj Prabhu B's avatar Manoj Prabhu B
Browse files

memshare: Avoid accessing uninitialized nodes



Prevent iterating over uninitialized memshare child nodes
while handling client alloc and free requests.

Change-Id: I421cd239bb999176e587ab0c06757d83485fad6e
Signed-off-by: default avatarManoj Prabhu B <quic_bmanoj@quicinc.com>
Signed-off-by: default avatarMeenu Raja Sundaram <quic_mrajasun@quicinc.com>
parent f3cc95da
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2013-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
 * Copyright (c) 2022-2023, Qualcomm Innovation Center, Inc. All rights reserved.
 */

#include <linux/err.h>
@@ -104,7 +104,7 @@ static int check_client(int client_id, int proc, int request)
	int i = 0, rc;
	int found = DHMS_MEM_CLIENT_INVALID;

	for (i = 0; i < MAX_CLIENTS; i++) {
	for (i = 0; i < num_clients; i++) {
		if (memblock[i].client_id == client_id &&
				memblock[i].peripheral == proc) {
			found = i;
@@ -484,7 +484,7 @@ static void handle_alloc_generic_req(struct qmi_handle *handle,
		return;
	}

	for (i = 0; i < MAX_CLIENTS; i++) {
	for (i = 0; i < num_clients; i++) {
		if (memsh_child[i]->client_id == alloc_req->client_id) {
			client_node = memsh_child[i];
			dev_info(memsh_drv->dev,
@@ -577,7 +577,7 @@ static void handle_free_generic_req(struct qmi_handle *handle,
		flag = 1;
	}

	for (i = 0; i < MAX_CLIENTS; i++) {
	for (i = 0; i < num_clients; i++) {
		if (memsh_child[i]->client_id == free_req->client_id) {
			client_node = memsh_child[i];
			dev_info(memsh_drv->dev,