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

Commit 9bd40807 authored by Qinglang Miao's avatar Qinglang Miao Committed by Greg Kroah-Hartman
Browse files

mips: cdmm: fix use-after-free in mips_cdmm_bus_discover



[ Upstream commit f0e82242b16826077a2775eacfe201d803bb7a22 ]

kfree(dev) has been called inside put_device so anther
kfree would cause a use-after-free bug/

Fixes: 8286ae03 ("MIPS: Add CDMM bus support")
Reported-by: default avatarHulk Robot <hulkci@huawei.com>
Signed-off-by: default avatarQinglang Miao <miaoqinglang@huawei.com>
Acked-by: default avatarSerge Semin <fancer.lancer@gmail.com>
Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 064403b1
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -544,10 +544,8 @@ static void mips_cdmm_bus_discover(struct mips_cdmm_bus *bus)
		dev_set_name(&dev->dev, "cdmm%u-%u", cpu, id);
		++id;
		ret = device_register(&dev->dev);
		if (ret) {
		if (ret)
			put_device(&dev->dev);
			kfree(dev);
		}
	}
}