Skip to content

Commit

Permalink
platform/chrome: wilco_ec: fix use after free issue
Browse files Browse the repository at this point in the history
This is caused by dereferencing 'dev_data' after put_device() in
the telem_device_remove() function.
This patch just moves the put_device() down a bit to avoid this
issue.

Fixes: 1210d1e ("platform/chrome: wilco_ec: Add telemetry char device interface")
Signed-off-by: Wen Yang <[email protected]>
Cc: Benson Leung <[email protected]>
Cc: Enric Balletbo i Serra <[email protected]>
Cc: Nick Crews <[email protected]>
Cc: [email protected]
Signed-off-by: Enric Balletbo i Serra <[email protected]>
  • Loading branch information
taskset authored and Enric Balletbo i Serra committed Dec 2, 2019
1 parent 74c166b commit 856a0a6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/platform/chrome/wilco_ec/telemetry.c
Original file line number Diff line number Diff line change
Expand Up @@ -406,8 +406,8 @@ static int telem_device_remove(struct platform_device *pdev)
struct telem_device_data *dev_data = platform_get_drvdata(pdev);

cdev_device_del(&dev_data->cdev, &dev_data->dev);
put_device(&dev_data->dev);
ida_simple_remove(&telem_ida, MINOR(dev_data->dev.devt));
put_device(&dev_data->dev);

return 0;
}
Expand Down

0 comments on commit 856a0a6

Please sign in to comment.