Received: by 10.192.165.148 with SMTP id m20csp3691579imm; Mon, 30 Apr 2018 04:54:14 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpJk+1964bjEdHYXYGXXtBdQOUTMKUUf8yenWUjdzi3xh2JpwDI/FSx9e9OGDtR0yFi8sUQ X-Received: by 2002:a63:a60a:: with SMTP id t10-v6mr9976016pge.357.1525089254374; Mon, 30 Apr 2018 04:54:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525089254; cv=none; d=google.com; s=arc-20160816; b=XfdvVh7ylQK8iVqojEFZENfmDnc2uaUJa7N+TVC778qnuyvwaQbYQ3sDMckXQg8RKG z6ItMaKp5jNXoCmQyTqIWtSZvmz0wBsA7bw7yx9Uhl2rVvwWNAin1VXlBP1kC/Jf3fjh pjFQy6QzBURHlPW28nHCxPwJkiebpehim1ep8P1KtXhbPvmk+LAh36+eE+/Q3dP30mLz VERc6CI+qpiUdxnBeLMPnnyep680lgdFqvxHmKsKOgA9AXj0wQRO8mfONyFya+14JMb7 3NePyMplo9QpORSclAcHK2TJgv7xcBBeVhgvV66xh1tscxVKc8zA0qWPWfHC4qXxf1sZ v4NQ== 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:references:cc:to:from:subject:arc-authentication-results; bh=k4keQmNgsjiCDKyoODSoC4xctcXBOgnFe4ctGWVTL7A=; b=0zczcEfJK32+7mZt8KcZxh+/07O2RZp6baq5a0eSDNoA9UIu21nQc/KKjY3mQXR60K hd05D9JrSc61THW1TVkuKBbq2c2c0DItvo3wfsV3/220xkWx/6But4ry1+g9wL4Et7xb K36hONEPyASBodlTeNTsDdvMJGNhbfQpKIRjhrB5iwFDjVmgzh2GQ0bDY8m0bP3RWs0w C7RKW+/vA9ygu/BEq6roywqXy3BeW6cXaNEz+b/rzuAFNTeqUAeX5gsEaCKgZWL2/HjM 3Yuw4BtMrCPGUxLKX7Z4CYMcgBa/O+CFwGPG8p3ZTMSQZukDhPCjedNz0k9J+MVLff7t +oJw== 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 y21si7649860pfi.195.2018.04.30.04.54.00; Mon, 30 Apr 2018 04:54:14 -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 S1753632AbeD3Lxp (ORCPT + 99 others); Mon, 30 Apr 2018 07:53:45 -0400 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:36463 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752363AbeD3Lxn (ORCPT ); Mon, 30 Apr 2018 07:53:43 -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 w3UBnY5M007385; Mon, 30 Apr 2018 13:53:34 +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 2hmedwh65u-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 30 Apr 2018 13:53:34 +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 3E91834; Mon, 30 Apr 2018 11:53:34 +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 0D3CD2BEF; Mon, 30 Apr 2018 11:53:34 +0000 (GMT) Received: from [10.201.23.162] (10.75.127.49) by SFHDAG3NODE1.st.com (10.75.127.7) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Mon, 30 Apr 2018 13:53:33 +0200 Subject: Re: [PATCH v3 4/6] rpmsg: Guard against null endpoint ops in destroy From: Arnaud Pouliquen To: Chris Lew , , , , , CC: , , , , , References: <1524783545-21951-1-git-send-email-clew@codeaurora.org> <1524783545-21951-5-git-send-email-clew@codeaurora.org> Message-ID: <85871a63-5e7c-9769-6a76-36b1cf44f59b@st.com> Date: Mon, 30 Apr 2018 13:53:32 +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: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.75.127.49] X-ClientProxiedBy: SFHDAG4NODE1.st.com (10.75.127.10) To SFHDAG3NODE1.st.com (10.75.127.7) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-04-30_04:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/30/2018 10:36 AM, Arnaud Pouliquen wrote: > 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. Sorry i cross checked in rpmsg_endpoint_ops. destroy_ept is required. So my comment is not relevant. Nevertheless do it make sense to have an endpoint without associated ops? I don't use rpmsg_char but I tried to figure out how rpmsg_create_ept is called in rpmsg_char without rpmsg_device ops... Seems that qcom_glink_create_ept should be called, so ept->ops should point to glink_endpoint_ops struct, right? Another point concerns the send and try send ops that are also required. Do you test rpmsg_trysend and/or rpmsg_send function call? seems that you should face the same issue... > > Regards > Arnaud > -- > To unsubscribe from this list: send the line "unsubscribe linux-remoteproc" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html >