asoc: fix error handling logic to avoid potential deadlock
IOCTL command "SNDRV_LSM_EVENT_STATUS_V3_32" in msm_lsm_ioctl_compat has an incorrect error handling logic which can cause mutex deadlock. Change this logic to avoid potential mutex deadlock. Change-Id: I19b3509b5d40cff555536e4615132ea8c477d451 Signed-off-by: Xiaoyu Ye <benyxy@codeaurora.org>
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

parent
40bf8e8940
commit
7e2bf00784
@@ -1368,7 +1368,8 @@ static int msm_lsm_ioctl_compat(struct snd_pcm_substream *substream,
|
|||||||
if (copy_from_user(&userarg32, arg, sizeof(userarg32))) {
|
if (copy_from_user(&userarg32, arg, sizeof(userarg32))) {
|
||||||
dev_err(rtd->dev, "%s: err copyuser ioctl %s\n",
|
dev_err(rtd->dev, "%s: err copyuser ioctl %s\n",
|
||||||
__func__, "SNDRV_LSM_EVENT_STATUS_V3_32");
|
__func__, "SNDRV_LSM_EVENT_STATUS_V3_32");
|
||||||
return -EFAULT;
|
err = -EINVAL;
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (userarg32.payload_size >
|
if (userarg32.payload_size >
|
||||||
@@ -1376,7 +1377,8 @@ static int msm_lsm_ioctl_compat(struct snd_pcm_substream *substream,
|
|||||||
pr_err("%s: payload_size %d is invalid, max allowed = %d\n",
|
pr_err("%s: payload_size %d is invalid, max allowed = %d\n",
|
||||||
__func__, userarg32.payload_size,
|
__func__, userarg32.payload_size,
|
||||||
LISTEN_MAX_STATUS_PAYLOAD_SIZE);
|
LISTEN_MAX_STATUS_PAYLOAD_SIZE);
|
||||||
return -EINVAL;
|
err = -EINVAL;
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
size = sizeof(*user) + userarg32.payload_size;
|
size = sizeof(*user) + userarg32.payload_size;
|
||||||
@@ -1385,7 +1387,8 @@ static int msm_lsm_ioctl_compat(struct snd_pcm_substream *substream,
|
|||||||
dev_err(rtd->dev,
|
dev_err(rtd->dev,
|
||||||
"%s: Allocation failed event status size %d\n",
|
"%s: Allocation failed event status size %d\n",
|
||||||
__func__, size);
|
__func__, size);
|
||||||
return -EFAULT;
|
err = -ENOMEM;
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
cmd = SNDRV_LSM_EVENT_STATUS_V3;
|
cmd = SNDRV_LSM_EVENT_STATUS_V3;
|
||||||
user->payload_size = userarg32.payload_size;
|
user->payload_size = userarg32.payload_size;
|
||||||
|
Reference in New Issue
Block a user