Re: [PATCH] serial: pch: Fix PCI device refcount leak in pch_request_dma()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Nov 22, 2022 at 07:45:59PM +0800, Xiongfeng Wang wrote:
> As comment of pci_get_slot() says, it returns a pci_device with its
> refcount increased. The caller must decrement the reference count by
> calling pci_dev_put().

> Since 'dma_dev' is only used to filter the channel in filter(), we can
> call pci_dev_put() before exiting from pch_request_dma(). Add the
> missing pci_dev_put() for the normal and error path.

No, we can't do that. How is it supposed to work if DMA device disappears in
the middle?

Look at how it's done in the

5318f70da7e8 serial: 8250_lpss: Balance reference count for PCI DMA device
67ec6dd0b257 serial: 8250_mid: Balance reference count for PCI DMA device

-- 
With Best Regards,
Andy Shevchenko





[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux