aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaggie White <maggiewhite@google.com>2019-02-07 16:32:09 -0800
committerMaggie White <maggiewhite@google.com>2019-02-07 16:32:09 -0800
commit9db9532ae32d13333d5f394e5775fb99fafaad45 (patch)
treeee61800ccb06c0de1f8c1fb21afb7c243362fb95
parent7c022c6439e10b4ecd6d7daded3da5f5f1901cc9 (diff)
parente7bc8d2654db594b751ef7b5d83b67d73d4f1aca (diff)
Merge branch 'android-msm-wahoo-4.4-pi-qpr1' into android-msm-wahoo-4.4-pi-qpr2android-9.0.0_r0.72
APR 2019.3 Bug: 123655259 Change-Id: I3b46e61242a14b6e758af3db21d213edfc0ec37b Signed-off-by: Maggie White <maggiewhite@google.com>
-rw-r--r--drivers/staging/qcacld-3.0/core/hdd/src/wlan_hdd_cfg80211.c23
-rw-r--r--include/linux/perf_event.h2
-rw-r--r--kernel/events/core.c15
3 files changed, 35 insertions, 5 deletions
diff --git a/drivers/staging/qcacld-3.0/core/hdd/src/wlan_hdd_cfg80211.c b/drivers/staging/qcacld-3.0/core/hdd/src/wlan_hdd_cfg80211.c
index c410f7ff953e..a4da4242a2c8 100644
--- a/drivers/staging/qcacld-3.0/core/hdd/src/wlan_hdd_cfg80211.c
+++ b/drivers/staging/qcacld-3.0/core/hdd/src/wlan_hdd_cfg80211.c
@@ -9187,6 +9187,7 @@ __wlan_hdd_cfg80211_avoid_freq(struct wiphy *wiphy,
uint16_t unsafe_channel_index, local_unsafe_list_count;
tHddAvoidFreqList *channel_list;
enum tQDF_GLOBAL_CON_MODE curr_mode;
+ u8 num_args = 0;
ENTER_DEV(wdev->netdev);
@@ -9204,11 +9205,27 @@ __wlan_hdd_cfg80211_avoid_freq(struct wiphy *wiphy,
ret = wlan_hdd_validate_context(hdd_ctx);
if (0 != ret)
return ret;
+ if (!data || data_len < (sizeof(channel_list->avoidFreqRangeCount) +
+ sizeof(tHddAvoidFreqRange))) {
+ hdd_err("Avoid frequency channel list empty");
+ return -EINVAL;
+ }
+ num_args = (data_len - sizeof(channel_list->avoidFreqRangeCount)) /
+ sizeof(channel_list->avoidFreqRange[0].startFreq);
+
+ if (num_args < 2 || num_args > HDD_MAX_AVOID_FREQ_RANGES * 2 ||
+ num_args % 2 != 0) {
+ hdd_err("Invalid avoid frequency channel list");
+ return -EINVAL;
+ }
channel_list = (tHddAvoidFreqList *)data;
- if (!channel_list) {
- hdd_log(QDF_TRACE_LEVEL_ERROR,
- "Avoid frequency channel list empty");
+
+ if (channel_list->avoidFreqRangeCount == 0 ||
+ channel_list->avoidFreqRangeCount > HDD_MAX_AVOID_FREQ_RANGES ||
+ 2 * channel_list->avoidFreqRangeCount != num_args) {
+ hdd_err("Invalid frequency range count %d",
+ channel_list->avoidFreqRangeCount);
return -EINVAL;
}
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index f501b8c0de4e..efce166a9f17 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -231,7 +231,7 @@ struct pmu {
int capabilities;
int * __percpu pmu_disable_count;
- struct perf_cpu_context * __percpu pmu_cpu_context;
+ struct perf_cpu_context __percpu *pmu_cpu_context;
atomic_t exclusive_cnt; /* < 0: cpu; > 0: tsk */
int task_ctx_nr;
int hrtimer_interval_ms;
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 3449efaf0ce6..4d8fb3c83ed4 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -9657,13 +9657,26 @@ static void __perf_event_stop_swclock(void *__info)
static void perf_event_exit_cpu_context(int cpu)
{
+ struct perf_cpu_context *cpuctx;
struct perf_event_context *ctx;
+ unsigned long flags;
struct pmu *pmu;
int idx;
idx = srcu_read_lock(&pmus_srcu);
list_for_each_entry_rcu(pmu, &pmus, entry) {
- ctx = &per_cpu_ptr(pmu->pmu_cpu_context, cpu)->ctx;
+ cpuctx = per_cpu_ptr(pmu->pmu_cpu_context, cpu);
+ ctx = &cpuctx->ctx;
+
+ /* Cancel the mux hrtimer to avoid CPU migration */
+ if (pmu->task_ctx_nr != perf_sw_context) {
+ raw_spin_lock_irqsave(&cpuctx->hrtimer_lock, flags);
+ hrtimer_cancel(&cpuctx->hrtimer);
+ cpuctx->hrtimer_active = 0;
+ raw_spin_unlock_irqrestore(&cpuctx->hrtimer_lock,
+ flags);
+ }
+
mutex_lock(&ctx->mutex);
/*
* If keeping events across hotplugging is supported, do not