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

Commit 5b2f7c5e authored by Mohammed Javid's avatar Mohammed Javid
Browse files

msm: ipa2: Fix IPA kernel NULL pointer dereference



Add changes to fix IPA kernel NULL pointer dereference issue

Change-Id: I090d900688f13bc80616e7a3c49f7e1d6cf1be0b
Acked-by: default avatarAshok Vuyyuru <avuyyuru@qti.qualcomm.com>
Signed-off-by: default avatarMohammed Javid <mjavid@codeaurora.org>
parent 06b74968
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -1082,13 +1082,14 @@ int gsi_alloc_evt_ring(struct gsi_evt_ring_props *props, unsigned long dev_hdl,
	uint32_t val;
	struct gsi_evt_ctx *ctx;
	int res;
	int ee = gsi_ctx->per.ee;
	int ee;
	unsigned long flags;

	if (!gsi_ctx) {
		pr_err("%s:%d gsi context not allocated\n", __func__, __LINE__);
		return -GSI_STATUS_NODEV;
	}
	ee = gsi_ctx->per.ee;

	if (!props || !evt_ring_hdl || dev_hdl != (uintptr_t)gsi_ctx) {
		GSIERR("bad params props=%p dev_hdl=0x%lx evt_ring_hdl=%p\n",
@@ -1605,7 +1606,7 @@ int gsi_alloc_channel(struct gsi_chan_props *props, unsigned long dev_hdl,
	struct gsi_chan_ctx *ctx;
	uint32_t val;
	int res;
	int ee = gsi_ctx->per.ee;
	int ee;
	enum gsi_ch_cmd_opcode op = GSI_CH_ALLOCATE;
	uint8_t erindex;
	void **user_data;
@@ -1614,6 +1615,7 @@ int gsi_alloc_channel(struct gsi_chan_props *props, unsigned long dev_hdl,
		pr_err("%s:%d gsi context not allocated\n", __func__, __LINE__);
		return -GSI_STATUS_NODEV;
	}
	ee = gsi_ctx->per.ee;

	if (!props || !chan_hdl || dev_hdl != (uintptr_t)gsi_ctx) {
		GSIERR("bad params props=%p dev_hdl=0x%lx chan_hdl=%p\n",
@@ -2208,12 +2210,13 @@ int gsi_query_channel_info(unsigned long chan_hdl,
	unsigned long flags;
	uint64_t rp;
	uint64_t wp;
	int ee = gsi_ctx->per.ee;
	int ee;

	if (!gsi_ctx) {
		pr_err("%s:%d gsi context not allocated\n", __func__, __LINE__);
		return -GSI_STATUS_NODEV;
	}
	ee = gsi_ctx->per.ee;

	if (chan_hdl >= gsi_ctx->max_ch || !info) {
		GSIERR("bad params chan_hdl=%lu info=%p\n", chan_hdl, info);
@@ -2278,12 +2281,13 @@ int gsi_is_channel_empty(unsigned long chan_hdl, bool *is_empty)
	unsigned long flags;
	uint64_t rp;
	uint64_t wp;
	int ee = gsi_ctx->per.ee;
	int ee;

	if (!gsi_ctx) {
		pr_err("%s:%d gsi context not allocated\n", __func__, __LINE__);
		return -GSI_STATUS_NODEV;
	}
	ee = gsi_ctx->per.ee;

	if (chan_hdl >= gsi_ctx->max_ch || !is_empty) {
		GSIERR("bad params chan_hdl=%lu is_empty=%p\n",
@@ -2464,13 +2468,14 @@ int gsi_poll_channel(unsigned long chan_hdl,
{
	struct gsi_chan_ctx *ctx;
	uint64_t rp;
	int ee = gsi_ctx->per.ee;
	int ee;
	unsigned long flags;

	if (!gsi_ctx) {
		pr_err("%s:%d gsi context not allocated\n", __func__, __LINE__);
		return -GSI_STATUS_NODEV;
	}
	ee = gsi_ctx->per.ee;

	if (chan_hdl >= gsi_ctx->max_ch || !notify) {
		GSIERR("bad params chan_hdl=%lu notify=%p\n", chan_hdl, notify);