Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2550959ybp; Sat, 12 Oct 2019 12:23:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqyFZoUeOvwLFJ8LNtPEOt1ZlQyvFYGHOjc0zbkcREDUxlKRQZCvOtCuEdDUEehIiYv3mNSv X-Received: by 2002:a05:6402:649:: with SMTP id u9mr19689182edx.200.1570908200501; Sat, 12 Oct 2019 12:23:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570908200; cv=none; d=google.com; s=arc-20160816; b=cV8pwR3A02DJqzj3UBzRaH6eIQbuclO7QuhCBncmRAhaoHpzMIZajRTSjiMq9arjFB ZueUdYLFkGVzEQrKqwNFFTD8dO/3mbFGK/AvWpEbNjJemM/amJEKURfnhpeMMUTQQx5C jzFTIJInAJxAdgyHkDUD9p15JFF2Ug3dv5elg+VFmwo2002/n7RCn5kyBCIP8F1Z24/R JSIqLbaaGAQ6r59a8lV9SCcFEl/mWE2w/0nOt0KJeKXOKmXc1o9SjfTZGILMdRQRnl0D dLJykILejDpUj2zKdxL01ot70dkRiYNJNa8a/a7T/929LQzKpxzHdDXvZzxMOxHnpg4c 5rcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=HQJU3/LoSPot9T+dJMRPqRv4aXw0MOIpjtfyaywm/aQ=; b=jjhglQk7/TIQCs03GqbvtLqpxcvg9TQWO6C6Nn4Ubz9HZfcesyWY4xgypM1pVOwRRe Sc7bmkmZ/kvwT2Crc4H1fXLvSvXVqbeB4zaOBP98SYxhsAXPEBz9cgUG056er2d6Xqj1 NXv3/yZcJs7qgqpwIqEUGVxJCwL9WN8ZFkYDBjAbsKr+5KM9t95gSDt2AWpEZ0Tef70w 8Lfzm98uHKsrSLJK4i9XOxxVE/682kCxI6VcVJgoJsSZKUvU2/yxhLQ8vBsxHXM1k/zt QNRN91X5ZLGz3/oZL0MhpSIjbI842mF5wovCyBeF4wAyH4TlLzvfRLSFpH+WBtZ8BnvX gnfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ctY1dTvK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z6si8949003edm.316.2019.10.12.12.22.56; Sat, 12 Oct 2019 12:23:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ctY1dTvK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729469AbfJLTWa (ORCPT + 99 others); Sat, 12 Oct 2019 15:22:30 -0400 Received: from mail-io1-f65.google.com ([209.85.166.65]:41217 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729384AbfJLTWa (ORCPT ); Sat, 12 Oct 2019 15:22:30 -0400 Received: by mail-io1-f65.google.com with SMTP id n26so28477051ioj.8; Sat, 12 Oct 2019 12:22:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=HQJU3/LoSPot9T+dJMRPqRv4aXw0MOIpjtfyaywm/aQ=; b=ctY1dTvKbUjja1n+HmJ/0QdJo4l9dAMkFi10eQfrFjsqgOWit80kgCnq30q0OeiWfa /aUwSbUbZJTKgMLaQRHrc735ma+8k8xg3+RuKcs08/Y27Bvp2HmB3VCXVh53JIpeepH1 Ex6BkyIFuWyhgQ4hj3IvriacAVaZFw7DIOvS0t56h7sEO7TnQ2FbSzJDxvuUFfVYZfpm 8i8ceDDgjqJO4QPLbUuA7rjn5ssg3y1AC1+0v+G8txow0cuyM+hhZA63VbZBlCaXGXA2 Cp4ZiJNXwdEapBQhk8X9d8hv+/l895BVSFvmchGs1gyzKBV8A4NRrRo6EFq1qAYA7zW9 Z1YA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=HQJU3/LoSPot9T+dJMRPqRv4aXw0MOIpjtfyaywm/aQ=; b=R01HaeOXcg3Pxc2lmR/f+oHrAkffh7C4DJn1wqzNGbyF+NtjbRLhDXeD7X2k/Dq+W7 K9nq0twVv7Kcb6Jts+XEk1UiSZIj3yEZHc1F6ral/BNkhUcS8AZ8OX4UliOjV67XyDx0 HRGZ1qTr+F98Z5L9vK+TBrmlEai2Vyp87lDRr/G0rRUF4K9+F0B47CXF2UDcI72juOJg rL+aKi6hPPH7HY9KsvnTBPAOQOSMKmtcGeuyxnOKz1FQynvFagB8eRZkJYT9V7AUNYAt KnWLoGi07vbJxSLMFmtaQcG6AT2EBmga9xb3McStmMSZzUySvl1dgdiJsHRjTu9/4eXH 9CCA== X-Gm-Message-State: APjAAAXzLvV8R6psk3vmBdGN6X+iM/lzEce0KGGAYkgqJC2Le7Ybwj84 vqd8wqJDhmvcfUjtBItoajKKxhN7u70Y9mtEAkc= X-Received: by 2002:a02:7b0d:: with SMTP id q13mr25703029jac.114.1570908149253; Sat, 12 Oct 2019 12:22:29 -0700 (PDT) MIME-Version: 1.0 References: <20191004190938.15353-1-navid.emamdoost@gmail.com> <027fde47-86b3-35c8-85e6-ea7c191e772c@web.de> In-Reply-To: From: Navid Emamdoost Date: Sat, 12 Oct 2019 14:22:18 -0500 Message-ID: Subject: Re: [PATCH] drm/imx: fix memory leak in imx_pd_bind To: Markus Elfring Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, NXP Linux Team , Pengutronix Kernel Team , Navid Emamdoost , Kangjie Lu , Stephen McCamant , Daniel Vetter , David Airlie , Fabio Estevam , Philipp Zabel , Sascha Hauer , Shawn Guo , LKML , kernel-janitors@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org No, that is not correct! You should not try to free imxpd here as it is a resource-managed allocation via devm_kzalloc(). It means memory allocated with this function is automatically freed on driver detach. So, this patch introduces a double-free. On Sat, Oct 12, 2019 at 6:54 AM Markus Elfring wrot= e: > > > +free_edid: > > + kfree(imxpd->edid); > > + return ret; > > I have taken another look at this change idea. > Can the function call =E2=80=9Cdevm_kfree(dev, imxpd)=E2=80=9D become rel= evant > also at this place? > > Would you like to combine it with the update suggestion > =E2=80=9CFix error handling for a kmemdup() call in imx_pd_bind()=E2=80= =9D? > https://lore.kernel.org/r/3fd6aa8b-2529-7ff5-3e19-05267101b2a4@web.de/ > https://lore.kernel.org/patchwork/patch/1138912/ > https://lkml.org/lkml/2019/10/12/87 > > Regards, > Markus --=20 Navid.