LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Arnaud Pouliquen <arnaud.pouliquen@st.com>
To: Chris Lew <clew@codeaurora.org>, <bjorn.andersson@linaro.org>,
	<andy.gross@linaro.org>, <david.brown@linaro.org>,
	<robh+dt@kernel.org>, <mark.rutland@arm.com>
Cc: <aneela@codeaurora.org>, <linux-arm-msm@vger.kernel.org>,
	<linux-remoteproc@vger.kernel.org>, <linux-soc@vger.kernel.org>,
	<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 4/6] rpmsg: Guard against null endpoint ops in destroy
Date: Mon, 30 Apr 2018 13:53:32 +0200	[thread overview]
Message-ID: <85871a63-5e7c-9769-6a76-36b1cf44f59b@st.com> (raw)
In-Reply-To: <b328de2b-f1f9-6a10-eb80-b21d4d77acc1@st.com>



On 04/30/2018 10:36 AM, Arnaud Pouliquen wrote:
> Hello Chris,
> 
> On 04/27/2018 12:59 AM, Chris Lew wrote:
>> In RPMSG GLINK the chrdev device will allocate an ept as part of the
>> rpdev creation. This device will not register endpoint ops even though
>> it has an allocated ept. Protect against the case where the device is
>> being destroyed.
>>
>> Signed-off-by: Chris Lew <clew@codeaurora.org>
>> ---
>>
>> Changes since v1:
>> - New change
>>
>>  drivers/rpmsg/rpmsg_core.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/rpmsg/rpmsg_core.c b/drivers/rpmsg/rpmsg_core.c
>> index 920a02f0462c..7bfe36afccc5 100644
>> --- a/drivers/rpmsg/rpmsg_core.c
>> +++ b/drivers/rpmsg/rpmsg_core.c
>> @@ -88,7 +88,7 @@ struct rpmsg_endpoint *rpmsg_create_ept(struct rpmsg_device *rpdev,
>>   */
>>  void rpmsg_destroy_ept(struct rpmsg_endpoint *ept)
>>  {
>> -	if (ept)
>> +	if (ept && ept->ops)
>>  		ept->ops->destroy_ept(ept);
>>  }
>>  EXPORT_SYMBOL(rpmsg_destroy_ept);
>>
> 
> Would make sense that you also add test on ept->ops->destroy_ept. I
> guess that ops may not be null while destroy_ept pointer is.

Sorry i cross checked in rpmsg_endpoint_ops. destroy_ept is required. So
my comment is not relevant.

Nevertheless do it make sense to have an endpoint without associated ops?
I don't use rpmsg_char but I tried to figure out how rpmsg_create_ept is
called in rpmsg_char without rpmsg_device ops...
Seems that qcom_glink_create_ept should be called, so  ept->ops should
point to  glink_endpoint_ops struct, right?

Another point concerns the send and try send ops that are also required.
Do you test rpmsg_trysend and/or rpmsg_send function call?
seems that you should face the same issue...

> 
> Regards
> Arnaud
> --
> To unsubscribe from this list: send the line "unsubscribe linux-remoteproc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

  reply	other threads:[~2018-04-30 11:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-26 22:58 [PATCH v3 0/6] Add chrdev and name query support for GLINK Chris Lew
2018-04-26 22:59 ` [PATCH v3 1/6] dt-bindings: soc: qcom: Add label for GLINK bindings Chris Lew
2018-04-27 17:05   ` Rob Herring
2018-04-26 22:59 ` [PATCH v3 2/6] rpmsg: glink: Store edge name for glink device Chris Lew
2018-04-26 22:59 ` [PATCH v3 3/6] rpmsg: glink: Use complete_all for open states Chris Lew
2018-04-26 22:59 ` [PATCH v3 4/6] rpmsg: Guard against null endpoint ops in destroy Chris Lew
2018-04-30  8:36   ` Arnaud Pouliquen
2018-04-30 11:53     ` Arnaud Pouliquen [this message]
2018-04-26 22:59 ` [PATCH v3 5/6] rpmsg: glink: Add support for rpmsg glink chrdev Chris Lew
2018-04-26 22:59 ` [PATCH v3 6/6] rpmsg: glink: Expose rpmsg name attr for glink Chris Lew

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=85871a63-5e7c-9769-6a76-36b1cf44f59b@st.com \
    --to=arnaud.pouliquen@st.com \
    --cc=andy.gross@linaro.org \
    --cc=aneela@codeaurora.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=clew@codeaurora.org \
    --cc=david.brown@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=linux-soc@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.org \
    --subject='Re: [PATCH v3 4/6] rpmsg: Guard against null endpoint ops in destroy' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).