[Bionic PATCH 09/19] ibmvnic: Ensure that buffers are NULL after free

Thadeu Lima de Souza Cascardo cascardo at canonical.com
Tue Feb 27 15:12:05 UTC 2018

From: Thomas Falcon <tlfalcon at linux.vnet.ibm.com>

BugLink: https://bugs.launchpad.net/bugs/1748517

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 at linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem at davemloft.net>
(cherry picked from commit b0992eca00c490c0923044b7d8b853c212b3cacc)
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo at canonical.com>
 drivers/net/ethernet/ibm/ibmvnic.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index d1a8f55a7329..fab1d1f3f815 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -354,6 +354,8 @@ static void release_stats_buffers(struct ibmvnic_adapter *adapter)
+	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)
+	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");
+		adapter->vpd->buff = NULL;
 		return -ENOMEM;

More information about the kernel-team mailing list