From patchwork Mon Jul 4 07:19:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: weiyj_lk@163.com X-Patchwork-Id: 9211855 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 25AA960572 for ; Mon, 4 Jul 2016 08:08:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 146F5284FA for ; Mon, 4 Jul 2016 08:08:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0972C28522; Mon, 4 Jul 2016 08:08:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6ED4F284FA for ; Mon, 4 Jul 2016 08:08:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1F5616E3C6; Mon, 4 Jul 2016 08:08:02 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 953 seconds by postgrey-1.35 at gabe; Mon, 04 Jul 2016 07:35:38 UTC Received: from m12-18.163.com (m12-18.163.com [220.181.12.18]) by gabe.freedesktop.org (Postfix) with ESMTP id 811306E17B for ; Mon, 4 Jul 2016 07:35:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=eLuyj x2+qeKJx7aPNI5Z+sb0Tm76JHOGSrwzjywpzX0=; b=nsj5ztwljgQWqlc/cr071 jBPs303u/2iHmEZOePDbI3h+4H8mEKDredmtNkZ07tsYA66iQi43TK8FIpi31X5k l5WrCmtauz8OScfN9UKWb12zQTFGpgjy4czRhu+ai5p3pd0610t1WUoZNse8aRGb DmszTH0SUh0P3TYhKKmJPk= Received: from localhost.localdomain.localdomain (unknown [61.155.4.70]) by smtp14 (Coremail) with SMTP id EsCowAD3fE73DXpXdIsdAw--.6763S2; Mon, 04 Jul 2016 15:19:20 +0800 (CST) From: weiyj_lk@163.com To: Thierry Reding , David Airlie , Stephen Warren , Alexandre Courbot Subject: [PATCH -next] drm/tegra: sor: Fix invalid kfree of devm_kzalloc allocated data Date: Mon, 4 Jul 2016 15:19:19 +0800 Message-Id: <1467616759-14502-1-git-send-email-weiyj_lk@163.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-CM-TRANSID: EsCowAD3fE73DXpXdIsdAw--.6763S2 X-Coremail-Antispam: 1Uf129KBjvdXoW7Wr4kWFy7Kw43ZrWkCrWkXrb_yoW3ZrX_GF WrZrnIq348WFZFvry3ur43ZFyS9F1kur4rWF1rKasrKa4jvrsxWr9xury5Zry5WanrJFnr J3yIgr1fZFnxKjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUnBT5PUUUUU== X-Originating-IP: [61.155.4.70] X-CM-SenderInfo: pzhl5yxbonqiywtou0bp/1tbiJRic1lUMAluPGQAAsh X-Mailman-Approved-At: Mon, 04 Jul 2016 08:08:00 +0000 Cc: linux-tegra@vger.kernel.org, Wei Yongjun , dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Wei Yongjun 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 --- 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; }