diff mbox

[4/7] sfc: Clear I2C adapter structure in falcon_remove_nic()

Message ID 1236196382.3140.21.camel@achroite
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Ben Hutchings March 4, 2009, 7:53 p.m. UTC
i2c_del_adapter() leaves dangling pointers in the structure.  If we
retry the NIC probe and pass the structure to i2c_add_adapter() again
it will lead to an oops unless we clear it first.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
 drivers/net/sfc/falcon.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

Comments

David Miller March 5, 2009, 1:55 a.m. UTC | #1
From: Ben Hutchings <bhutchings@solarflare.com>
Date: Wed, 04 Mar 2009 19:53:02 +0000

> i2c_del_adapter() leaves dangling pointers in the structure.  If we
> retry the NIC probe and pass the structure to i2c_add_adapter() again
> it will lead to an oops unless we clear it first.
> 
> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c
index 9e2f0f0..efd121c 100644
--- a/drivers/net/sfc/falcon.c
+++ b/drivers/net/sfc/falcon.c
@@ -3114,8 +3114,10 @@  void falcon_remove_nic(struct efx_nic *efx)
 	struct falcon_nic_data *nic_data = efx->nic_data;
 	int rc;
 
+	/* Remove I2C adapter and clear it in preparation for a retry */
 	rc = i2c_del_adapter(&efx->i2c_adap);
 	BUG_ON(rc);
+	memset(&efx->i2c_adap, 0, sizeof(efx->i2c_adap));
 
 	falcon_remove_spi_devices(efx);
 	falcon_free_buffer(efx, &efx->irq_status);