ibmvnic: free tx_pool if tso_pool alloc fails
authorSukadev Bhattiprolu <sukadev@linux.ibm.com>
Thu, 24 Jun 2021 04:13:15 +0000 (21:13 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Jul 2021 14:56:28 +0000 (16:56 +0200)
commitd52ceed8452614c46dcdb701c1386902d09a1cfa
treebd2483a32d5ccfc3898d87a4b73c547cd4a0c9c8
parentf25accc4fd4d56bda6125ef4e52629b3fb44d1af
ibmvnic: free tx_pool if tso_pool alloc fails

[ Upstream commit f6ebca8efa52e4ae770f0325d618e7bcf08ada0c ]

Free tx_pool and clear it, if allocation of tso_pool fails.

release_tx_pools() assumes we have both tx and tso_pools if ->tx_pool is
non-NULL. If allocation of tso_pool fails in init_tx_pools(), the assumption
will not be true and we would end up dereferencing ->tx_buff, ->free_map
fields from a NULL pointer.

Fixes: 3205306c6b8d ("ibmvnic: Update TX pool initialization routine")
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/ibm/ibmvnic.c