mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
dma-direct: Fix potential NULL pointer dereference
When booting the kernel v5.9-rc4 on a VM, the kernel would panic when printing a warning message in swiotlb_map(). The dev->dma_mask must not be a NULL pointer when calling the dma mapping layer. A NULL pointer check can potentially avoid the panic. Signed-off-by: Thomas Tai <thomas.tai@oracle.com> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
parent
a92df4f62f
commit
f959dcd6dd
2 changed files with 11 additions and 3 deletions
|
@ -62,9 +62,6 @@ static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size,
|
|||
{
|
||||
dma_addr_t end = addr + size - 1;
|
||||
|
||||
if (!dev->dma_mask)
|
||||
return false;
|
||||
|
||||
if (is_ram && !IS_ENABLED(CONFIG_ARCH_DMA_ADDR_T_64BIT) &&
|
||||
min(addr, end) < phys_to_dma(dev, PFN_PHYS(min_low_pfn)))
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue