Skip to content

Commit

Permalink
hwmon/f71805f: Fix a race condition
Browse files Browse the repository at this point in the history
I think I introduced a potential race condition bug with commit
51c997d. I didn't realize it
back then, but platform_device_put and platform_device_release
both appear to free the platform data associated with the device.
This makes an explicit kfree redundant at best, and maybe even
racy, as it might occur while someone still holds a reference
to the platform device.

Signed-off-by: Jean Delvare <[email protected]>
  • Loading branch information
Jean Delvare authored and Jean Delvare committed Feb 14, 2007
1 parent bc8f0a2 commit a117ddd
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions drivers/hwmon/f71805f.c
Original file line number Diff line number Diff line change
Expand Up @@ -1290,14 +1290,11 @@ static int __init f71805f_device_add(unsigned short address,
if (err) {
printk(KERN_ERR DRVNAME ": Device addition failed (%d)\n",
err);
goto exit_kfree_data;
goto exit_device_put;
}

return 0;

exit_kfree_data:
kfree(pdev->dev.platform_data);
pdev->dev.platform_data = NULL;
exit_device_put:
platform_device_put(pdev);
exit:
Expand Down Expand Up @@ -1390,10 +1387,7 @@ static int __init f71805f_init(void)

static void __exit f71805f_exit(void)
{
kfree(pdev->dev.platform_data);
pdev->dev.platform_data = NULL;
platform_device_unregister(pdev);

platform_driver_unregister(&f71805f_driver);
}

Expand Down

0 comments on commit a117ddd

Please sign in to comment.