Skip to content
Snippets Groups Projects
Commit a9d63d6f authored by Skylar Chang's avatar Skylar Chang Committed by Siyuan Zhou
Browse files

msm: ipa3: add lock for num_q6_rule


There is a race condition be observed
on global variable num_q6_rule used in
ipa wan-driver. The fix is to add lock
to prevent different threads are accessing
it at the same time.

Bug: 68992477
Change-Id: Ia9190c60361cb5605b61963309beca3acdeac89d
Signed-off-by: default avatarSkylar Chang <chiaweic@codeaurora.org>
parent 05007d34
Branches
Tags
No related merge requests found
......@@ -375,12 +375,15 @@ int copy_ul_filter_rule_to_ipa(struct ipa_install_fltr_rule_req_msg_v01
{
int rc = 0, 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;
}
/* copy UL filter rules from Modem*/
......@@ -539,6 +542,7 @@ int copy_ul_filter_rule_to_ipa(struct ipa_install_fltr_rule_req_msg_v01
ipv4_frag_eq_present = rule_req->filter_spec_list[i].
filter_rule.ipv4_frag_eq_present;
}
mutex_unlock(&add_mux_channel_lock);
return rc;
}
......@@ -1329,8 +1333,11 @@ static int ipa_wwan_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
IPAWANERR("failed to config egress endpoint\n");
if (num_q6_rule != 0) {
/* protect num_q6_rule */
mutex_lock(&add_mux_channel_lock);
/* already got Q6 UL filter rules*/
rc = wwan_add_ul_flt_rule_to_ipa();
mutex_unlock(&add_mux_channel_lock);
egress_set = true;
if (rc)
IPAWANERR("install UL rules failed\n");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment