Skip to content

Commit

Permalink
swiotlb: fail map correctly with failed io_tlb_default_mem
Browse files Browse the repository at this point in the history
[ Upstream commit c51ba24 ]

In the failure case of trying to use a buffer which we'd previously
failed to allocate, the "!mem" condition is no longer sufficient since
io_tlb_default_mem became static and assigned by default. Update the
condition to work as intended per the rest of that conversion.

Fixes: 463e862 ("swiotlb: Convert io_default_tlb_mem to static allocation")
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
rmurphy-arm authored and gregkh committed Aug 17, 2022
1 parent 80f697b commit 1008e81
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/dma/swiotlb.c
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ phys_addr_t swiotlb_tbl_map_single(struct device *dev, phys_addr_t orig_addr,
int index;
phys_addr_t tlb_addr;

if (!mem)
if (!mem || !mem->nslabs)
panic("Can not allocate SWIOTLB buffer earlier and can't now provide you with the DMA bounce buffer");

if (mem_encrypt_active())
Expand Down

0 comments on commit 1008e81

Please sign in to comment.