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

Commit 7a0b95c7 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: ipa3: add lock for num_q6_rule"

parents 91ac35dc 678c35ab
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -398,12 +398,15 @@ int copy_ul_filter_rule_to_ipa(struct ipa_install_fltr_rule_req_msg_v01
{
	int i, j;

	/* prevent multi-threads accessing num_q6_rule */
	mutex_lock(&add_mux_channel_lock);
	if (rule_req->filter_spec_list_valid == true) {
		num_q6_rule = rule_req->filter_spec_list_len;
		IPAWANDBG("Received (%d) install_flt_req\n", num_q6_rule);
	} else {
		num_q6_rule = 0;
		IPAWANERR("got no UL rules from modem\n");
		mutex_unlock(&add_mux_channel_lock);
		return -EINVAL;
	}

@@ -597,9 +600,11 @@ failure:
	num_q6_rule = 0;
	memset(ipa_qmi_ctx->q6_ul_filter_rule, 0,
		sizeof(ipa_qmi_ctx->q6_ul_filter_rule));
	mutex_unlock(&add_mux_channel_lock);
	return -EINVAL;

success:
	mutex_unlock(&add_mux_channel_lock);
	return 0;
}

@@ -1504,9 +1509,12 @@ static int ipa_wwan_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
				/* already got Q6 UL filter rules*/
				if (ipa_qmi_ctx &&
					ipa_qmi_ctx->modem_cfg_emb_pipe_flt
					== false)
					== false) {
					/* protect num_q6_rule */
					mutex_lock(&add_mux_channel_lock);
					rc = wwan_add_ul_flt_rule_to_ipa();
				else
					mutex_unlock(&add_mux_channel_lock);
				} else
					rc = 0;
				egress_set = true;
				if (rc)
+14 −1
Original line number Diff line number Diff line
@@ -416,6 +416,8 @@ int ipa3_copy_ul_filter_rule_to_ipa(struct ipa_install_fltr_rule_req_msg_v01
{
	int i, j;

	/* prevent multi-threads accessing rmnet_ipa3_ctx->num_q6_rules */
	mutex_lock(&rmnet_ipa3_ctx->add_mux_channel_lock);
	if (rule_req->filter_spec_ex_list_valid == true) {
		rmnet_ipa3_ctx->num_q6_rules =
			rule_req->filter_spec_ex_list_len;
@@ -424,6 +426,8 @@ int ipa3_copy_ul_filter_rule_to_ipa(struct ipa_install_fltr_rule_req_msg_v01
	} else {
		rmnet_ipa3_ctx->num_q6_rules = 0;
		IPAWANERR("got no UL rules from modem\n");
		mutex_unlock(&rmnet_ipa3_ctx->
					add_mux_channel_lock);
		return -EINVAL;
	}

@@ -626,9 +630,13 @@ failure:
	rmnet_ipa3_ctx->num_q6_rules = 0;
	memset(ipa3_qmi_ctx->q6_ul_filter_rule, 0,
		sizeof(ipa3_qmi_ctx->q6_ul_filter_rule));
	mutex_unlock(&rmnet_ipa3_ctx->
		add_mux_channel_lock);
	return -EINVAL;

success:
	mutex_unlock(&rmnet_ipa3_ctx->
		add_mux_channel_lock);
	return 0;
}

@@ -1324,8 +1332,13 @@ static int handle3_egress_format(struct net_device *dev,

	if (rmnet_ipa3_ctx->num_q6_rules != 0) {
		/* already got Q6 UL filter rules*/
		if (ipa3_qmi_ctx->modem_cfg_emb_pipe_flt == false)
		if (ipa3_qmi_ctx->modem_cfg_emb_pipe_flt == false) {
			/* prevent multi-threads accessing num_q6_rules */
			mutex_lock(&rmnet_ipa3_ctx->add_mux_channel_lock);
			rc = ipa3_wwan_add_ul_flt_rule_to_ipa();
			mutex_unlock(&rmnet_ipa3_ctx->
				add_mux_channel_lock);
		}
		if (rc)
			IPAWANERR("install UL rules failed\n");
		else