summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryixuanjiang <yixuanjiang@google.com>2021-12-02 19:54:47 +0800
committerYixuan Jiang <yixuanjiang@google.com>2021-12-09 03:14:29 +0000
commitf0f2cbb2d56dc74fda71efa67c60e83c6ac0c8ca (patch)
tree2febd4221b06ba57c8f1f2a050a997ba4fe8556b
parentd980ab1a15245614b255c4fd9f0c9ade23842241 (diff)
downloadaoc-f0f2cbb2d56dc74fda71efa67c60e83c6ac0c8ca.tar.gz
aoc: fix aoc process hit null pointer
block aoc SSR free service process until aoc_process_service stop running. Bug: 207988396 Signed-off-by: yixuanjiang <yixuanjiang@google.com> Change-Id: I80366bd3559e874bef4782e3c42779d742444815
-rw-r--r--aoc.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/aoc.c b/aoc.c
index 081104b..be9532e 100644
--- a/aoc.c
+++ b/aoc.c
@@ -116,6 +116,7 @@ struct aoc_prvdata {
void *map_handler_ctx;
struct delayed_work monitor_work;
+ bool aoc_process_active;
struct device *dev;
struct iommu_domain *domain;
@@ -2190,6 +2191,9 @@ static void aoc_take_offline(struct aoc_prvdata *prvdata)
pr_notice("taking aoc offline\n");
aoc_state = AOC_STATE_OFFLINE;
+ /* wait until aoc_process_services finish */
+ while (prvdata->aoc_process_active);
+
bus_for_each_dev(&aoc_bus_type, NULL, NULL, aoc_remove_device);
if (aoc_control)
@@ -2224,8 +2228,10 @@ static void aoc_process_services(struct aoc_prvdata *prvdata, int offset)
int services;
int i;
- if (aoc_state != AOC_STATE_ONLINE)
- return;
+ if (aoc_state != AOC_STATE_ONLINE || work_busy(&prvdata->watchdog_work))
+ goto exit;
+
+ prvdata->aoc_process_active = true;
services = aoc_num_services();
for (i = 0; i < services; i++) {
@@ -2246,6 +2252,8 @@ static void aoc_process_services(struct aoc_prvdata *prvdata, int offset)
wake_up(&service_dev->write_queue);
}
}
+exit:
+ prvdata->aoc_process_active = false;
}
void aoc_set_map_handler(struct aoc_service_dev *dev, aoc_map_handler handler,