diff options
author | Shengjiu Wang <shengjiu.wang@freescale.com> | 2017-08-07 17:21:09 +0800 |
---|---|---|
committer | Jason Liu <jason.hui.liu@nxp.com> | 2019-02-12 10:27:57 +0800 |
commit | 8c533278e6f62185b976d6d49f039d87620a4c0e (patch) | |
tree | 2d19eb58a161040ec8b325998832b3bb56e59f3d /sound/soc | |
parent | 99e4471a2b77077a6602da07d7d722c8d3d7dabb (diff) |
MLK-16154: ASoC: fsl_asrc_m2m: fix crash issue with multi-instance
When open 2 instances of m2m, there is kernel dump. The reason is we
use the dev_set_drvdata to set drvdata for each instance, but each
instance share a same device, the result is drvdata will be changed
by other instances, then cause issue. so the dev_set_drvdata can't be
used, need to combine the pair data with file handler.
Fixes: 58ab1eb5b8c5 ("MLK-13945-3: ASoC: fsl_asrc: support two asrc
devices")
Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/fsl/fsl_asrc_m2m.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/sound/soc/fsl/fsl_asrc_m2m.c b/sound/soc/fsl/fsl_asrc_m2m.c index 14877b43c4e1..e1b347801688 100644 --- a/sound/soc/fsl/fsl_asrc_m2m.c +++ b/sound/soc/fsl/fsl_asrc_m2m.c @@ -761,8 +761,7 @@ static long fsl_asrc_ioctl_flush(struct fsl_asrc_pair *pair, void __user *user) static long fsl_asrc_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { - struct miscdevice *asrc_miscdev = file->private_data; - struct fsl_asrc_pair *pair = dev_get_drvdata(asrc_miscdev->this_device); + struct fsl_asrc_pair *pair = file->private_data; struct fsl_asrc *asrc_priv = pair->asrc_priv; void __user *user = (void __user *)arg; long ret = 0; @@ -833,7 +832,7 @@ static int fsl_asrc_open(struct inode *inode, struct file *file) spin_lock_init(&m2m->lock); - dev_set_drvdata(asrc_miscdev->this_device, pair); + file->private_data = pair; pm_runtime_get_sync(dev); @@ -846,8 +845,7 @@ out: static int fsl_asrc_close(struct inode *inode, struct file *file) { - struct miscdevice *asrc_miscdev = file->private_data; - struct fsl_asrc_pair *pair = dev_get_drvdata(asrc_miscdev->this_device); + struct fsl_asrc_pair *pair = file->private_data; struct fsl_asrc_m2m *m2m = pair->private; struct fsl_asrc *asrc_priv = pair->asrc_priv; struct device *dev = &asrc_priv->pdev->dev; @@ -885,6 +883,7 @@ static int fsl_asrc_close(struct inode *inode, struct file *file) kfree(m2m); kfree(pair); spin_unlock_irqrestore(&asrc_priv->lock, lock_flags); + file->private_data = NULL; pm_runtime_put_sync(dev); |