[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <b5501127-826f-78f2-beb2-1b8093c90245@socionext.com>
Date: Wed, 22 Apr 2020 14:59:28 +0900
From: Kunihiko Hayashi <hayashi.kunihiko@...ionext.com>
To: Kishon Vijay Abraham I <kishon@...com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
Bjorn Helgaas <bhelgaas@...gle.com>, linux-pci@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] PCI: endpoint: functions/pci-epf-test: Avoid DMA release
when DMA is unsupported
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 <hayashi.kunihiko@...ionext.com>
>> ---
>> 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
Powered by blists - more mailing lists