qcacmn: Use global variable for cpumask
Local variable is used to store cpumask to send it to irq_set_affinity_hint and qdf_dev_set_irq_affinity APIs. This memory is used by the kernel later outside the current contect resulting in invalid memory access. Fix this by using global variables to store cpumask. Change-Id: I086f40bf1b3499d2c2ccb1ce18140b2dc2761d04 CRs-Fixed: 2373548
This commit is contained in:

committed by
nshrivas

parent
d2dad4b5bd
commit
ee84fbeea2
@@ -190,6 +190,7 @@ struct qca_napi_info {
|
||||
uint8_t id;
|
||||
uint8_t cpu;
|
||||
int irq;
|
||||
cpumask_t cpumask;
|
||||
struct qca_napi_stat stats[NR_CPUS];
|
||||
#ifdef RECEIVE_OFFLOAD
|
||||
/* will only be present for data rx CE's */
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
* any purpose with or without fee is hereby granted, provided that the
|
||||
@@ -20,7 +20,7 @@
|
||||
#define __HIF_EXEC_H__
|
||||
|
||||
#include <hif.h>
|
||||
|
||||
#include <linux/cpumask.h>
|
||||
|
||||
struct hif_exec_context;
|
||||
|
||||
@@ -55,6 +55,7 @@ struct hif_exec_context {
|
||||
uint32_t numirq;
|
||||
uint32_t irq[HIF_MAX_GRP_IRQ];
|
||||
uint32_t os_irq[HIF_MAX_GRP_IRQ];
|
||||
cpumask_t cpumask;
|
||||
uint32_t grp_id;
|
||||
uint32_t scale_bin_shift;
|
||||
const char *context_name;
|
||||
|
@@ -249,22 +249,21 @@ static int hncm_exec_migrate_to(struct qca_napi_data *napid, uint8_t ctx_id,
|
||||
int rc = 0;
|
||||
int status = 0;
|
||||
int ind;
|
||||
cpumask_t cpumask;
|
||||
|
||||
|
||||
NAPI_DEBUG("-->%s(napi_cd=%d, didx=%d)", __func__, napi_ce, didx);
|
||||
|
||||
cpumask.bits[0] = (1 << didx);
|
||||
exec_ctx = hif_exec_get_ctx(&napid->hif_softc->osc, ctx_id);
|
||||
if (exec_ctx == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
exec_ctx->cpumask.bits[0] = (1 << didx);
|
||||
|
||||
for (ind = 0; ind < exec_ctx->numirq; ind++) {
|
||||
if (exec_ctx->os_irq[ind]) {
|
||||
irq_modify_status(exec_ctx->os_irq[ind],
|
||||
IRQ_NO_BALANCING, 0);
|
||||
rc = irq_set_affinity_hint(exec_ctx->os_irq[ind],
|
||||
&cpumask);
|
||||
&exec_ctx->cpumask);
|
||||
if (rc)
|
||||
status = rc;
|
||||
}
|
||||
|
@@ -814,7 +814,6 @@ bool hif_napi_correct_cpu(struct qca_napi_info *napi_info)
|
||||
{
|
||||
bool right_cpu = true;
|
||||
int rc = 0;
|
||||
cpumask_t cpumask;
|
||||
int cpu;
|
||||
struct qca_napi_data *napid;
|
||||
QDF_STATUS ret;
|
||||
@@ -830,12 +829,12 @@ bool hif_napi_correct_cpu(struct qca_napi_info *napi_info)
|
||||
right_cpu = false;
|
||||
|
||||
NAPI_DEBUG("interrupt on wrong CPU, correcting");
|
||||
cpumask.bits[0] = (0x01 << napi_info->cpu);
|
||||
napi_info->cpumask.bits[0] = (0x01 << napi_info->cpu);
|
||||
|
||||
irq_modify_status(napi_info->irq, IRQ_NO_BALANCING, 0);
|
||||
ret = qdf_dev_set_irq_affinity(napi_info->irq,
|
||||
(struct qdf_cpu_mask *)
|
||||
&cpumask);
|
||||
&napi_info->cpumask);
|
||||
rc = qdf_status_to_os_return(ret);
|
||||
irq_modify_status(napi_info->irq, 0, IRQ_NO_BALANCING);
|
||||
|
||||
@@ -1472,18 +1471,19 @@ static int hncm_migrate_to(struct qca_napi_data *napid,
|
||||
int didx)
|
||||
{
|
||||
int rc = 0;
|
||||
cpumask_t cpumask;
|
||||
QDF_STATUS status;
|
||||
|
||||
NAPI_DEBUG("-->%s(napi_cd=%d, didx=%d)", __func__, napi_ce, didx);
|
||||
|
||||
cpumask.bits[0] = (1 << didx);
|
||||
if (!napid->napis[napi_ce])
|
||||
return -EINVAL;
|
||||
|
||||
napid->napis[napi_ce]->cpumask.bits[0] = (1 << didx);
|
||||
|
||||
irq_modify_status(napid->napis[napi_ce]->irq, IRQ_NO_BALANCING, 0);
|
||||
status = qdf_dev_set_irq_affinity(napid->napis[napi_ce]->irq,
|
||||
(struct qdf_cpu_mask *)&cpumask);
|
||||
(struct qdf_cpu_mask *)
|
||||
&napid->napis[napi_ce]->cpumask);
|
||||
rc = qdf_status_to_os_return(status);
|
||||
|
||||
/* unmark the napis bitmap in the cpu table */
|
||||
|
Reference in New Issue
Block a user