Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp729294ybt; Wed, 24 Jun 2020 09:47:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUOVrV18YQNkLFt0dVMC7BVI+oM5ERd4em/RXPOc1I1QTzaZVEd0DDHK2oUujHX26YvOS4 X-Received: by 2002:a17:907:72cf:: with SMTP id du15mr25025447ejc.151.1593017226960; Wed, 24 Jun 2020 09:47:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593017226; cv=none; d=google.com; s=arc-20160816; b=U/3Jp/GJYHzz+lGQoQnjdBBW4qLQ4G9kaYAv/kuEPwZ9OxNBRyh/+kAjN03Ajg0DCw HooY+NYn/4suFSdnWbK8GO6lEOfUs1QQpDh7oC+ZaY/P+g2/jyPZp+1nuE3/J55h7ILb ZPwjePqPas8qGfmOUeD98pUgjsL3mowSwUzprG93UlSxyxasd2DhYKzRMTKwSFkd/zs0 ITy/nLheGMq6cbOxWt0eCxfYIZ7ItZMW/uXvbYA/lvFgNawLJGZkxo3TVcATKCymw/tB ZTCsahELIzfnEijvpbwRhxf4XGLMMTk6tc62IJVJUdt+4urYp1NLanEJRus6M9sJho03 LH1A== 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=EdiC6FJ57QhZAxbTBAm1mCvHU67ixuu71bwq/KDiuQk=; b=zx3R2E8M78NweCZNJLza7Kp/eytCX6qiiPgfjim2U5ur0x2rpNhX4vmKiBUxIipGSY 1jpNvS+EEUrY2/8Kn126Hv6aV1UNKvVxfAIrHun+9fUrFrKpbVHU2vFJ9IpVTb5KpTkP R1/Xd4/tPeS2oHHPO5zfMEfP4SKsmWKy7SeXFA4xkxlc5RJZhFUnGj4KaXMycMLMf+xi noDXWMC2DL3kkKi9kkOdtu8piVadkhZSjz/Ch+aExYYLYGJ6FVirBtVgEkz970iW5m0O qEqduoEX78Q5ckozQ24ac92UwdHzOLIUekxndB4MzVhhHoa0/EW/JQBuCS3bzgTwnlZ4 FVyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=dTV43H5M; 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 lo14si5092371ejb.244.2020.06.24.09.46.43; Wed, 24 Jun 2020 09:47:06 -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=dTV43H5M; 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 S2404365AbgFXQqc (ORCPT + 99 others); Wed, 24 Jun 2020 12:46:32 -0400 Received: from mail29.static.mailgun.info ([104.130.122.29]:50647 "EHLO mail29.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404851AbgFXQqa (ORCPT ); Wed, 24 Jun 2020 12:46:30 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1593017189; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=EdiC6FJ57QhZAxbTBAm1mCvHU67ixuu71bwq/KDiuQk=; b=dTV43H5MEaa+H8z7kav7UA4vtDfTCIZ5TyLpvepTJGRtdA0rvsOV9HayAVpFpieJHads5fmL TzhuYCA+N8J4AZV3Og7RXccrNeXX7BNMsEh5KA5DEq1wmKBY0P3xEltH6jr0AQ5rNm5vffsX NgYFvM7H0D6XHIIQMla9cyfnGQ0= X-Mailgun-Sending-Ip: 104.130.122.29 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 smtp-out-n10.prod.us-east-1.postgun.com with SMTP id 5ef38354567385e8e74b8bc9 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Wed, 24 Jun 2020 16:46:12 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 5231CC433CB; Wed, 24 Jun 2020 16:46:11 +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 deesin-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: deesin) by smtp.codeaurora.org (Postfix) with ESMTPSA id CD3A7C433A0; Wed, 24 Jun 2020 16:46:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org CD3A7C433A0 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=deesin@codeaurora.org From: Deepak Kumar Singh To: bjorn.andersson@linaro.org, clew@codeaurora.org, mathieu.poirier@linaro.org Cc: Deepak Kumar Singh , Arun Kumar Neelakantam , Ohad Ben-Cohen , linux-remoteproc@vger.kernel.org (open list:REMOTE PROCESSOR MESSAGING (RPMSG) SUBSYSTEM), linux-kernel@vger.kernel.org (open list) Subject: [PATCH V7 2/4] rpmsg: Guard against null endpoint ops in destroy Date: Wed, 24 Jun 2020 22:15:19 +0530 Message-Id: <1593017121-7953-3-git-send-email-deesin@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1593017121-7953-1-git-send-email-deesin@codeaurora.org> References: <1593017121-7953-1-git-send-email-deesin@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: Deepak Kumar Singh 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 a6361ca..91de940 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); -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project