[Bionic PATCH 19/19] ibmvnic: Fix early release of login buffer

Thadeu Lima de Souza Cascardo cascardo at canonical.com
Tue Feb 27 15:12:15 UTC 2018

From: Thomas Falcon <tlfalcon at linux.vnet.ibm.com>

BugLink: https://bugs.launchpad.net/bugs/1748517

The login buffer is released before the driver can perform
sanity checks between resources the driver requested and what
firmware will provide. Don't release the login buffer until
the sanity check is performed.

Fixes: 34f0f4e3f488 ("ibmvnic: Fix login buffer memory leaks")
Signed-off-by: Thomas Falcon <tlfalcon at linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem at davemloft.net>
(cherry picked from commit a2c0f039bbd0f9ebf375176d05b056e3f3b5c4f7)
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo at canonical.com>
 drivers/net/ethernet/ibm/ibmvnic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index fb6993da6eeb..47b68cd7c898 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -3760,7 +3760,6 @@ static int handle_login_rsp(union ibmvnic_crq *login_rsp_crq,
 	dma_unmap_single(dev, adapter->login_buf_token, adapter->login_buf_sz,
-	release_login_buffer(adapter);
 	dma_unmap_single(dev, adapter->login_rsp_buf_token,
 			 adapter->login_rsp_buf_sz, DMA_BIDIRECTIONAL);
@@ -3791,6 +3790,7 @@ static int handle_login_rsp(union ibmvnic_crq *login_rsp_crq,
 		return -EIO;
+	release_login_buffer(adapter);
 	return 0;

More information about the kernel-team mailing list