aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2018-01-19 08:22:36 -0500
committerBjorn Andersson <bjorn.andersson@linaro.org>2018-01-19 10:04:33 -0500
commitc3388a075c8ac568f892c40bec919ba8ac4077f0 (patch)
tree79f0edf21d846df03b3d9e9aafd888084d7d28b8
parentfb416f69900773d5a6030c909114099f92d07ab9 (diff)
rpmsg: smd: Fix double unlock in __qcom_smd_send()
We're not holding the lock here, so we shouldn't unlock. Fixes: 178f3f75bb4e ("rpmsg: smd: Don't hold the tx lock during wait") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> [bjorn: renamed "out" label to further distinguish the two exit paths] Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
-rw-r--r--drivers/rpmsg/qcom_smd.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/rpmsg/qcom_smd.c b/drivers/rpmsg/qcom_smd.c
index 10870189c0c8..e92fd0129658 100644
--- a/drivers/rpmsg/qcom_smd.c
+++ b/drivers/rpmsg/qcom_smd.c
@@ -747,7 +747,7 @@ static int __qcom_smd_send(struct qcom_smd_channel *channel, const void *data,
747 channel->state == SMD_CHANNEL_OPENED) { 747 channel->state == SMD_CHANNEL_OPENED) {
748 if (!wait) { 748 if (!wait) {
749 ret = -EAGAIN; 749 ret = -EAGAIN;
750 goto out; 750 goto out_unlock;
751 } 751 }
752 752
753 SET_TX_CHANNEL_FLAG(channel, fBLOCKREADINTR, 0); 753 SET_TX_CHANNEL_FLAG(channel, fBLOCKREADINTR, 0);
@@ -759,11 +759,11 @@ static int __qcom_smd_send(struct qcom_smd_channel *channel, const void *data,
759 qcom_smd_get_tx_avail(channel) >= tlen || 759 qcom_smd_get_tx_avail(channel) >= tlen ||
760 channel->state != SMD_CHANNEL_OPENED); 760 channel->state != SMD_CHANNEL_OPENED);
761 if (ret) 761 if (ret)
762 goto out; 762 return ret;
763 763
764 ret = mutex_lock_interruptible(&channel->tx_lock); 764 ret = mutex_lock_interruptible(&channel->tx_lock);
765 if (ret) 765 if (ret)
766 goto out; 766 return ret;
767 767
768 SET_TX_CHANNEL_FLAG(channel, fBLOCKREADINTR, 1); 768 SET_TX_CHANNEL_FLAG(channel, fBLOCKREADINTR, 1);
769 } 769 }
@@ -771,7 +771,7 @@ static int __qcom_smd_send(struct qcom_smd_channel *channel, const void *data,
771 /* Fail if the channel was closed */ 771 /* Fail if the channel was closed */
772 if (channel->state != SMD_CHANNEL_OPENED) { 772 if (channel->state != SMD_CHANNEL_OPENED) {
773 ret = -EPIPE; 773 ret = -EPIPE;
774 goto out; 774 goto out_unlock;
775 } 775 }
776 776
777 SET_TX_CHANNEL_FLAG(channel, fTAIL, 0); 777 SET_TX_CHANNEL_FLAG(channel, fTAIL, 0);
@@ -786,7 +786,7 @@ static int __qcom_smd_send(struct qcom_smd_channel *channel, const void *data,
786 786
787 qcom_smd_signal_channel(channel); 787 qcom_smd_signal_channel(channel);
788 788
789out: 789out_unlock:
790 mutex_unlock(&channel->tx_lock); 790 mutex_unlock(&channel->tx_lock);
791 791
792 return ret; 792 return ret;