Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d93caacf authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: rpm-regulator-smd: correct use-after-free in rpm_vreg_device_remove"

parents c554e3ad ee1e2028
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -1281,14 +1281,16 @@ static int rpm_vreg_device_remove(struct platform_device *pdev)
{
	struct device *dev = &pdev->dev;
	struct rpm_regulator *reg;
	struct rpm_vreg *rpm_vreg;

	reg = platform_get_drvdata(pdev);
	if (reg) {
		rpm_vreg_lock(reg->rpm_vreg);
		rpm_vreg = reg->rpm_vreg;
		rpm_vreg_lock(rpm_vreg);
		regulator_unregister(reg->rdev);
		list_del(&reg->list);
		kfree(reg);
		rpm_vreg_unlock(reg->rpm_vreg);
		rpm_vreg_unlock(rpm_vreg);
	} else {
		dev_err(dev, "%s: drvdata missing\n", __func__);
		return -EINVAL;