public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rpmsg: rpmsg_core: fix null-ptr dereference for devices without ops
@ 2017-06-02 11:35 Henri Roosen
  2017-06-02 21:47 ` Suman Anna
  2017-06-25 21:51 ` Bjorn Andersson
  0 siblings, 2 replies; 5+ messages in thread
From: Henri Roosen @ 2017-06-02 11:35 UTC (permalink / raw)
  To: linux-remoteproc; +Cc: Henri Roosen, Ohad Ben-Cohen, Bjorn Andersson, open list

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-06-28 19:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox