Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1279695ybp; Fri, 4 Oct 2019 12:11:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqy6hCcVZYA56bb6JSzzW8Bi+lT6xQkypjUU+dJYVizhowum/pt4I5pegVfjfv4zTvSZnoIU X-Received: by 2002:a50:e616:: with SMTP id y22mr16894575edm.253.1570216262651; Fri, 04 Oct 2019 12:11:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570216262; cv=none; d=google.com; s=arc-20160816; b=AISRfBdUeclMFki3ik7+MFA5aPqyZxLUcOPouxMS/O98UiF+9ZVGHr1sG5FleXwZ2r 8saG0MyYbTYu0D3PC2s6Y3iQQ4Xiaa6M6imme8jHvsrobgn1F85VYeUPjKpmZwodKaF9 Nv398blTUQRB2jjgv56+kfwWYCFXW3WZxj3ARDSpSwH/0KQ+mla2CQsHx2d6skupXTs/ A7KWdrP6mFAlNT4YLrWzvek/Yo8/pNEz2u/Wq1YvlhHRhK1HzWu+z4vxemSxn/eeJb7F KBHqfDPyaLD0ZF8UtWY5IN7342CtVwgzTK0JZ9dyc7RURdU4OwFe1HU/+6JmKJDI3G/v lmEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:message-id:date:subject:cc:from :dkim-signature; bh=7XAUCdbkHP+3qeD8IAi87BfnaeBU6yWduxm7aN24lrc=; b=vkeU7fWJ47lKNyKcS5mfRFKSIMzipVRXi9fYcYB5KSh57atpkE6hdEjFlYjScf+JAj Do4FegM977LqyDLkatq3kQd916jT88TYufk09UPDr/R2DRvOXKD25g88iyBH69a2Cd1l XCE/ovRj2rsQSXDK9rKY39q/3Cs1MkriOChBG1M6kPa6UgAcKZEJWbYrnoYiavCd6I5z 3mG+26sDvne/1p8NyYC/vBY/hNF76MWeswKNHVean3XZET0YMo4lxkYiL5k5pVJHCofF acWqLy2DYijwDZiqu99d2wL0c4ScO2WtxeTyuvVkxkDyRYeeCkVnh7hMT6tRvwPqFqCa uRuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=PIZU3DOC; 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=fail (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 g21si3969799edq.289.2019.10.04.12.10.38; Fri, 04 Oct 2019 12:11:02 -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=fail header.i=@gmail.com header.s=20161025 header.b=PIZU3DOC; 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=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729648AbfJDTJx (ORCPT + 99 others); Fri, 4 Oct 2019 15:09:53 -0400 Received: from mail-io1-f65.google.com ([209.85.166.65]:37812 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727308AbfJDTJx (ORCPT ); Fri, 4 Oct 2019 15:09:53 -0400 Received: by mail-io1-f65.google.com with SMTP id b19so15908254iob.4 for ; Fri, 04 Oct 2019 12:09:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=7XAUCdbkHP+3qeD8IAi87BfnaeBU6yWduxm7aN24lrc=; b=PIZU3DOCNHkv//gcgVRRCWke4OqJTknwSMnrMGdlNMOQk5+OAk2CU4eRA34YoyeI4i gHzd0EfCXxavyvjfJn0MEx83fyTJBpGqHOYEwYVHvak3hPaPlD8CYK2VMCI3j6k8KkUO 4qYEotBxrvW3HOa00czkUrEfMxl0WQVCa/f+/TEFQG2xBwyaOa+0MscWPyTZOwaG6g6Q Xa0RkY7Hqn/tViO/qtkRply5N8osvwqlWLW7HB5etrBY4jZGqLwS4Q1UWa1QuiSjCLqj bK1scbdu/XQLmH5D4kn6Zkup5bU3uv06GghskxHr+l57gDDzh5PhGchgmewNS0NDI6Pp qrbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=7XAUCdbkHP+3qeD8IAi87BfnaeBU6yWduxm7aN24lrc=; b=XFg8pSHz87HV1Oni3RpuT4zc0FZxKTLITQ/CMIl+f8yi8Znp/ulIxx/a4TxstlKPr1 zHBU/8NdFaXPUSN1D3g0Id4TJvnZiJKo6Givi6NiOmIdXDugMTBZ+pR1vShFQodKMraI JnGZmVPk726bkBAyJwamJJFjCA7IRtWPCqxAXU7Ewl13ojSgZGZlLXyX6xxAoF47hYz+ 9c2hMZjR11cvIGPAFdIwaiRYwYPLxQYZ45KJUdyuTFc5+oOcxJrDR8YySGX9yeQQBfcM LC2pShsQv5MK6nUpXsdWXHxoKzRb6u/Y16AMLGG2w9UpTAEZ86ttT1tkNHAczNMLltcG h6uA== X-Gm-Message-State: APjAAAU9Ua2S5zMAznRLcPmlrmQFmN8WPEH8zE+5xZsY5a38u//po8jR s9gjMQik4NIHg0ReA3W4uFY= X-Received: by 2002:a6b:3bc9:: with SMTP id i192mr2438459ioa.295.1570216190936; Fri, 04 Oct 2019 12:09:50 -0700 (PDT) Received: from cs-dulles.cs.umn.edu (cs-dulles.cs.umn.edu. [128.101.35.54]) by smtp.googlemail.com with ESMTPSA id i26sm2722087iol.84.2019.10.04.12.09.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Oct 2019 12:09:50 -0700 (PDT) From: Navid Emamdoost Cc: emamd001@umn.edu, kjlu@umn.edu, smccaman@umn.edu, Navid Emamdoost , Philipp Zabel , David Airlie , Daniel Vetter , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] drm/imx: fix memory leak in imx_pd_bind Date: Fri, 4 Oct 2019 14:09:33 -0500 Message-Id: <20191004190938.15353-1-navid.emamdoost@gmail.com> X-Mailer: git-send-email 2.17.1 To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In imx_pd_bind, the duplicated memory for imxpd->edid via kmemdup should be released in drm_of_find_panel_or_bridge or imx_pd_register fail. Fixes: ebc944613567 ("drm: convert drivers to use drm_of_find_panel_or_bridge") Fixes: 19022aaae677 ("staging: drm/imx: Add parallel display support") Signed-off-by: Navid Emamdoost --- drivers/gpu/drm/imx/parallel-display.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/imx/parallel-display.c b/drivers/gpu/drm/imx/parallel-display.c index e7ce17503ae1..9522d2cb0ad5 100644 --- a/drivers/gpu/drm/imx/parallel-display.c +++ b/drivers/gpu/drm/imx/parallel-display.c @@ -227,14 +227,18 @@ static int imx_pd_bind(struct device *dev, struct device *master, void *data) /* port@1 is the output port */ ret = drm_of_find_panel_or_bridge(np, 1, 0, &imxpd->panel, &imxpd->bridge); - if (ret && ret != -ENODEV) + if (ret && ret != -ENODEV) { + kfree(imxpd->edid); return ret; + } imxpd->dev = dev; ret = imx_pd_register(drm, imxpd); - if (ret) + if (ret) { + kfree(imxpd->edid); return ret; + } dev_set_drvdata(dev, imxpd); -- 2.17.1