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

Commit e978281e authored by Utkarsh Saxena's avatar Utkarsh Saxena Committed by Mohammed Javid
Browse files

msm:ipa: using rate limit api for ioctl calls



ipav2/ipav3 ioctl calls input arguments validation failed cases,
replacing IPAERR() with IPAERR_RL() marco for controlling logs
printing on the console.

Change-Id: I0d1aabb9b500228e5fd5d94cf17657bf29bdf175
Acked-by: default avatarAshok Vuyyuru <avuyyuru@qti.qualcomm.com>
Signed-off-by: default avatarUtkarsh Saxena <usaxena@codeaurora.org>
Signed-off-by: default avatarMohammed Javid <mjavid@codeaurora.org>
parent 93e94cea
Loading
Loading
Loading
Loading
+15 −15
Original line number Diff line number Diff line
@@ -641,7 +641,7 @@ static long ipa_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
		/* add check in case user-space module compromised */
		if (unlikely(((struct ipa_ioc_nat_dma_cmd *)param)->entries
			!= pre_entry)) {
			IPAERR("current %d pre %d\n",
			IPAERR_RL("current %d pre %d\n",
				((struct ipa_ioc_nat_dma_cmd *)param)->entries,
				pre_entry);
			retval = -EFAULT;
@@ -688,7 +688,7 @@ static long ipa_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
		/* add check in case user-space module compromised */
		if (unlikely(((struct ipa_ioc_add_hdr *)param)->num_hdrs
			!= pre_entry)) {
			IPAERR("current %d pre %d\n",
			IPAERR_RL("current %d pre %d\n",
				((struct ipa_ioc_add_hdr *)param)->num_hdrs,
				pre_entry);
			retval = -EFAULT;
@@ -727,7 +727,7 @@ static long ipa_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
		/* add check in case user-space module compromised */
		if (unlikely(((struct ipa_ioc_del_hdr *)param)->num_hdls
			!= pre_entry)) {
			IPAERR("current %d pre %d\n",
			IPAERR_RL("current %d pre %d\n",
				((struct ipa_ioc_del_hdr *)param)->num_hdls,
				pre_entry);
			retval = -EFAULT;
@@ -767,7 +767,7 @@ static long ipa_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
		/* add check in case user-space module compromised */
		if (unlikely(((struct ipa_ioc_add_rt_rule *)param)->num_rules
			!= pre_entry)) {
			IPAERR("current %d pre %d\n",
			IPAERR_RL("current %d pre %d\n",
				((struct ipa_ioc_add_rt_rule *)param)->
				num_rules,
				pre_entry);
@@ -807,7 +807,7 @@ static long ipa_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
		/* add check in case user-space module compromised */
		if (unlikely(((struct ipa_ioc_mdfy_rt_rule *)param)->num_rules
			!= pre_entry)) {
			IPAERR("current %d pre %d\n",
			IPAERR_RL("current %d pre %d\n",
				((struct ipa_ioc_mdfy_rt_rule *)param)->
				num_rules,
				pre_entry);
@@ -847,7 +847,7 @@ static long ipa_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
		/* add check in case user-space module compromised */
		if (unlikely(((struct ipa_ioc_del_rt_rule *)param)->num_hdls
			!= pre_entry)) {
			IPAERR("current %d pre %d\n",
			IPAERR_RL("current %d pre %d\n",
				((struct ipa_ioc_del_rt_rule *)param)->num_hdls,
				pre_entry);
			retval = -EFAULT;
@@ -886,7 +886,7 @@ static long ipa_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
		/* add check in case user-space module compromised */
		if (unlikely(((struct ipa_ioc_add_flt_rule *)param)->num_rules
			!= pre_entry)) {
			IPAERR("current %d pre %d\n",
			IPAERR_RL("current %d pre %d\n",
				((struct ipa_ioc_add_flt_rule *)param)->
				num_rules,
				pre_entry);
@@ -926,7 +926,7 @@ static long ipa_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
		/* add check in case user-space module compromised */
		if (unlikely(((struct ipa_ioc_del_flt_rule *)param)->num_hdls
			!= pre_entry)) {
			IPAERR("current %d pre %d\n",
			IPAERR_RL("current %d pre %d\n",
				((struct ipa_ioc_del_flt_rule *)param)->
				num_hdls,
				pre_entry);
@@ -966,7 +966,7 @@ static long ipa_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
		/* add check in case user-space module compromised */
		if (unlikely(((struct ipa_ioc_mdfy_flt_rule *)param)->num_rules
			!= pre_entry)) {
			IPAERR("current %d pre %d\n",
			IPAERR_RL("current %d pre %d\n",
				((struct ipa_ioc_mdfy_flt_rule *)param)->
				num_rules,
				pre_entry);
@@ -1104,7 +1104,7 @@ static long ipa_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
		if (unlikely(((struct ipa_ioc_query_intf_tx_props *)
			param)->num_tx_props
			!= pre_entry)) {
			IPAERR("current %d pre %d\n",
			IPAERR_RL("current %d pre %d\n",
				((struct ipa_ioc_query_intf_tx_props *)
				param)->num_tx_props, pre_entry);
			retval = -EFAULT;
@@ -1149,7 +1149,7 @@ static long ipa_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
		/* add check in case user-space module compromised */
		if (unlikely(((struct ipa_ioc_query_intf_rx_props *)
			param)->num_rx_props != pre_entry)) {
			IPAERR("current %d pre %d\n",
			IPAERR_RL("current %d pre %d\n",
				((struct ipa_ioc_query_intf_rx_props *)
				param)->num_rx_props, pre_entry);
			retval = -EFAULT;
@@ -1194,7 +1194,7 @@ static long ipa_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
		/* add check in case user-space module compromised */
		if (unlikely(((struct ipa_ioc_query_intf_ext_props *)
			param)->num_ext_props != pre_entry)) {
			IPAERR("current %d pre %d\n",
			IPAERR_RL("current %d pre %d\n",
				((struct ipa_ioc_query_intf_ext_props *)
				param)->num_ext_props, pre_entry);
			retval = -EFAULT;
@@ -1232,7 +1232,7 @@ static long ipa_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
		/* add check in case user-space module compromised */
		if (unlikely(((struct ipa_msg_meta *)param)->msg_len
			!= pre_entry)) {
			IPAERR("current %d pre %d\n",
			IPAERR_RL("current %d pre %d\n",
				((struct ipa_msg_meta *)param)->msg_len,
				pre_entry);
			retval = -EFAULT;
@@ -1372,7 +1372,7 @@ static long ipa_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
		/* add check in case user-space module compromised */
		if (unlikely(((struct ipa_ioc_add_hdr_proc_ctx *)
			param)->num_proc_ctxs != pre_entry)) {
			IPAERR("current %d pre %d\n",
			IPAERR_RL("current %d pre %d\n",
				((struct ipa_ioc_add_hdr_proc_ctx *)
				param)->num_proc_ctxs, pre_entry);
			retval = -EFAULT;
@@ -1411,7 +1411,7 @@ static long ipa_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
		/* add check in case user-space module compromised */
		if (unlikely(((struct ipa_ioc_del_hdr_proc_ctx *)
			param)->num_hdls != pre_entry)) {
			IPAERR("current %d pre %d\n",
			IPAERR_RL("current %d pre %d\n",
				((struct ipa_ioc_del_hdr_proc_ctx *)param)->
				num_hdls,
				pre_entry);
+23 −23
Original line number Diff line number Diff line
@@ -1015,25 +1015,25 @@ static int __ipa_add_flt_rule(struct ipa_flt_tbl *tbl, enum ipa_ip_type ip,
	if (rule->action != IPA_PASS_TO_EXCEPTION) {
		if (!rule->eq_attrib_type) {
			if (!rule->rt_tbl_hdl) {
				IPAERR("invalid RT tbl\n");
				IPAERR_RL("invalid RT tbl\n");
				goto error;
			}

			rt_tbl = ipa_id_find(rule->rt_tbl_hdl);
			if (rt_tbl == NULL) {
				IPAERR("RT tbl not found\n");
				IPAERR_RL("RT tbl not found\n");
				goto error;
			}

			if (rt_tbl->cookie != IPA_RT_TBL_COOKIE) {
				IPAERR("RT table cookie is invalid\n");
				IPAERR_RL("RT table cookie is invalid\n");
				goto error;
			}
		} else {
			if (rule->rt_tbl_idx > ((ip == IPA_IP_v4) ?
				IPA_MEM_PART(v4_modem_rt_index_hi) :
				IPA_MEM_PART(v6_modem_rt_index_hi))) {
				IPAERR("invalid RT tbl\n");
				IPAERR_RL("invalid RT tbl\n");
				goto error;
			}
		}
@@ -1089,12 +1089,12 @@ static int __ipa_del_flt_rule(u32 rule_hdl)

	entry = ipa_id_find(rule_hdl);
	if (entry == NULL) {
		IPAERR("lookup failed\n");
		IPAERR_RL("lookup failed\n");
		return -EINVAL;
	}

	if (entry->cookie != IPA_FLT_COOKIE) {
		IPAERR("bad params\n");
		IPAERR_RL("bad params\n");
		return -EINVAL;
	}
	id = entry->id;
@@ -1121,12 +1121,12 @@ static int __ipa_mdfy_flt_rule(struct ipa_flt_rule_mdfy *frule,

	entry = ipa_id_find(frule->rule_hdl);
	if (entry == NULL) {
		IPAERR("lookup failed\n");
		IPAERR_RL("lookup failed\n");
		goto error;
	}

	if (entry->cookie != IPA_FLT_COOKIE) {
		IPAERR("bad params\n");
		IPAERR_RL("bad params\n");
		goto error;
	}

@@ -1136,25 +1136,25 @@ static int __ipa_mdfy_flt_rule(struct ipa_flt_rule_mdfy *frule,
	if (frule->rule.action != IPA_PASS_TO_EXCEPTION) {
		if (!frule->rule.eq_attrib_type) {
			if (!frule->rule.rt_tbl_hdl) {
				IPAERR("invalid RT tbl\n");
				IPAERR_RL("invalid RT tbl\n");
				goto error;
			}

			rt_tbl = ipa_id_find(frule->rule.rt_tbl_hdl);
			if (rt_tbl == NULL) {
				IPAERR("RT tbl not found\n");
				IPAERR_RL("RT tbl not found\n");
				goto error;
			}

			if (rt_tbl->cookie != IPA_RT_TBL_COOKIE) {
				IPAERR("RT table cookie is invalid\n");
				IPAERR_RL("RT table cookie is invalid\n");
				goto error;
			}
		} else {
			if (frule->rule.rt_tbl_idx > ((ip == IPA_IP_v4) ?
				IPA_MEM_PART(v4_modem_rt_index_hi) :
				IPA_MEM_PART(v6_modem_rt_index_hi))) {
				IPAERR("invalid RT tbl\n");
				IPAERR_RL("invalid RT tbl\n");
				goto error;
			}
		}
@@ -1178,7 +1178,7 @@ static int __ipa_add_global_flt_rule(enum ipa_ip_type ip,
	struct ipa_flt_tbl *tbl;

	if (rule == NULL || rule_hdl == NULL) {
		IPAERR("bad parms rule=%p rule_hdl=%p\n", rule, rule_hdl);
		IPAERR_RL("bad parms rule=%p rule_hdl=%p\n", rule, rule_hdl);

		return -EINVAL;
	}
@@ -1197,14 +1197,14 @@ static int __ipa_add_ep_flt_rule(enum ipa_ip_type ip, enum ipa_client_type ep,
	int ipa_ep_idx;

	if (rule == NULL || rule_hdl == NULL || ep >= IPA_CLIENT_MAX) {
		IPAERR("bad parms rule=%p rule_hdl=%p ep=%d\n", rule,
		IPAERR_RL("bad parms rule=%p rule_hdl=%p ep=%d\n", rule,
				rule_hdl, ep);

		return -EINVAL;
	}
	ipa_ep_idx = ipa2_get_ep_mapping(ep);
	if (ipa_ep_idx == IPA_FLT_TABLE_INDEX_NOT_FOUND) {
		IPAERR("ep not valid ep=%d\n", ep);
		IPAERR_RL("ep not valid ep=%d\n", ep);
		return -EINVAL;
	}
	if (ipa_ctx->ep[ipa_ep_idx].valid == 0)
@@ -1231,7 +1231,7 @@ int ipa2_add_flt_rule(struct ipa_ioc_add_flt_rule *rules)

	if (rules == NULL || rules->num_rules == 0 ||
			rules->ip >= IPA_IP_MAX) {
		IPAERR("bad parm\n");
		IPAERR_RL("bad parm\n");

		return -EINVAL;
	}
@@ -1249,7 +1249,7 @@ int ipa2_add_flt_rule(struct ipa_ioc_add_flt_rule *rules)
					rules->rules[i].at_rear,
					&rules->rules[i].flt_rule_hdl);
		if (result) {
			IPAERR("failed to add flt rule %d\n", i);
			IPAERR_RL("failed to add flt rule %d\n", i);
			rules->rules[i].status = IPA_FLT_STATUS_OF_ADD_FAILED;
		} else {
			rules->rules[i].status = 0;
@@ -1282,14 +1282,14 @@ int ipa2_del_flt_rule(struct ipa_ioc_del_flt_rule *hdls)
	int result;

	if (hdls == NULL || hdls->num_hdls == 0 || hdls->ip >= IPA_IP_MAX) {
		IPAERR("bad parm\n");
		IPAERR_RL("bad parm\n");
		return -EINVAL;
	}

	mutex_lock(&ipa_ctx->lock);
	for (i = 0; i < hdls->num_hdls; i++) {
		if (__ipa_del_flt_rule(hdls->hdl[i].hdl)) {
			IPAERR("failed to del rt rule %i\n", i);
			IPAERR_RL("failed to del rt rule %i\n", i);
			hdls->hdl[i].status = IPA_FLT_STATUS_OF_DEL_FAILED;
		} else {
			hdls->hdl[i].status = 0;
@@ -1322,14 +1322,14 @@ int ipa2_mdfy_flt_rule(struct ipa_ioc_mdfy_flt_rule *hdls)
	int result;

	if (hdls == NULL || hdls->num_rules == 0 || hdls->ip >= IPA_IP_MAX) {
		IPAERR("bad parm\n");
		IPAERR_RL("bad parm\n");
		return -EINVAL;
	}

	mutex_lock(&ipa_ctx->lock);
	for (i = 0; i < hdls->num_rules; i++) {
		if (__ipa_mdfy_flt_rule(&hdls->rules[i], hdls->ip)) {
			IPAERR("failed to mdfy rt rule %i\n", i);
			IPAERR_RL("failed to mdfy rt rule %i\n", i);
			hdls->rules[i].status = IPA_FLT_STATUS_OF_MDFY_FAILED;
		} else {
			hdls->rules[i].status = 0;
@@ -1363,7 +1363,7 @@ int ipa2_commit_flt(enum ipa_ip_type ip)
	int result;

	if (ip >= IPA_IP_MAX) {
		IPAERR("bad parm\n");
		IPAERR_RL("bad parm\n");
		return -EINVAL;
	}

@@ -1399,7 +1399,7 @@ int ipa2_reset_flt(enum ipa_ip_type ip)
	int id;

	if (ip >= IPA_IP_MAX) {
		IPAERR("bad parm\n");
		IPAERR_RL("bad parm\n");
		return -EINVAL;
	}

+26 −26
Original line number Diff line number Diff line
@@ -558,13 +558,13 @@ static int __ipa_add_hdr_proc_ctx(struct ipa_hdr_proc_ctx_add *proc_ctx,
		proc_ctx->type, proc_ctx->hdr_hdl);

	if (!HDR_PROC_TYPE_IS_VALID(proc_ctx->type)) {
		IPAERR("invalid processing type %d\n", proc_ctx->type);
		IPAERR_RL("invalid processing type %d\n", proc_ctx->type);
		return -EINVAL;
	}

	hdr_entry = ipa_id_find(proc_ctx->hdr_hdl);
	if (!hdr_entry || (hdr_entry->cookie != IPA_HDR_COOKIE)) {
		IPAERR("hdr_hdl is invalid\n");
		IPAERR_RL("hdr_hdl is invalid\n");
		return -EINVAL;
	}

@@ -592,7 +592,7 @@ static int __ipa_add_hdr_proc_ctx(struct ipa_hdr_proc_ctx_add *proc_ctx,
			ipa_hdr_proc_ctx_bin_sz[IPA_HDR_PROC_CTX_BIN1]) {
		bin = IPA_HDR_PROC_CTX_BIN1;
	} else {
		IPAERR("unexpected needed len %d\n", needed_len);
		IPAERR_RL("unexpected needed len %d\n", needed_len);
		WARN_ON(1);
		goto bad_len;
	}
@@ -602,7 +602,7 @@ static int __ipa_add_hdr_proc_ctx(struct ipa_hdr_proc_ctx_add *proc_ctx,
		IPA_MEM_PART(apps_hdr_proc_ctx_size_ddr);
	if (list_empty(&htbl->head_free_offset_list[bin])) {
		if (htbl->end + ipa_hdr_proc_ctx_bin_sz[bin] > mem_size) {
			IPAERR("hdr proc ctx table overflow\n");
			IPAERR_RL("hdr proc ctx table overflow\n");
			goto bad_len;
		}

@@ -676,12 +676,12 @@ static int __ipa_add_hdr(struct ipa_hdr_add *hdr)
	gfp_t flag = GFP_KERNEL | (ipa_ctx->use_dma_zone ? GFP_DMA : 0);

	if (hdr->hdr_len == 0 || hdr->hdr_len > IPA_HDR_MAX_SIZE) {
		IPAERR("bad parm\n");
		IPAERR_RL("bad parm\n");
		goto error;
	}

	if (!HDR_TYPE_IS_VALID(hdr->type)) {
		IPAERR("invalid hdr type %d\n", hdr->type);
		IPAERR_RL("invalid hdr type %d\n", hdr->type);
		goto error;
	}

@@ -713,7 +713,7 @@ static int __ipa_add_hdr(struct ipa_hdr_add *hdr)
	else if (hdr->hdr_len <= ipa_hdr_bin_sz[IPA_HDR_BIN4])
		bin = IPA_HDR_BIN4;
	else {
		IPAERR("unexpected hdr len %d\n", hdr->hdr_len);
		IPAERR_RL("unexpected hdr len %d\n", hdr->hdr_len);
		goto bad_hdr_len;
	}

@@ -844,7 +844,7 @@ static int __ipa_del_hdr_proc_ctx(u32 proc_ctx_hdl,

	entry = ipa_id_find(proc_ctx_hdl);
	if (!entry || (entry->cookie != IPA_PROC_HDR_COOKIE)) {
		IPAERR("bad parm\n");
		IPAERR_RL("bad parm\n");
		return -EINVAL;
	}

@@ -852,7 +852,7 @@ static int __ipa_del_hdr_proc_ctx(u32 proc_ctx_hdl,
		htbl->proc_ctx_cnt, entry->offset_entry->offset);

	if (by_user && entry->user_deleted) {
		IPAERR("proc_ctx already deleted by user\n");
		IPAERR_RL("proc_ctx already deleted by user\n");
		return -EINVAL;
	}

@@ -890,12 +890,12 @@ int __ipa_del_hdr(u32 hdr_hdl, bool by_user)

	entry = ipa_id_find(hdr_hdl);
	if (entry == NULL) {
		IPAERR("lookup failed\n");
		IPAERR_RL("lookup failed\n");
		return -EINVAL;
	}

	if (entry->cookie != IPA_HDR_COOKIE) {
		IPAERR("bad parm\n");
		IPAERR_RL("bad parm\n");
		return -EINVAL;
	}

@@ -907,7 +907,7 @@ int __ipa_del_hdr(u32 hdr_hdl, bool by_user)
			htbl->hdr_cnt, entry->offset_entry->offset);

	if (by_user && entry->user_deleted) {
		IPAERR("hdr already deleted by user\n");
		IPAERR_RL("hdr already deleted by user\n");
		return -EINVAL;
	}

@@ -956,12 +956,12 @@ int ipa2_add_hdr(struct ipa_ioc_add_hdr *hdrs)
	int result = -EFAULT;

	if (unlikely(!ipa_ctx)) {
		IPAERR("IPA driver was not initialized\n");
		IPAERR_RL("IPA driver was not initialized\n");
		return -EINVAL;
	}

	if (hdrs == NULL || hdrs->num_hdrs == 0) {
		IPAERR("bad parm\n");
		IPAERR_RL("bad parm\n");
		return -EINVAL;
	}

@@ -970,7 +970,7 @@ int ipa2_add_hdr(struct ipa_ioc_add_hdr *hdrs)
			hdrs->num_hdrs);
	for (i = 0; i < hdrs->num_hdrs; i++) {
		if (__ipa_add_hdr(&hdrs->hdr[i])) {
			IPAERR("failed to add hdr %d\n", i);
			IPAERR_RL("failed to add hdr %d\n", i);
			hdrs->hdr[i].status = -1;
		} else {
			hdrs->hdr[i].status = 0;
@@ -1011,14 +1011,14 @@ int ipa2_del_hdr_by_user(struct ipa_ioc_del_hdr *hdls, bool by_user)
	}

	if (hdls == NULL || hdls->num_hdls == 0) {
		IPAERR("bad parm\n");
		IPAERR_RL("bad parm\n");
		return -EINVAL;
	}

	mutex_lock(&ipa_ctx->lock);
	for (i = 0; i < hdls->num_hdls; i++) {
		if (__ipa_del_hdr(hdls->hdl[i].hdl, by_user)) {
			IPAERR("failed to del hdr %i\n", i);
			IPAERR_RL("failed to del hdr %i\n", i);
			hdls->hdl[i].status = -1;
		} else {
			hdls->hdl[i].status = 0;
@@ -1067,13 +1067,13 @@ int ipa2_add_hdr_proc_ctx(struct ipa_ioc_add_hdr_proc_ctx *proc_ctxs)

	if (ipa_ctx->ipa_hw_type <= IPA_HW_v2_0 ||
	    ipa_ctx->ipa_hw_type == IPA_HW_v2_6L) {
		IPAERR("Processing context not supported on IPA HW %d\n",
		IPAERR_RL("Processing context not supported on IPA HW %d\n",
			ipa_ctx->ipa_hw_type);
		return -EFAULT;
	}

	if (proc_ctxs == NULL || proc_ctxs->num_proc_ctxs == 0) {
		IPAERR("bad parm\n");
		IPAERR_RL("bad parm\n");
		return -EINVAL;
	}

@@ -1082,7 +1082,7 @@ int ipa2_add_hdr_proc_ctx(struct ipa_ioc_add_hdr_proc_ctx *proc_ctxs)
			proc_ctxs->num_proc_ctxs);
	for (i = 0; i < proc_ctxs->num_proc_ctxs; i++) {
		if (__ipa_add_hdr_proc_ctx(&proc_ctxs->proc_ctx[i], true)) {
			IPAERR("failed to add hdr pric ctx %d\n", i);
			IPAERR_RL("failed to add hdr pric ctx %d\n", i);
			proc_ctxs->proc_ctx[i].status = -1;
		} else {
			proc_ctxs->proc_ctx[i].status = 0;
@@ -1127,14 +1127,14 @@ int ipa2_del_hdr_proc_ctx_by_user(struct ipa_ioc_del_hdr_proc_ctx *hdls,
	}

	if (hdls == NULL || hdls->num_hdls == 0) {
		IPAERR("bad parm\n");
		IPAERR_RL("bad parm\n");
		return -EINVAL;
	}

	mutex_lock(&ipa_ctx->lock);
	for (i = 0; i < hdls->num_hdls; i++) {
		if (__ipa_del_hdr_proc_ctx(hdls->hdl[i].hdl, true, by_user)) {
			IPAERR("failed to del hdr %i\n", i);
			IPAERR_RL("failed to del hdr %i\n", i);
			hdls->hdl[i].status = -1;
		} else {
			hdls->hdl[i].status = 0;
@@ -1371,7 +1371,7 @@ int ipa2_get_hdr(struct ipa_ioc_get_hdr *lookup)
	}

	if (lookup == NULL) {
		IPAERR("bad parm\n");
		IPAERR_RL("bad parm\n");
		return -EINVAL;
	}
	mutex_lock(&ipa_ctx->lock);
@@ -1458,13 +1458,13 @@ int ipa2_put_hdr(u32 hdr_hdl)

	entry = ipa_id_find(hdr_hdl);
	if (entry == NULL) {
		IPAERR("lookup failed\n");
		IPAERR_RL("lookup failed\n");
		result = -EINVAL;
		goto bail;
	}

	if (entry->cookie != IPA_HDR_COOKIE) {
		IPAERR("invalid header entry\n");
		IPAERR_RL("invalid header entry\n");
		result = -EINVAL;
		goto bail;
	}
@@ -1493,7 +1493,7 @@ int ipa2_copy_hdr(struct ipa_ioc_copy_hdr *copy)
	int result = -EFAULT;

	if (copy == NULL) {
		IPAERR("bad parm\n");
		IPAERR_RL("bad parm\n");
		return -EINVAL;
	}
	mutex_lock(&ipa_ctx->lock);
+12 −0
Original line number Diff line number Diff line
@@ -68,6 +68,18 @@
#define IPAERR(fmt, args...) \
	pr_err(DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args)

#define IPAERR_RL(fmt, args...) \
	do { \
		pr_err_ratelimited(DRV_NAME " %s:%d " fmt, __func__, \
		__LINE__, ## args);\
		if (ipa_ctx) { \
			IPA_IPC_LOGGING(ipa_ctx->logbuf, \
				DRV_NAME " %s:%d " fmt, ## args); \
			IPA_IPC_LOGGING(ipa_ctx->logbuf_low, \
				DRV_NAME " %s:%d " fmt, ## args); \
		} \
	} while (0)

#define WLAN_AMPDU_TX_EP 15
#define WLAN_PROD_TX_EP  19
#define WLAN1_CONS_RX_EP  14
+3 −3
Original line number Diff line number Diff line
@@ -380,13 +380,13 @@ int ipa2_send_msg(struct ipa_msg_meta *meta, void *buff,

	if (meta == NULL || (buff == NULL && callback != NULL) ||
	    (buff != NULL && callback == NULL)) {
		IPAERR("invalid param meta=%p buff=%p, callback=%p\n",
		IPAERR_RL("invalid param meta=%p buff=%p, callback=%p\n",
		       meta, buff, callback);
		return -EINVAL;
	}

	if (meta->msg_type >= IPA_EVENT_MAX_NUM) {
		IPAERR("unsupported message type %d\n", meta->msg_type);
		IPAERR_RL("unsupported message type %d\n", meta->msg_type);
		return -EINVAL;
	}

@@ -609,7 +609,7 @@ int ipa_pull_msg(struct ipa_msg_meta *meta, char *buff, size_t count)
	int result = -EINVAL;

	if (meta == NULL || buff == NULL || !count) {
		IPAERR("invalid param name=%p buff=%p count=%zu\n",
		IPAERR_RL("invalid param name=%p buff=%p count=%zu\n",
				meta, buff, count);
		return result;
	}
Loading