[PATCH -next] drm/tegra: sor: Fix invalid kfree of devm_kzalloc allocated data

weiyj_lk at 163.com weiyj_lk at 163.com
Mon Jul 4 07:19:19 UTC 2016


From: Wei Yongjun <yongjun_wei at trendmicro.com.cn>

data allocated with devm_kzalloc should not be freed using kfree,
because doing so causes a dangling pointer, and a subsequent
double free, use devm_kfree instead.

Signed-off-by: Wei Yongjun <yongjun_wei at trendmicro.com.cn>
---
 drivers/gpu/drm/tegra/sor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c
index 8425eda..af98587 100644
--- a/drivers/gpu/drm/tegra/sor.c
+++ b/drivers/gpu/drm/tegra/sor.c
@@ -363,7 +363,7 @@ static struct clk *tegra_clk_sor_brick_register(struct tegra_sor *sor,
 
 	clk = devm_clk_register(sor->dev, &brick->hw);
 	if (IS_ERR(clk))
-		kfree(brick);
+		devm_kfree(sor->dev, brick);
 
 	return clk;
 }




More information about the dri-devel mailing list