swiotlb: Fix use after free on error handling path
Subsystems (2)
PATCH 1/1 swiotlb: Fix use after free on error handling path
Don't dereference "mem" after it has been freed. Flip the two kfree()s around to address this bug.
Fixes 26ffb91fa5e0 ("swiotlb: split up the global swiotlb lock")
Signed-off-by Dan Carpenter <[email protected]>
--- kernel/dma/swiotlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/dma/swiotlb.c +1 -1
@@ -980,8 +980,8 @@ static int rmem_swiotlb_device_init(struct reserved_mem *rmem, mem->areas =kcalloc (nareas,sizeof (*mem->areas),GFP_KERNEL );if (!mem->areas) { -kfree (mem);kfree (mem->slots); +kfree (mem);return -ENOMEM ; }
Signature · 1 line
2.35.1
Christoph Hellwig
AppliedThanks, applied.