All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nick Child <nnac123@linux.ibm.com>
To: netdev@vger.kernel.org
Cc: haren@linux.ibm.com, ricklind@us.ibm.com, danymadden@us.ibm.com,
	tlfalcon@linux.ibm.com, bjking1@linux.ibm.com,
	Nick Child <nnac123@linux.ibm.com>,
	Simon Horman <horms@kernel.org>
Subject: [PATCH net v2 2/5] ibmvnic: Unmap DMA login rsp buffer on send login fail
Date: Wed,  9 Aug 2023 17:10:35 -0500	[thread overview]
Message-ID: <20230809221038.51296-2-nnac123@linux.ibm.com> (raw)
In-Reply-To: <20230809221038.51296-1-nnac123@linux.ibm.com>

If the LOGIN CRQ fails to send then we must DMA unmap the response
buffer. Previously, if the CRQ failed then the memory was freed without
DMA unmapping.

Fixes: c98d9cc4170d ("ibmvnic: send_login should check for crq errors")
Signed-off-by: Nick Child <nnac123@linux.ibm.com>
Reviewed-by: Simon Horman <horms@kernel.org>
---
 drivers/net/ethernet/ibm/ibmvnic.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index f4bb2c9ab9a4..668c67556190 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -4830,11 +4830,14 @@ static int send_login(struct ibmvnic_adapter *adapter)
 	if (rc) {
 		adapter->login_pending = false;
 		netdev_err(adapter->netdev, "Failed to send login, rc=%d\n", rc);
-		goto buf_rsp_map_failed;
+		goto buf_send_failed;
 	}
 
 	return 0;
 
+buf_send_failed:
+	dma_unmap_single(dev, rsp_buffer_token, rsp_buffer_size,
+			 DMA_FROM_DEVICE);
 buf_rsp_map_failed:
 	kfree(login_rsp_buffer);
 	adapter->login_rsp_buf = NULL;
-- 
2.39.3


  reply	other threads:[~2023-08-09 22:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-09 22:10 [PATCH net v2 1/5] ibmvnic: Enforce stronger sanity checks on login response Nick Child
2023-08-09 22:10 ` Nick Child [this message]
2023-08-09 22:10 ` [PATCH net v2 3/5] ibmvnic: Handle DMA unmapping of login buffs in release functions Nick Child
2023-08-09 22:10 ` [PATCH net v2 4/5] ibmvnic: Do partial reset on login failure Nick Child
2023-08-09 22:10 ` [PATCH net v2 5/5] ibmvnic: Ensure login failure recovery is safe from other resets Nick Child
2023-08-10 17:50 ` [PATCH net v2 1/5] ibmvnic: Enforce stronger sanity checks on login response patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230809221038.51296-2-nnac123@linux.ibm.com \
    --to=nnac123@linux.ibm.com \
    --cc=bjking1@linux.ibm.com \
    --cc=danymadden@us.ibm.com \
    --cc=haren@linux.ibm.com \
    --cc=horms@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=ricklind@us.ibm.com \
    --cc=tlfalcon@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.