Received: by 10.192.165.148 with SMTP id m20csp3527889imm; Mon, 30 Apr 2018 01:36:48 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrYlYBbgTT76YDwUAm1pdUR07BZTNWAoC/bWjQj3dMgLWTQgxh1rs8a6n+NRlW9TLikLGdJ X-Received: by 2002:a17:902:8d8e:: with SMTP id v14-v6mr11714868plo.387.1525077408545; Mon, 30 Apr 2018 01:36:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525077408; cv=none; d=google.com; s=arc-20160816; b=fc9ci0lpeWeGypS7wlPnAOsO3gqEcIPNvh8SLeypZ7/N57mZiVvS+a2wAo/POxB5r8 sH/3ke5jnjnCyqE6TCXdyR4wf8DSxC78+rosgVjsgiK2j1+MB63DAzitwdf+9Rywli00 c1cB6GAAY48Bko81X62EHErnkeCDmLxRjrTguosJyinmj8tKu9EWLqL7yArgU4wTucxN ZbhEE1VjjJnfAgvOY0L93X9B3q0ka7mNTtO2/xxCC/zyqqvnR2V4WoJhdQsVPzPGNmVT jsvSoq41qREELkAbvISuzCoiN04LU2m/VVL8whOECFK+T1xdewyyFc95APjGha0J/n7o hPxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=KrTHlF3It33k3H6assc5doQdcwN7KJTdVunfp3RMsho=; b=RbiUYzF7EeTLM7v0S8Cykmq5lR8Sa09+Uapi7SSJmBp1fTZ2JkqStlArgEswbbXjx9 4fde6Lv2V52d4GT/6oedjaCsypSpuKPMF9/RWKDRh205qXMmwf4e357HiBXRoEFiCshO auHOj7MpQvrNgdV2DE97hohXQDsbOURCKXQ1tZdhfEsGflV0BMwDGjIpRO/hnmWcBDic wM87kkYlqQaeEsSeGcQEUQdM2SBoMmDcnh9DXFG75qJgpRCL4EZIw3JlcK6O0KM8Q1Ka MWlSPDECx8DivOAv4Sklnwhu1dZ/h2S6BvcwtG9jzCgJwlaTZwIw7aZ95hwy5Ax9Cwaq UIFw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a6-v6si6915464plz.49.2018.04.30.01.36.34; Mon, 30 Apr 2018 01:36:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752084AbeD3IgX (ORCPT + 99 others); Mon, 30 Apr 2018 04:36:23 -0400 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:47697 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751251AbeD3IgV (ORCPT ); Mon, 30 Apr 2018 04:36:21 -0400 Received: from pps.filterd (m0046668.ppops.net [127.0.0.1]) by mx07-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id w3U8XiFr009218; Mon, 30 Apr 2018 10:36:10 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2hmedwgfcc-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 30 Apr 2018 10:36:10 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 1983E3A; Mon, 30 Apr 2018 08:36:10 +0000 (GMT) Received: from Webmail-eu.st.com (sfhdag3node1.st.com [10.75.127.7]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id E080F2657; Mon, 30 Apr 2018 08:36:09 +0000 (GMT) Received: from [10.201.23.162] (10.75.127.48) by SFHDAG3NODE1.st.com (10.75.127.7) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Mon, 30 Apr 2018 10:36:09 +0200 Subject: Re: [PATCH v3 4/6] rpmsg: Guard against null endpoint ops in destroy To: Chris Lew , , , , , CC: , , , , , References: <1524783545-21951-1-git-send-email-clew@codeaurora.org> <1524783545-21951-5-git-send-email-clew@codeaurora.org> From: Arnaud Pouliquen Message-ID: Date: Mon, 30 Apr 2018 10:36:08 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <1524783545-21951-5-git-send-email-clew@codeaurora.org> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.75.127.48] X-ClientProxiedBy: SFHDAG6NODE3.st.com (10.75.127.18) To SFHDAG3NODE1.st.com (10.75.127.7) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-04-30_03:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Chris, On 04/27/2018 12:59 AM, Chris Lew wrote: > 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); > Would make sense that you also add test on ept->ops->destroy_ept. I guess that ops may not be null while destroy_ept pointer is. Regards Arnaud