[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YWmUkD0ABryJEsU8@builder.lan>
Date: Fri, 15 Oct 2021 09:47:44 -0500
From: Bjorn Andersson <bjorn.andersson@...aro.org>
To: Deepak Kumar Singh <deesin@...eaurora.org>
Cc: clew@...eaurora.org, mathieu.poirier@...aro.org,
linux-arm-msm@...r.kernel.org, linux-remoteproc@...r.kernel.org,
linux-kernel@...r.kernel.org,
Konstantin Dorfman <kdorfman@...eaurora.org>
Subject: Re: [PATCH V1 1/6] rpmsg: glink: fix destroy channel endpoint logic
On Thu 30 Jul 00:18 CDT 2020, Deepak Kumar Singh wrote:
> From: Konstantin Dorfman <kdorfman@...eaurora.org>
>
> When rpmsg client driver destroys last channel endpoint, remove rpmsg
> device is triggered. In both cases (destroy endpoint and remove device)
> a glink close command sent to the remote peer.
>
> This change, when for removing rpmsg device endpoint already destroyed
> will avoid sending second glink close command.
>
Should it really be considered valid to rpmsg_destroy_ept() the
rpmsg_device's primary endpoint?
Do you have a use case where this makes sense?
Also, I think this has a potential to hide a problems of clients doing a
"double free" on the ept.
Regards,
Bjorn
> Signed-off-by: Konstantin Dorfman <kdorfman@...eaurora.org>
> Signed-off-by: Deepak Kumar Singh <deesin@...eaurora.org>
> ---
> drivers/rpmsg/qcom_glink_native.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c
> index 1995f5b..2668c66 100644
> --- a/drivers/rpmsg/qcom_glink_native.c
> +++ b/drivers/rpmsg/qcom_glink_native.c
> @@ -1210,6 +1210,10 @@ static void qcom_glink_destroy_ept(struct rpmsg_endpoint *ept)
> unsigned long flags;
>
> spin_lock_irqsave(&channel->recv_lock, flags);
> + if (!channel->ept.cb) {
> + spin_unlock_irqrestore(&channel->recv_lock, flags);
> + return;
> + }
> channel->ept.cb = NULL;
> spin_unlock_irqrestore(&channel->recv_lock, flags);
>
> --
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
>
Powered by blists - more mailing lists