mbox series

[5.10/5.15,0/2] crypto: inside_secure - Avoid dma map if size is zero

Message ID 20240921163438.25253-1-n.zhandarovich@fintech.ru (mailing list archive)
Headers show
Series crypto: inside_secure - Avoid dma map if size is zero | expand

Message

Nikita Zhandarovich Sept. 21, 2024, 4:34 p.m. UTC
The following patch addresses the issue of unchecked calls to
dma_map_sg() in safexcel_send_req() as these macros may return 0 in
case of unsuccessful mapping. This outcome in turn requires
unmapping of previously mapped buffers.

The fix has already been backported to the following stable branches:
v6.6: https://lore.kernel.org/all/20240122235813.608624333@linuxfoundation.org/
v6.1: https://lore.kernel.org/all/20240122235752.938797245@linuxfoundation.org/

The issue in question can be fixed in 5.10 and 5.15 stable branches by
backporting the following 2 upstream commits. Both can be cleanly
applied to kernel versions mentioned above.

[PATCH 5.10/5.15 1/2] crypto: inside_secure - Avoid dma map if size is zero
[PATCH 5.10/5.15 2/2] crypto: safexcel - Add error handling for dma_map_sg() calls

First patch is a prerequisite to main fix and removes warnings in case
of a call to dma_map_sg() with size 0 and allows for clean application
of the main fix.

Second (and main) patch adds proper handling of dma_map_sg() erroneous
behaviour.