From 8366735ec4b2faf01a35a7399e04fa3e5108935d Mon Sep 17 00:00:00 2001 From: Chris Lew Date: Wed, 20 May 2020 15:09:36 +0530 Subject: [PATCH] FROMLIST: rpmsg: Guard against null endpoint ops in destroy In RPMSG GLINK the chrdev device will allocate an ept as part of the rpdev creation. This device will not register endpoint ops even though it has an allocated ept. Protect against the case where the device is being destroyed. Bug: 163076767 Link: https://lore.kernel.org/lkml/1593017121-7953-3-git-send-email-deesin@codeaurora.org/ Change-Id: I66d9f893c3d4ed97489cba3791d540301408f0ee Signed-off-by: Chris Lew Signed-off-by: Greg Kroah-Hartman --- 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 739cb61c464c..a3c25bbf71cd 100644 --- a/drivers/rpmsg/rpmsg_core.c +++ b/drivers/rpmsg/rpmsg_core.c @@ -81,7 +81,7 @@ EXPORT_SYMBOL(rpmsg_create_ept); */ void rpmsg_destroy_ept(struct rpmsg_endpoint *ept) { - if (ept) + if (ept && ept->ops) ept->ops->destroy_ept(ept); } EXPORT_SYMBOL(rpmsg_destroy_ept);