Skip to content

Commit

Permalink
ibmvnic: fix login buffer memory leak
Browse files Browse the repository at this point in the history
Commit 34f0f4e ("ibmvnic: Fix login buffer memory leaks") frees
login_rsp_buffer in release_resources() and send_login()
because handle_login_rsp() does not free it.
Commit f3ae59c ("ibmvnic: store RX and TX subCRQ handle array in
ibmvnic_adapter struct") frees login_rsp_buffer in handle_login_rsp().
It seems unnecessary to free it in release_resources() and send_login().
There are chances that handle_login_rsp returns earlier without freeing
buffers. Double-checking the buffer is harmless since
release_login_buffer and release_login_rsp_buffer will
do nothing if buffer is already freed.

Fixes: f3ae59c ("ibmvnic: store RX and TX subCRQ handle array in ibmvnic_adapter struct")
Fixes: 34f0f4e ("ibmvnic: Fix login buffer memory leaks")
Signed-off-by: Lijun Pan <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
Lijun Pan authored and kuba-moo committed Dec 23, 2020
1 parent 8b0f64b commit a0c8be5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/net/ethernet/ibm/ibmvnic.c
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,7 @@ static void release_resources(struct ibmvnic_adapter *adapter)
release_rx_pools(adapter);

release_napi(adapter);
release_login_buffer(adapter);
release_login_rsp_buffer(adapter);
}

Expand Down Expand Up @@ -3873,7 +3874,9 @@ static int send_login(struct ibmvnic_adapter *adapter)
return -1;
}

release_login_buffer(adapter);
release_login_rsp_buffer(adapter);

client_data_len = vnic_client_data_len(adapter);

buffer_size =
Expand Down

0 comments on commit a0c8be5

Please sign in to comment.