Skip to content

Commit 856a0a6

Browse files
tasksetEnric Balletbo i Serra
authored andcommitted
platform/chrome: wilco_ec: fix use after free issue
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]>
1 parent 74c166b commit 856a0a6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/platform/chrome/wilco_ec/telemetry.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,8 @@ static int telem_device_remove(struct platform_device *pdev)
406406
struct telem_device_data *dev_data = platform_get_drvdata(pdev);
407407

408408
cdev_device_del(&dev_data->cdev, &dev_data->dev);
409-
put_device(&dev_data->dev);
410409
ida_simple_remove(&telem_ida, MINOR(dev_data->dev.devt));
410+
put_device(&dev_data->dev);
411411

412412
return 0;
413413
}

0 commit comments

Comments
 (0)