From patchwork Thu Apr 26 22:59:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Lew X-Patchwork-Id: 10366997 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8B86860225 for ; Thu, 26 Apr 2018 23:01:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 85E502924B for ; Thu, 26 Apr 2018 23:01:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7A5BA29267; Thu, 26 Apr 2018 23:01:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F22B92924B for ; Thu, 26 Apr 2018 23:01:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757226AbeDZXAr (ORCPT ); Thu, 26 Apr 2018 19:00:47 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:37678 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756641AbeDZW71 (ORCPT ); Thu, 26 Apr 2018 18:59:27 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 633BB60F5F; Thu, 26 Apr 2018 22:59:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1524783567; bh=HtKuGSiXY2zjf0UyR5DCGH6lDh/uNTzl1DeQlQYjx/Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F9BgkbnvOJCr8hOanhsaF/VZAZOw6jvP5JR9KtK79D9Tk5hKwA6hoRT6DVDlJVMtC x0UA8pXImltYk3riyjLlfUkvVewDQyr8p7KP54Ht9us3ZFnak0Y8qJDs6OOGOK0wTM kipb0JI4LZFh+ncAhB7Kalbv452nEwUrZGU/oZOs= Received: from clew-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: clew@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 9384B60F6B; Thu, 26 Apr 2018 22:59:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1524783567; bh=HtKuGSiXY2zjf0UyR5DCGH6lDh/uNTzl1DeQlQYjx/Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F9BgkbnvOJCr8hOanhsaF/VZAZOw6jvP5JR9KtK79D9Tk5hKwA6hoRT6DVDlJVMtC x0UA8pXImltYk3riyjLlfUkvVewDQyr8p7KP54Ht9us3ZFnak0Y8qJDs6OOGOK0wTM kipb0JI4LZFh+ncAhB7Kalbv452nEwUrZGU/oZOs= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 9384B60F6B Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=clew@codeaurora.org From: Chris Lew To: bjorn.andersson@linaro.org, andy.gross@linaro.org, david.brown@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com Cc: aneela@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, clew@codeaurora.org Subject: [PATCH v3 4/6] rpmsg: Guard against null endpoint ops in destroy Date: Thu, 26 Apr 2018 15:59:03 -0700 Message-Id: <1524783545-21951-5-git-send-email-clew@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1524783545-21951-1-git-send-email-clew@codeaurora.org> References: <1524783545-21951-1-git-send-email-clew@codeaurora.org> Sender: linux-remoteproc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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. Signed-off-by: Chris Lew --- Changes since v1: - New change 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 920a02f0462c..7bfe36afccc5 100644 --- a/drivers/rpmsg/rpmsg_core.c +++ b/drivers/rpmsg/rpmsg_core.c @@ -88,7 +88,7 @@ struct rpmsg_endpoint *rpmsg_create_ept(struct rpmsg_device *rpdev, */ void rpmsg_destroy_ept(struct rpmsg_endpoint *ept) { - if (ept) + if (ept && ept->ops) ept->ops->destroy_ept(ept); } EXPORT_SYMBOL(rpmsg_destroy_ept);