Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp595333ybj; Tue, 5 May 2020 04:31:54 -0700 (PDT) X-Google-Smtp-Source: APiQypKEHZ6gKNwOlpOlsh36R8O8Tnop77c7kE3Ns8PEGiOWTNfJ1nWINIuJjxafe434fshpMwXr X-Received: by 2002:a17:906:7743:: with SMTP id o3mr2308163ejn.120.1588678314828; Tue, 05 May 2020 04:31:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588678314; cv=none; d=google.com; s=arc-20160816; b=oGcuKQpuRb5dvInq57IghK89TkV7gEyr5QxGQnenrNnaMLrFDa5rq7WUGVA0+NbBll /P6qYDmptNMQzi+1COXY1xO5D9/EnjwWAxGpAojwl/zjQMOURn8ECvCbw+gwWLcug1YA BgSRY1j/+m7z4j+SmJEmA+1XGcg3B+SQJOMUAsMzxtGwPrbXC8GS+XzpZc9DV4v1c+Iq 0VbKj+Tqa0Kvp5cviDKLu6w5jCSukRxEYxRNVfnxGyEJdXR3eq9e59rQWc1wAjGYoPKy Lk5IjKNG5V1/mEkpJvM26lO6XsKn594xPgGm1JMZCEaX4QLLVGac4djo6RuFoe69gejK O25w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=99dHxBvtx6Kw2ey+S/qYxQLWvfcdf97ni7pl7qWr568=; b=YI/LfCdsWa19qGCKn2vhSoJxyxVjgz5fgJvsW8NUG23UQ0hNTGKdXZgXvdRHB2rglS k16JDQJ1QNZhrURBHUTWHJG0oshPZxntclCeOv2Lvw1X9i0nxohp96rwVERGQ13FvEgQ f8+MWaX9dobvsPnPTe5E2iR8wkN7z+oKl27xw0s8Z3nxnEuey4BJeS/gkZ7TiBCPYAf8 xWIa/Ed2PeKj6f1LTmcOzxUhZ9Z7z6tfwPmzHf9SZQ0VQygg7AMHPaNKXQ44BvW+UiF4 Bqhsdk4/75UgT1L+2YUnqDZmtZ78Z1QP7unsn1je+EdGntrnAXK3+Gwd4dtpoAazSxo9 0yLA== 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 y10si897156ejw.403.2020.05.05.04.31.31; Tue, 05 May 2020 04:31: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 S1728754AbgEEL2C (ORCPT + 99 others); Tue, 5 May 2020 07:28:02 -0400 Received: from foss.arm.com ([217.140.110.172]:37734 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727090AbgEEL2C (ORCPT ); Tue, 5 May 2020 07:28:02 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7500330E; Tue, 5 May 2020 04:28:01 -0700 (PDT) Received: from e121166-lin.cambridge.arm.com (e121166-lin.cambridge.arm.com [10.1.196.255]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AA6E83F305; Tue, 5 May 2020 04:28:00 -0700 (PDT) Date: Tue, 5 May 2020 12:27:58 +0100 From: Lorenzo Pieralisi To: Kunihiko Hayashi Cc: Kishon Vijay Abraham I , Bjorn Helgaas , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] PCI: endpoint: functions/pci-epf-test: Avoid DMA release when DMA is unsupported Message-ID: <20200505112758.GD13446@e121166-lin.cambridge.arm.com> References: <1587540287-10458-1-git-send-email-hayashi.kunihiko@socionext.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1587540287-10458-1-git-send-email-hayashi.kunihiko@socionext.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 22, 2020 at 04:24:47PM +0900, 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, 3 insertions(+) Applied (with the proper Fixes: SHA-1 ID) to pci/endpoint, thanks. Lorenzo > diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c > index 60330f3e..c89a956 100644 > --- a/drivers/pci/endpoint/functions/pci-epf-test.c > +++ b/drivers/pci/endpoint/functions/pci-epf-test.c > @@ -187,6 +187,9 @@ static int pci_epf_test_init_dma_chan(struct pci_epf_test *epf_test) > */ > static void pci_epf_test_clean_dma_chan(struct pci_epf_test *epf_test) > { > + if (!epf_test->dma_supported) > + return; > + > dma_release_channel(epf_test->dma_chan); > epf_test->dma_chan = NULL; > } > -- > 2.7.4 >