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

Commit 3a7b889f authored by Hardik Arya's avatar Hardik Arya
Browse files

diag: Add subid mask ptr correctly to ms_ptr list



There is a possibility of corrupting the ms_ptr list
while adding new subid mask ptr to the list. The patch
ensures the addition of new ptr without corrupting list.

Change-Id: I79e16e86d46e74b4b5d9b7af1ec1b56a0db7f15d
Signed-off-by: default avatarHardik Arya <harya@codeaurora.org>
parent eabcd830
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -3503,6 +3503,7 @@ static int __diag_multisim_mask_init(struct diag_mask_info *mask_info,
		int mask_len, int subid_index)
{
	struct diag_multisim_masks *temp = NULL;
	struct diag_multisim_masks *ms_ptr = NULL;

	if (!mask_info || mask_len <= 0 || subid_index < 0)
		return -EINVAL;
@@ -3522,9 +3523,10 @@ static int __diag_multisim_mask_init(struct diag_mask_info *mask_info,
		temp->next = NULL;

		if (mask_info->ms_ptr) {
			while (mask_info->ms_ptr->next)
				mask_info->ms_ptr = mask_info->ms_ptr->next;
			mask_info->ms_ptr->next = temp;
			ms_ptr = mask_info->ms_ptr;
			while (ms_ptr->next)
				ms_ptr = ms_ptr->next;
			ms_ptr->next = temp;
		} else {
			mask_info->ms_ptr = temp;
		}
+1 −1
Original line number Diff line number Diff line
@@ -163,7 +163,7 @@ extern struct diag_mask_info msg_bt_mask;
extern struct diag_mask_info log_mask;
extern struct diag_mask_info event_mask;

#define MAX_SIM_NUM 7
#define MAX_SIM_NUM 2
#define INVALID_INDEX -1
#define LEGACY_MASK_CMD 0
#define SUBID_CMD 1