ibmvnic: fix login buffer memory leak
authorLijun Pan <ljp@linux.ibm.com>
Sat, 19 Dec 2020 21:39:19 +0000 (15:39 -0600)
committerJakub Kicinski <kuba@kernel.org>
Wed, 23 Dec 2020 02:40:46 +0000 (18:40 -0800)
commita0c8be56affa7d5ffbdec24c992223be54db3b6e
tree1c1ce3c0783f526f259b7d4f47133e2f74791946
parent8b0f64b113d617c995ffdf50196948c3e99c6e49
ibmvnic: fix login buffer memory leak

Commit 34f0f4e3f488 ("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 f3ae59c0c015 ("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: f3ae59c0c015 ("ibmvnic: store RX and TX subCRQ handle array in ibmvnic_adapter struct")
Fixes: 34f0f4e3f488 ("ibmvnic: Fix login buffer memory leaks")
Signed-off-by: Lijun Pan <ljp@linux.ibm.com>
Link: https://lore.kernel.org/r/20201219213919.21045-1-ljp@linux.ibm.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/ibm/ibmvnic.c