diff options
author | Arun Kumar Neelakantam <aneela@codeaurora.org> | 2020-07-30 10:48:14 +0530 |
---|---|---|
committer | Bjorn Andersson <bjorn.andersson@linaro.org> | 2021-10-15 11:00:32 -0500 |
commit | c7c182d4447e172f87e37d6c04879b94b8635b37 (patch) | |
tree | 42de0b112df314b7a34f533595ea6bf5b97b3d7e /drivers/rpmsg | |
parent | 8956927faed366b60b0355f4a4317a10e281ced7 (diff) | |
download | linux-stable-c7c182d4447e172f87e37d6c04879b94b8635b37.tar.gz linux-stable-c7c182d4447e172f87e37d6c04879b94b8635b37.tar.bz2 linux-stable-c7c182d4447e172f87e37d6c04879b94b8635b37.zip |
rpmsg: glink: Remove the rpmsg dev in close_ack
Un-register and register of rpmsg driver is sending invalid open_ack
on closed channel.
To avoid sending invalid open_ack case unregister the rpmsg device
after receiving the local_close_ack from remote side.
Signed-off-by: Deepak Kumar Singh <deesin@codeaurora.org>
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
[bjorn: s/strlcpy/strscpy/]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/1596086296-28529-5-git-send-email-deesin@codeaurora.org
Diffstat (limited to 'drivers/rpmsg')
-rw-r--r-- | drivers/rpmsg/qcom_glink_native.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c index c525f667286d..ac710dc03710 100644 --- a/drivers/rpmsg/qcom_glink_native.c +++ b/drivers/rpmsg/qcom_glink_native.c @@ -1524,6 +1524,7 @@ static void qcom_glink_rx_close(struct qcom_glink *glink, unsigned int rcid) rpmsg_unregister_device(glink->dev, &chinfo); } + channel->rpdev = NULL; qcom_glink_send_close_ack(glink, channel->rcid); @@ -1537,6 +1538,7 @@ static void qcom_glink_rx_close(struct qcom_glink *glink, unsigned int rcid) static void qcom_glink_rx_close_ack(struct qcom_glink *glink, unsigned int lcid) { + struct rpmsg_channel_info chinfo; struct glink_channel *channel; unsigned long flags; @@ -1551,6 +1553,16 @@ static void qcom_glink_rx_close_ack(struct qcom_glink *glink, unsigned int lcid) channel->lcid = 0; spin_unlock_irqrestore(&glink->idr_lock, flags); + /* Decouple the potential rpdev from the channel */ + if (channel->rpdev) { + strscpy(chinfo.name, channel->name, sizeof(chinfo.name)); + chinfo.src = RPMSG_ADDR_ANY; + chinfo.dst = RPMSG_ADDR_ANY; + + rpmsg_unregister_device(glink->dev, &chinfo); + } + channel->rpdev = NULL; + kref_put(&channel->refcount, qcom_glink_channel_release); } |