diff options
| author | Domi Papoi <dpapoi@codeaurora.org> | 2016-02-12 13:22:31 -0500 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2017-06-08 22:10:41 -0700 |
| commit | bcfb8150a0e8705eeae426efd2ed11bcf6121b9a (patch) | |
| tree | 26255cc2f7658b51948ccf7ff951f038ac4e760c | |
| parent | 96befb971f9b7f73a0d3e90efe5b65d45319dae8 (diff) | |
msm: BA: Fix race condition with v4l2 event handler
The v4l2 event handler struct should be initialized
before added to the dev_ctxt->instances list.
The v4l2 event handler struct should be de-initialized
after we remove inst from the core->instances list.
Change-Id: I1faf6bab4232bbcd2ca567a9a11b0c8faa2f45ce
Signed-off-by: Domi Papoi <dpapoi@codeaurora.org>
| -rw-r--r-- | drivers/video/msm/ba/msm_ba.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/video/msm/ba/msm_ba.c b/drivers/video/msm/ba/msm_ba.c index 1a03767be228..559feeeaed9e 100644 --- a/drivers/video/msm/ba/msm_ba.c +++ b/drivers/video/msm/ba/msm_ba.c @@ -773,6 +773,8 @@ void *msm_ba_open(const struct msm_ba_ext_ops *ext_ops) inst->sd = list_first_entry(&(inst->dev_ctxt->v4l2_dev.subdevs), struct v4l2_subdev, list); + msm_ba_setup_event_queue(inst, dev_ctxt->vdev); + mutex_lock(&dev_ctxt->dev_cs); list_add_tail(&inst->list, &dev_ctxt->instances); mutex_unlock(&dev_ctxt->dev_cs); @@ -788,8 +790,6 @@ void *msm_ba_open(const struct msm_ba_ext_ops *ext_ops) inst->ext_ops = ext_ops; - msm_ba_setup_event_queue(inst, dev_ctxt->vdev); - return inst; } EXPORT_SYMBOL(msm_ba_open); @@ -805,7 +805,6 @@ int msm_ba_close(void *instance) if (!inst) return -EINVAL; - v4l2_fh_del(&inst->event_handler); dev_ctxt = inst->dev_ctxt; mutex_lock(&dev_ctxt->dev_cs); @@ -818,6 +817,10 @@ int msm_ba_close(void *instance) mutex_unlock(&dev_ctxt->dev_cs); msm_ba_ctrl_deinit(inst); + + v4l2_fh_del(&inst->event_handler); + v4l2_fh_exit(&inst->event_handler); + debugfs_remove_recursive(inst->debugfs_root); dprintk(BA_DBG, "Closed BA instance: %p", inst); |
