Skip to content

Commit c51ba24

Browse files
rmurphy-armChristoph Hellwig
authored andcommitted
swiotlb: fail map correctly with failed io_tlb_default_mem
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 <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]>
1 parent 4136ce9 commit c51ba24

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/dma/swiotlb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ phys_addr_t swiotlb_tbl_map_single(struct device *dev, phys_addr_t orig_addr,
584584
int index;
585585
phys_addr_t tlb_addr;
586586

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

590590
if (cc_platform_has(CC_ATTR_MEM_ENCRYPT))

0 commit comments

Comments
 (0)