ibmvnic: Handle DMA unmapping of login buffs in release functions
authorNick Child <nnac123@linux.ibm.com>
Wed, 9 Aug 2023 22:10:36 +0000 (17:10 -0500)
committerJakub Kicinski <kuba@kernel.org>
Thu, 10 Aug 2023 17:36:36 +0000 (10:36 -0700)
commitd78a671eb8996af19d6311ecdee9790d2fa479f0
tree94cf68b4c148eb75f9ef4ad8e12dd872fdf0a723
parent411c565b4bc63e9584a8493882bd566e35a90588
ibmvnic: Handle DMA unmapping of login buffs in release functions

Rather than leaving the DMA unmapping of the login buffers to the
login response handler, move this work into the login release functions.
Previously, these functions were only used for freeing the allocated
buffers. This could lead to issues if there are more than one
outstanding login buffer requests, which is possible if a login request
times out.

If a login request times out, then there is another call to send login.
The send login function makes a call to the login buffer release
function. In the past, this freed the buffers but did not DMA unmap.
Therefore, the VIOS could still write to the old login (now freed)
buffer. It is for this reason that it is a good idea to leave the DMA
unmap call to the login buffers release function.

Since the login buffer release functions now handle DMA unmapping,
remove the duplicate DMA unmapping in handle_login_rsp().

Fixes: dff515a3e71d ("ibmvnic: Harden device login requests")
Signed-off-by: Nick Child <nnac123@linux.ibm.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20230809221038.51296-3-nnac123@linux.ibm.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/ibm/ibmvnic.c