diff options
author | Sukadev Bhattiprolu <sukadev@linux.ibm.com> | 2021-06-23 21:13:15 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-06-24 11:22:23 -0700 |
commit | f6ebca8efa52e4ae770f0325d618e7bcf08ada0c (patch) | |
tree | d06849d4357b8755fd9c8125f13e860b3c206701 /drivers/net/ethernet/ibm/ibmvnic.c | |
parent | 552a33729f1a7cc5115d0752064fe9abd6e3e336 (diff) | |
download | linux-stable-f6ebca8efa52e4ae770f0325d618e7bcf08ada0c.tar.gz linux-stable-f6ebca8efa52e4ae770f0325d618e7bcf08ada0c.tar.bz2 linux-stable-f6ebca8efa52e4ae770f0325d618e7bcf08ada0c.zip |
ibmvnic: free tx_pool if tso_pool alloc fails
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>
Diffstat (limited to 'drivers/net/ethernet/ibm/ibmvnic.c')
-rw-r--r-- | drivers/net/ethernet/ibm/ibmvnic.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c index b8bdab0b2701..ede65b32f821 100644 --- a/drivers/net/ethernet/ibm/ibmvnic.c +++ b/drivers/net/ethernet/ibm/ibmvnic.c @@ -778,8 +778,11 @@ static int init_tx_pools(struct net_device *netdev) adapter->tso_pool = kcalloc(tx_subcrqs, sizeof(struct ibmvnic_tx_pool), GFP_KERNEL); - if (!adapter->tso_pool) + if (!adapter->tso_pool) { + kfree(adapter->tx_pool); + adapter->tx_pool = NULL; return -1; + } adapter->num_active_tx_pools = tx_subcrqs; |