]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
rpmsg: virtio_rpmsg_bus: fix announce for devices without endpoint
authorHenri Roosen <henri.roosen@ginzinger.com>
Fri, 2 Jun 2017 11:35:51 +0000 (13:35 +0200)
committerBjorn Andersson <bjorn.andersson@linaro.org>
Sun, 25 Jun 2017 21:35:02 +0000 (14:35 -0700)
A device might not have an endpoint assigned. This patch checks if
rpdev->ept has a value before dereferencing or using it.

Signed-off-by: Henri Roosen <henri.roosen@ginzinger.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
drivers/rpmsg/virtio_rpmsg_bus.c

index 4848da89431f4302ed4c0ab55ea3090bfb4fe40d..6ec73c6ab4b1c6b874a9de6a6e1792b480c07e0e 100644 (file)
@@ -314,7 +314,7 @@ static int virtio_rpmsg_announce_create(struct rpmsg_device *rpdev)
        int err = 0;
 
        /* need to tell remote processor's name service about this channel ? */
-       if (rpdev->announce &&
+       if (rpdev->announce && rpdev->ept &&
            virtio_has_feature(vrp->vdev, VIRTIO_RPMSG_F_NS)) {
                struct rpmsg_ns_msg nsm;
 
@@ -338,7 +338,7 @@ static int virtio_rpmsg_announce_destroy(struct rpmsg_device *rpdev)
        int err = 0;
 
        /* tell remote processor's name service we're removing this channel */
-       if (rpdev->announce &&
+       if (rpdev->announce && rpdev->ept &&
            virtio_has_feature(vrp->vdev, VIRTIO_RPMSG_F_NS)) {
                struct rpmsg_ns_msg nsm;