Skip to content

Commit

Permalink
sfc: Clear I2C adapter structure in falcon_remove_nic()
Browse files Browse the repository at this point in the history
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Ben Hutchings authored and David S. Miller committed Mar 5, 2009
1 parent 115122a commit 8c87037
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/net/sfc/falcon.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8c87037

Please sign in to comment.