From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Henri Roosen <henri.roosen@ginzinger.com>
Cc: linux-remoteproc@vger.kernel.org,
Ohad Ben-Cohen <ohad@wizery.com>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] rpmsg: rpmsg_core: fix null-ptr dereference for devices without ops
Date: Wed, 28 Jun 2017 12:24:22 -0700 [thread overview]
Message-ID: <20170628192422.GQ18666@tuxbook> (raw)
In-Reply-To: <75ec91fa-270b-862a-6e7e-15839dff3fc8@ginzinger.com>
On Mon 26 Jun 02:04 PDT 2017, Henri Roosen wrote:
> On 06/25/2017 11:51 PM, Bjorn Andersson wrote:
> > On Fri 02 Jun 04:35 PDT 2017, Henri Roosen wrote:
> >
> > > A device might not have an ops structure registered. This
> > > patch fixes a null-prt dereference by checking ops before dereferencing
> > > it.
> > >
> >
> > In what scenario do you end up with a rpdev without ops defined?
> >
> > You need at least create_ept defined in your ops to be able to do any
> > form of communication. So it would probably make more sense to add a
> > sanity check in rpmsg_register_device(), but perhaps I'm missing
> > something.
>
> I was trying to add support for the generic rpmsg-char driver for
> virtio_rpmsg_bus.
>
> The rpmsg-char driver gets registered using rpmsg_chrdev_register_device(),
> and IMHO this device should not have any
> .ops. The chrdev is not used for communication, only for creating devices.
> The devices which should have the .ops are the ones created using the
> rpmsg-char device.
>
In order to create/open new channels from user space you need to call
rpmsg_create_ept() and this require a rpmsg_device context in order for
the communication to be associated with the appropriate link.
So we must set up the rpmsg_device context with the ops table including
create_ept() in order to maintain the reference back to the particular
virtio device (or SMD channel).
The main difference from previous implementations of this is that the
rpmsg_device does not have a primary endpoint. This removes the need for
the firmware to create a special channel to instantiate the user space
communication, but comes at the cost of the special spawning from the
individual backend drivers.
Regards,
Bjorn
prev parent reply other threads:[~2017-06-28 19:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-02 11:35 [PATCH] rpmsg: rpmsg_core: fix null-ptr dereference for devices without ops Henri Roosen
2017-06-02 21:47 ` Suman Anna
2017-06-25 21:51 ` Bjorn Andersson
2017-06-26 9:04 ` Henri Roosen
2017-06-28 19:24 ` Bjorn Andersson [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=20170628192422.GQ18666@tuxbook \
--to=bjorn.andersson@linaro.org \
--cc=henri.roosen@ginzinger.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=ohad@wizery.com \
/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