Skip to content

Commit

Permalink
powerpc/pmac: Fix dangling pointers
Browse files Browse the repository at this point in the history
Fix I2C-drivers which missed setting clientdata to NULL before freeing the
structure it points to. Also fix drivers which do this _after_ the structure
was freed already.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Cc: Colin Leroy <colin@colino.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
  • Loading branch information
Wolfram Sang authored and Benjamin Herrenschmidt committed Apr 7, 2010
1 parent 21dbeb9 commit 7429b38
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/macintosh/therm_adt746x.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ remove_thermostat(struct i2c_client *client)

thermostat = NULL;

i2c_set_clientdata(client, NULL);
kfree(th);

return 0;
Expand Down Expand Up @@ -399,6 +400,7 @@ static int probe_thermostat(struct i2c_client *client,
rc = read_reg(th, CONFIG_REG);
if (rc < 0) {
dev_err(&client->dev, "Thermostat failed to read config!\n");
i2c_set_clientdata(client, NULL);
kfree(th);
return -ENODEV;
}
Expand Down

0 comments on commit 7429b38

Please sign in to comment.