mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-13 09:20:17 +00:00
ibmvnic: Ensure that buffers are NULL after free
This change will guard against a double free in the case that the buffers were previously freed at some other time, such as during a device reset. It resolves a kernel oops that occurred when changing the VNIC device's MTU. Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
3468656fd7
commit
b0992eca00
@ -354,6 +354,8 @@ static void release_stats_buffers(struct ibmvnic_adapter *adapter)
|
||||
{
|
||||
kfree(adapter->tx_stats_buffers);
|
||||
kfree(adapter->rx_stats_buffers);
|
||||
adapter->tx_stats_buffers = NULL;
|
||||
adapter->rx_stats_buffers = NULL;
|
||||
}
|
||||
|
||||
static int init_stats_buffers(struct ibmvnic_adapter *adapter)
|
||||
@ -599,6 +601,8 @@ static void release_vpd_data(struct ibmvnic_adapter *adapter)
|
||||
|
||||
kfree(adapter->vpd->buff);
|
||||
kfree(adapter->vpd);
|
||||
|
||||
adapter->vpd = NULL;
|
||||
}
|
||||
|
||||
static void release_tx_pools(struct ibmvnic_adapter *adapter)
|
||||
@ -909,6 +913,7 @@ static int ibmvnic_get_vpd(struct ibmvnic_adapter *adapter)
|
||||
if (dma_mapping_error(dev, adapter->vpd->dma_addr)) {
|
||||
dev_err(dev, "Could not map VPD buffer\n");
|
||||
kfree(adapter->vpd->buff);
|
||||
adapter->vpd->buff = NULL;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user