Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp250163ybk; Tue, 12 May 2020 22:12:27 -0700 (PDT) X-Google-Smtp-Source: APiQypKUiAM0Xj59VE0lwq0O/h1+sPl/9bis1LzMSVKMOo2GR1melGiafdd6VGfDbWD2ni6FQMUI X-Received: by 2002:a17:906:3605:: with SMTP id q5mr21056406ejb.363.1589346747102; Tue, 12 May 2020 22:12:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589346747; cv=none; d=google.com; s=arc-20160816; b=afDWhfRWeS4pGYJPm0hoyPXOOD33REbj64le4GIcLnKEClO0mZjtN4M6/LDV0ktGL1 m6zOVGHDDnmLWr7G2YHAHeuRfYO9X9v7RdIGloxxiLm1B0zDjGVqwne4P+YVWTsRuzvT Vz7uCl3h9aHVDfBHKEgG3ZoUpuAbC7wI4rDsGawcxP/youjsJ+aYwfFZq0q1nnRura0D CAGUswNlLjcqrrKx0wtTxot7pLZ4W8uLxeJpKcjbdeKlgEIvpgw3a4eZX57VAybKXNNf Gpj/AMYY/pBq5iTKIsuWJrzELcVFt/J59r1WbFbGbEhvDqnk2rK8bEY/cZaSTzCpzEm5 7w0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature; bh=QvCnssNRyOaZbTIUEafb9UtFFPJxVfsGVnlMsbWACNk=; b=I+SWtcaeVLOOqQep8F8K9yCUTn7RER0WTx8OdzBsX8eneZ4z78NLc0C4VLNO9Jmd2n YCPhXpbBBsYF26GoZO65tpZyZgZfSfzubELvBrkrQL5s0HrpotjcfmvWN0+hoKmfz3ek vXQTQWX5CAD5Cy9NljDogD4zvlf+pfcOmbBLHtDV4QZDwT+BCZMaQnui2wZs9fWY+dxP K/ZMHs0Xb3ElFPQinvwvmdrg68djFzlO+x2ZiGxExjLUzKQiLlOT/985sFIjXc9PQ08+ NsIdXKD+6hN0hrpX6C96LVd2yYAeryZOPGtWSLKAgcFNKjoECMIPrIg/A4ZfYNtIdI6j xLzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=rLsnImkG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l11si8692014eja.20.2020.05.12.22.12.04; Tue, 12 May 2020 22:12:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=rLsnImkG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728863AbgEMFKd (ORCPT + 99 others); Wed, 13 May 2020 01:10:33 -0400 Received: from mail27.static.mailgun.info ([104.130.122.27]:57244 "EHLO mail27.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726035AbgEMFKb (ORCPT ); Wed, 13 May 2020 01:10:31 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1589346631; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=QvCnssNRyOaZbTIUEafb9UtFFPJxVfsGVnlMsbWACNk=; b=rLsnImkGz8GgHvRqIw3kYxv2tuHzV93G4cJ6hH4nQ4DoJqHVbZYfJ1ys59DdrX7dFPMkqV0k lBRGEaqGVAjDwdhEBA+ia+6a1y2KDZBvtC3us5mVg1n5T7TuNCOr/eFxY1YY/lnvNjL93OLi PV13BnmG926BFxMskfs3vQ180Rs= X-Mailgun-Sending-Ip: 104.130.122.27 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by mxa.mailgun.org with ESMTP id 5ebb8146.7fa0ebf05570-smtp-out-n03; Wed, 13 May 2020 05:10:30 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id A31C0C433F2; Wed, 13 May 2020 05:10:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.0 Received: from aneelaka-linux.qualcomm.com (blr-c-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: aneela) by smtp.codeaurora.org (Postfix) with ESMTPSA id 9684CC432C2; Wed, 13 May 2020 05:10:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 9684CC432C2 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=aneela@codeaurora.org From: Arun Kumar Neelakantam To: ohad@wizery.com, bjorn.andersson@linaro.org, clew@codeaurora.org, sricharan@codeaurora.org Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, Arun Kumar Neelakantam Subject: [PATCH V5 2/5] rpmsg: Guard against null endpoint ops in destroy Date: Wed, 13 May 2020 10:40:03 +0530 Message-Id: <1589346606-15046-3-git-send-email-aneela@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1589346606-15046-1-git-send-email-aneela@codeaurora.org> References: <1589346606-15046-1-git-send-email-aneela@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chris Lew 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 Signed-off-by: Arun Kumar Neelakantam --- 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 e330ec4..d6c3275 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); -- 2.7.4