Skip to content

Commit

Permalink
rpmsg: smd: Fix double unlock in __qcom_smd_send()
Browse files Browse the repository at this point in the history
We're not holding the lock here, so we shouldn't unlock.

Fixes: 178f3f7 ("rpmsg: smd: Don't hold the tx lock during wait")
Signed-off-by: Dan Carpenter <[email protected]>
[bjorn: renamed "out" label to further distinguish the two exit paths]
Signed-off-by: Bjorn Andersson <[email protected]>
  • Loading branch information
Dan Carpenter authored and andersson committed Jan 19, 2018
1 parent fb416f6 commit c3388a0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions drivers/rpmsg/qcom_smd.c
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ static int __qcom_smd_send(struct qcom_smd_channel *channel, const void *data,
channel->state == SMD_CHANNEL_OPENED) {
if (!wait) {
ret = -EAGAIN;
goto out;
goto out_unlock;
}

SET_TX_CHANNEL_FLAG(channel, fBLOCKREADINTR, 0);
Expand All @@ -759,19 +759,19 @@ static int __qcom_smd_send(struct qcom_smd_channel *channel, const void *data,
qcom_smd_get_tx_avail(channel) >= tlen ||
channel->state != SMD_CHANNEL_OPENED);
if (ret)
goto out;
return ret;

ret = mutex_lock_interruptible(&channel->tx_lock);
if (ret)
goto out;
return ret;

SET_TX_CHANNEL_FLAG(channel, fBLOCKREADINTR, 1);
}

/* Fail if the channel was closed */
if (channel->state != SMD_CHANNEL_OPENED) {
ret = -EPIPE;
goto out;
goto out_unlock;
}

SET_TX_CHANNEL_FLAG(channel, fTAIL, 0);
Expand All @@ -786,7 +786,7 @@ static int __qcom_smd_send(struct qcom_smd_channel *channel, const void *data,

qcom_smd_signal_channel(channel);

out:
out_unlock:
mutex_unlock(&channel->tx_lock);

return ret;
Expand Down

0 comments on commit c3388a0

Please sign in to comment.