From patchwork Mon Nov 13 10:27:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 10056339 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 000AC60365 for ; Mon, 13 Nov 2017 15:48:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E5F262937C for ; Mon, 13 Nov 2017 15:48:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DAA6B29428; Mon, 13 Nov 2017 15:48:17 +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, 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]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E04A929386 for ; Mon, 13 Nov 2017 15:48:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D793B6E091; Mon, 13 Nov 2017 15:48:15 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x241.google.com (mail-lf0-x241.google.com [IPv6:2a00:1450:4010:c07::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8639D6E0E0 for ; Mon, 13 Nov 2017 10:27:55 +0000 (UTC) Received: by mail-lf0-x241.google.com with SMTP id 73so3370932lfu.10 for ; Mon, 13 Nov 2017 02:27:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=gCooSwcsN5ZKsS62ZlsoTKH89Y72SMj8ctjb3uSA/Mg=; b=TWePc+O2qodpgDfQh9xWHzSwBTLaVHVCeJX8YzPPDUzcbqLhzKg3H3g5MuV5spdyVo o8sm8TOIY/u7Bo0nRVqJHDmAwu2oFKD8B2BfNLdDFEbBMJRFBabbo/DzcT2lXyj0ge42 morgYXFBrDoVXQrxDuYaBlA0dlzBEWTOEXQQku6me7EjrHvU20zBBHGO9CWAgUE+V65t XjGEK4WYYYvQ1mmi1KE5oIKIbu3ulFwtnSsy0BO/xoI+BaJYfInoRxWZizSgpc25hbKz f8h3PHcWRpM6GVvTUGE8SlBQmDyIuW8pizSuDNLF1ELd58nq3J8Egu3YAfjAlsL6aM4U EGdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=gCooSwcsN5ZKsS62ZlsoTKH89Y72SMj8ctjb3uSA/Mg=; b=NlkskBBrV9NwcssCjKxC3Etf0FAgpaOgCrUMqq2Lc7TiGZlbdQ27W+8t2shc2gzHel KNE3hp+ToTAvXmgYJAtI9E1p9AFs/y0aRk98z66RIQtwNZ0NFt/xP2ealX1VbqnKRPJG tGpHeVU+5S23K02VcLxFlticIpNK4TPNWpIGLB174lDRxSba1XyG8ERLkKK5N8AuAQHt YemOvf48BFW0HnBWwHFmjLAu0Og7LIk376aFDJW/LHEuGvDkG/6VXCw44Y8YPlFPOqpD XtdyzqCNfZG/KMzQAM4PqqZ561aa8UAlzcsvW+vRgoZxpkrcm6x4xJZP9EN75MnONn1E Pfyw== X-Gm-Message-State: AJaThX7Gq728BNYXGyL51EIS6J0OK1y/Nyqf+9oeJpIKTmdJGBk6RLGR I8a82mYGrZAH1iV3kXPbLkA= X-Google-Smtp-Source: AGs4zMaUSdKY47e0/irklZ4sFftWCX0RFPW8u3cPudCgeL+uoJjkrEXPhmueSZZzhA5n6hQeIrm1Jg== X-Received: by 10.46.68.73 with SMTP id r70mr3213426lja.174.1510568873879; Mon, 13 Nov 2017 02:27:53 -0800 (PST) Received: from xi.terra (c-c0bae655.07-184-6d6c6d4.cust.bredbandsbolaget.se. [85.230.186.192]) by smtp.gmail.com with ESMTPSA id m18sm647437lje.21.2017.11.13.02.27.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Nov 2017 02:27:53 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.89) (envelope-from ) id 1eEByB-0002WO-J9; Mon, 13 Nov 2017 11:27:59 +0100 From: Johan Hovold To: Nicolas Ferre Subject: [PATCH] video: fbdev: atmel_lcdfb: fix display-timings lookup Date: Mon, 13 Nov 2017 11:27:19 +0100 Message-Id: <20171113102719.9634-1-johan@kernel.org> X-Mailer: git-send-email 2.15.0 X-Mailman-Approved-At: Mon, 13 Nov 2017 15:48:14 +0000 Cc: linux-fbdev@vger.kernel.org, Bartlomiej Zolnierkiewicz , Johan Hovold , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Alexandre Belloni , stable , Jean-Christophe PLAGNIOL-VILLARD 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: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Fix child-node lookup during probe, which ended up searching the whole device tree depth-first starting at the parent rather than just matching on its children. To make things worse, the parent display node was also prematurely freed. Note that the display and timings node references are never put after a successful dt-initialisation so the nodes would leak on later probe deferrals and on driver unbind. Fixes: b985172b328a ("video: atmel_lcdfb: add device tree suport") Cc: stable # 3.13 Cc: Jean-Christophe PLAGNIOL-VILLARD Signed-off-by: Johan Hovold --- drivers/video/fbdev/atmel_lcdfb.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/video/fbdev/atmel_lcdfb.c b/drivers/video/fbdev/atmel_lcdfb.c index e06358da4b99..3dee267d7c75 100644 --- a/drivers/video/fbdev/atmel_lcdfb.c +++ b/drivers/video/fbdev/atmel_lcdfb.c @@ -1119,7 +1119,7 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo) goto put_display_node; } - timings_np = of_find_node_by_name(display_np, "display-timings"); + timings_np = of_get_child_by_name(display_np, "display-timings"); if (!timings_np) { dev_err(dev, "failed to find display-timings node\n"); ret = -ENODEV; @@ -1140,6 +1140,12 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo) fb_add_videomode(&fb_vm, &info->modelist); } + /* + * FIXME: Make sure we are not referencing any fields in display_np + * and timings_np and drop our references to them before returning to + * avoid leaking the nodes on probe deferral and driver unbind. + */ + return 0; put_timings_node: