Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp359346ybz; Tue, 21 Apr 2020 23:00:54 -0700 (PDT) X-Google-Smtp-Source: APiQypLP0rRCxl8nSRQ8UXRzhL/w/uu4UIz28VAajUly/Os2wv8hKqrJbm/zEAqP1SXJYeTBW6t5 X-Received: by 2002:a05:6402:17e3:: with SMTP id t3mr22158268edy.203.1587535254031; Tue, 21 Apr 2020 23:00:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587535254; cv=none; d=google.com; s=arc-20160816; b=fQZXhdU9PLT8NnHAR+XKtkoddeeKlNiKXCRKkG3w6ZXUN0dQwPIFvWFATTp8eysUWa eMbjiBjKtPbDwzvtkZCVUNPFdg6GCLaw4XDp96+xKO+vzjMnTpJNiCXmwD9Q3iBsfqBK aMfq9+XhyJWsjMyf2cV09UERzLpvgXy4BqeOFz72to/YDnaKez5T3pCR0NFQwp9UPHwi /8LkT5rDZWCs6Y4ID0DmzP067BCCS+1lqm2dJRGY3r2T+Lb+sjk2CTglCAlEOh8TyUMP eYH3a0Rq3gOdgA6Vp8wSn/7FOsGSxWXTiDjzXbHThMc+JV1Q7jaZy9XgiZQqWpovvtGY 8k6Q== 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; bh=hFvmwlO2pujmM+f8cuJDaIphQcXeLMUWqZ2+7FozYMw=; b=KwKV/zcKULc59NBo4p/AXN1OmSNEbmZ2NYXZ25udMd0fmL24GvRDrPwJm48l10yH8k rssPYhv5PvOaUWYrkerZ/K8vcqR7z+Jx6p82lFpQj+KwdKuH4tPTbfRG+vkx+thhVxvV i5KU+CxmPuxc+qjGrP6/YFnaVtQmzHiNobUuRlnakFFDFQhTwhjO2e+3Bt+IzoNQ2JEv xKiDaTq7QubUkpYAnB78+aaMXr++hSbPSlgTfiKPRcHw7VjlV+22P56gPAPrw1ojF9kH 75l45HqYTsX6JSOoAQ78GnHmU00DYG4WMfBOsxBECGqybhiLlrap593yioNEviigUovp n+dQ== ARC-Authentication-Results: i=1; mx.google.com; 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 n24si3050434edt.193.2020.04.21.23.00.30; Tue, 21 Apr 2020 23:00:54 -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; 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 S1726068AbgDVF7b (ORCPT + 99 others); Wed, 22 Apr 2020 01:59:31 -0400 Received: from mx.socionext.com ([202.248.49.38]:9854 "EHLO mx.socionext.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725912AbgDVF7b (ORCPT ); Wed, 22 Apr 2020 01:59:31 -0400 Received: from unknown (HELO kinkan-ex.css.socionext.com) ([172.31.9.52]) by mx.socionext.com with ESMTP; 22 Apr 2020 14:59:29 +0900 Received: from mail.mfilter.local (m-filter-2 [10.213.24.62]) by kinkan-ex.css.socionext.com (Postfix) with ESMTP id B5A5118020B; Wed, 22 Apr 2020 14:59:29 +0900 (JST) Received: from 172.31.9.51 (172.31.9.51) by m-FILTER with ESMTP; Wed, 22 Apr 2020 14:59:29 +0900 Received: from yuzu.css.socionext.com (yuzu [172.31.8.45]) by kinkan.css.socionext.com (Postfix) with ESMTP id 85F741A12D0; Wed, 22 Apr 2020 14:59:29 +0900 (JST) Received: from [10.213.29.177] (unknown [10.213.29.177]) by yuzu.css.socionext.com (Postfix) with ESMTP id D8BC3120133; Wed, 22 Apr 2020 14:59:28 +0900 (JST) Subject: Re: [PATCH] PCI: endpoint: functions/pci-epf-test: Avoid DMA release when DMA is unsupported To: Kishon Vijay Abraham I Cc: Lorenzo Pieralisi , Bjorn Helgaas , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org References: <1584956747-9273-1-git-send-email-hayashi.kunihiko@socionext.com> <948ae2b0-825e-4557-7e43-16d95d26e9f4@ti.com> From: Kunihiko Hayashi Message-ID: Date: Wed, 22 Apr 2020 14:59:28 +0900 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <948ae2b0-825e-4557-7e43-16d95d26e9f4@ti.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Kishon, On 2020/04/22 14:45, Kishon Vijay Abraham I wrote: > Hi Kunihiko, > > On 3/23/2020 3:15 PM, Kunihiko Hayashi wrote: >> When unbinding pci_epf_test, pci_epf_test_clean_dma_chan() is called in >> pci_epf_test_unbind() even though epf_test->dma_supported is false. >> As a result, dma_release_channel() will occur null pointer access because >> dma_chan isn't set. >> >> This avoids calling dma_release_channel() if epf_test->dma_supported >> is false. >> >> Fixes: a1d105d4ab8e ("PCI: endpoint: functions/pci-epf-test: Add DMA support to transfer data") >> Signed-off-by: Kunihiko Hayashi >> --- >> drivers/pci/endpoint/functions/pci-epf-test.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c >> index 3b4cf7e..8b4f136 100644 >> --- a/drivers/pci/endpoint/functions/pci-epf-test.c >> +++ b/drivers/pci/endpoint/functions/pci-epf-test.c >> @@ -609,7 +609,8 @@ static void pci_epf_test_unbind(struct pci_epf *epf) >> int bar; >> >> cancel_delayed_work(&epf_test->cmd_handler); >> - pci_epf_test_clean_dma_chan(epf_test); >> + if (epf_test->dma_supported) >> + pci_epf_test_clean_dma_chan(epf_test); > > Can you add this check inside the pci_epf_test_clean_dma_chan()? Okay, I'll move this check to the pci_epf_test_clean_dma_chan(). Thank you, --- Best Regards Kunihiko Hayashi