Skip to content

Commit

Permalink
Staging: iio: light: 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>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Wolfram Sang authored and Greg Kroah-Hartman committed Apr 30, 2010
1 parent ef6d4f5 commit b36fc07
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/staging/iio/light/tsl2563.c
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,7 @@ static int __devinit tsl2563_probe(struct i2c_client *client,
fail2:
iio_device_unregister(chip->indio_dev);
fail1:
i2c_set_clientdata(client, NULL);
kfree(chip);
return err;
}
Expand All @@ -692,6 +693,7 @@ static int tsl2563_remove(struct i2c_client *client)

iio_device_unregister(chip->indio_dev);

i2c_set_clientdata(client, NULL);
kfree(chip);
return 0;
}
Expand Down

0 comments on commit b36fc07

Please sign in to comment.