public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthias Kaehlcke <mka@chromium.org>
To: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: Andy Gross <agross@kernel.org>, Ohad Ben-Cohen <ohad@wizery.com>,
	linux-kernel@vger.kernel.org, Sibi Sankar <sibis@codeaurora.org>,
	Sujit Kautkar <sujitka@chromium.org>,
	Stephen Boyd <swboyd@chromium.org>,
	linux-remoteproc@vger.kernel.org,
	Mathieu Poirier <mathieu.poirier@linaro.org>
Subject: Re: [PATCH v5 2/2] rpmsg: char: Fix race between the release of rpmsg_eptdev and cdev
Date: Mon, 10 Jan 2022 10:37:18 -0800	[thread overview]
Message-ID: <Ydx83gmXczpItp81@google.com> (raw)
In-Reply-To: <Ydx4tAHSfVyz2yAX@ripper>

On Mon, Jan 10, 2022 at 10:19:32AM -0800, Bjorn Andersson wrote:
> On Mon 10 Jan 09:12 PST 2022, Matthias Kaehlcke wrote:
> 
> > struct rpmsg_eptdev contains a struct cdev. The current code frees
> > the rpmsg_eptdev struct in rpmsg_eptdev_destroy(), but the cdev is
> > a managed object, therefore its release is not predictable and the
> > rpmsg_eptdev could be freed before the cdev is entirely released.
> > 
> > The cdev_device_add/del() API was created to address this issue
> > (see commit 233ed09d7fda), use it instead of cdev add/del().
> > 
> > Fixes: c0cdc19f84a4 ("rpmsg: Driver for user space endpoint interface")
> > Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
> > ---
> > 
> > Changes in v5:
> > - patch added to the series
> > 
> >  drivers/rpmsg/rpmsg_char.c | 10 ++--------
> >  1 file changed, 2 insertions(+), 8 deletions(-)
> > 
> > diff --git a/drivers/rpmsg/rpmsg_char.c b/drivers/rpmsg/rpmsg_char.c
> > index ba85f5d11960..5bc1e6017587 100644
> > --- a/drivers/rpmsg/rpmsg_char.c
> > +++ b/drivers/rpmsg/rpmsg_char.c
> 
> There's a cdev_del() in rpmsg_eptdev_release_device() that I think needs
> to go as well, in line with patch 1.

Good catch, thanks, will fix.

      reply	other threads:[~2022-01-10 18:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-10 17:12 [PATCH v5 1/2] rpmsg: char: Fix race between the release of rpmsg_ctrldev and cdev Matthias Kaehlcke
2022-01-10 17:12 ` [PATCH v5 2/2] rpmsg: char: Fix race between the release of rpmsg_eptdev " Matthias Kaehlcke
2022-01-10 18:09   ` Mathieu Poirier
2022-01-10 18:19   ` Bjorn Andersson
2022-01-10 18:37     ` Matthias Kaehlcke [this message]

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=Ydx83gmXczpItp81@google.com \
    --to=mka@chromium.org \
    --cc=agross@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=ohad@wizery.com \
    --cc=sibis@codeaurora.org \
    --cc=sujitka@chromium.org \
    --cc=swboyd@chromium.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox