Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1656148 > unrolled thread

[PATCH] rpmsg: rpmsg_core: fix null-ptr dereference for devices without ops

Started byHenri Roosen <henri.roosen@ginzinger.com>
First post2017-06-02 13:40 +0200
Last post2017-06-02 23:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] rpmsg: rpmsg_core: fix null-ptr dereference for devices without ops Henri Roosen <henri.roosen@ginzinger.com> - 2017-06-02 13:40 +0200
    Re: [PATCH] rpmsg: rpmsg_core: fix null-ptr dereference for devices  without ops Suman Anna <s-anna@ti.com> - 2017-06-02 23:50 +0200

#1656148 — [PATCH] rpmsg: rpmsg_core: fix null-ptr dereference for devices without ops

FromHenri Roosen <henri.roosen@ginzinger.com>
Date2017-06-02 13:40 +0200
Subject[PATCH] rpmsg: rpmsg_core: fix null-ptr dereference for devices without ops
Message-ID<tNT5T-rX-15@gated-at.bofh.it>
A device might not have an ops structure registered. This
patch fixes a null-prt dereference by checking ops before dereferencing
it.

Signed-off-by: Henri Roosen <henri.roosen@ginzinger.com>
---
 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 600f5f9..0c48452 100644
--- a/drivers/rpmsg/rpmsg_core.c
+++ b/drivers/rpmsg/rpmsg_core.c
@@ -429,7 +429,7 @@ static int rpmsg_dev_probe(struct device *dev)
 		goto out;
 	}
 
-	if (rpdev->ops->announce_create)
+	if (rpdev->ops && rpdev->ops->announce_create)
 		err = rpdev->ops->announce_create(rpdev);
 out:
 	return err;
-- 
2.1.4

[toc] | [next] | [standalone]


#1656581 — Re: [PATCH] rpmsg: rpmsg_core: fix null-ptr dereference for devices without ops

FromSuman Anna <s-anna@ti.com>
Date2017-06-02 23:50 +0200
SubjectRe: [PATCH] rpmsg: rpmsg_core: fix null-ptr dereference for devices without ops
Message-ID<tO2Cd-6B6-3@gated-at.bofh.it>
In reply to#1656148
Hi Henri,

On 06/02/2017 06:35 AM, Henri Roosen wrote:
> A device might not have an ops structure registered. This

The rpmsg devices are registered from the respective backends, which are
supposed to plug in their ops. What is the scenario where you think
these ops might not be populated? We ought to check for NULL ops in
rpmsg_register_device in fact to make sure an ops pointer is supplied.

regards
Suman

> patch fixes a null-prt dereference by checking ops before dereferencing
> it.
> 
> Signed-off-by: Henri Roosen <henri.roosen@ginzinger.com>
> ---
>  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 600f5f9..0c48452 100644
> --- a/drivers/rpmsg/rpmsg_core.c
> +++ b/drivers/rpmsg/rpmsg_core.c
> @@ -429,7 +429,7 @@ static int rpmsg_dev_probe(struct device *dev)
>  		goto out;
>  	}
>  
> -	if (rpdev->ops->announce_create)
> +	if (rpdev->ops && rpdev->ops->announce_create)
>  		err = rpdev->ops->announce_create(rpdev);
>  out:
>  	return err;
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web