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

Commit ab30f78c authored by Julia Lawall's avatar Julia Lawall Committed by Benjamin Herrenschmidt
Browse files

powerpc/pmac/windfarm: Correct potential double free

The conditionals were testing different values, but then all freeing the
same one, which could result in a double free.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/

)

// <smpl>
@@
expression x,e;
identifier f;
iterator I;
statement S;
@@

*kfree(x);
... when != &x
    when != x = e
    when != I(x,...) S
*x
// </smpl>

Signed-off-by: default avatarJulia Lawall <julia@diku.dk>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 637a9902
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -687,11 +687,8 @@ static int __devexit wf_smu_remove(struct platform_device *ddev)
		wf_put_control(cpufreq_clamp);

	/* Destroy control loops state structures */
	if (wf_smu_slots_fans)
		kfree(wf_smu_cpu_fans);
	if (wf_smu_drive_fans)
		kfree(wf_smu_cpu_fans);
	if (wf_smu_cpu_fans)
	kfree(wf_smu_slots_fans);
	kfree(wf_smu_drive_fans);
	kfree(wf_smu_cpu_fans);

	return 0;