OSDN Git Service

ibmvnic fix NULL tx_pools and rx_tools issue at do_reset
authorMingming Cao <mmc@linux.vnet.ibm.com>
Tue, 25 Aug 2020 17:26:41 +0000 (13:26 -0400)
committerDavid S. Miller <davem@davemloft.net>
Wed, 26 Aug 2020 00:28:14 +0000 (17:28 -0700)
commit9f13457377907fa253aef560e1a37e1ca4197f9b
treeaa0c308053539adcc7f419e58799e5725d65d271
parent2c6500e82e5190b038f0b79f85a20da55bdd4b86
ibmvnic fix NULL tx_pools and rx_tools issue at do_reset

At the time of do_rest, ibmvnic tries to re-initalize the tx_pools
and rx_pools to avoid re-allocating the long term buffer. However
there is a window inside do_reset that the tx_pools and
rx_pools were freed before re-initialized making it possible to deference
null pointers.

This patch fix this issue by always check the tx_pool
and rx_pool are not NULL after ibmvnic_login. If so, re-allocating
the pools. This will avoid getting into calling reset_tx/rx_pools with
NULL adapter tx_pools/rx_pools pointer. Also add null pointer check in
reset_tx_pools and reset_rx_pools to safe handle NULL pointer case.

Signed-off-by: Mingming Cao <mmc@linux.vnet.ibm.com>
Signed-off-by: Dany Madden <drt@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/ibm/ibmvnic.c