Received: by 10.223.185.116 with SMTP id b49csp760757wrg; Wed, 21 Feb 2018 06:32:21 -0800 (PST) X-Google-Smtp-Source: AH8x2258FCO35EmraHd0P/Ok34hEfZVnwM07Fu4hkXvY7ci/mkEx5VPbjlAWKUsW4fHrF0pg9x5F X-Received: by 2002:a17:902:b7c1:: with SMTP id v1-v6mr3336541plz.315.1519223541221; Wed, 21 Feb 2018 06:32:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519223541; cv=none; d=google.com; s=arc-20160816; b=afpwsQcb9ufIGxFtdX+jRB8BeiruGN05IZ78SSdZOXVZFTj4FIROc9z23IzuLt3Yb3 8pFMp1HlX4wwQcFPY2ZFOqiPDYKlKLncGt/Mb+meVx6p2KBQHQiiM2pQBhTNeG32yMNX zSfjIAtq2VJz9VSMfPebnRk++tEappAmhjDChQx5UH6H1MWLtqlxSqLp+c9xyC1h9KVr P7kmjmS7zuPhLS0UHhYrhznIOH1X/yDL20Fk/g08A/2ECzWYxq+fsJFANhAyRax6vz5T TYt7ps1igMoKAFOCslcqGONLl0ZYStLDumv1ThPiHIkg3kRi7dU0z6qL9HmaCHdjn3l4 a6kQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=kfnZTumOzjeDrwFhksVs+aauo7sKDnROKLl38RTK0r8=; b=vAyxjJSv+/mcaMij8xEVTy1EPrZteawZ0MDI0L7Y58Dintyel14GX8h95L+vKBFwP0 lIxttqkZ2S/Mu+Ai1ZdDF5sqR9LsNJtSCnOV8kRx3a5MEAS+hx/Gja8oHgBz4fhaulaL yR3ZTGGlSOgYw2RDVNqrEpnBVOz11okvnxhO4rEFijeADTsOQthDytKGdIumPEFGrgeN Qj5g5FCZAnxn/cmz1Q0eheakaYzXWFoX/1jJ7FF7FLLuVbNqm2dJ73L9wGn2w+eTBDe+ gSPEuU58SIVN8z7BYNHmz6/SmQRZlkhTrdodxtmOYbGEOE/dWYsLjTuMuV2bma3ITvnA qaFA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m3-v6si2359402pll.717.2018.02.21.06.32.06; Wed, 21 Feb 2018 06:32:21 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934440AbeBUM4Q (ORCPT + 99 others); Wed, 21 Feb 2018 07:56:16 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:34690 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932696AbeBUM4O (ORCPT ); Wed, 21 Feb 2018 07:56:14 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 974F0119F; Wed, 21 Feb 2018 12:56:13 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jean-Christophe PLAGNIOL-VILLARD , Nicolas Ferre , Alexandre Belloni , Johan Hovold , Bartlomiej Zolnierkiewicz Subject: [PATCH 4.9 14/77] video: fbdev: atmel_lcdfb: fix display-timings lookup Date: Wed, 21 Feb 2018 13:48:23 +0100 Message-Id: <20180221124432.767583629@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180221124432.172390020@linuxfoundation.org> References: <20180221124432.172390020@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Johan Hovold commit 9cb18db0701f6b74f0c45c23ad767b3ebebe37f6 upstream. 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 Cc: Nicolas Ferre Cc: Alexandre Belloni Signed-off-by: Johan Hovold Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Greg Kroah-Hartman --- drivers/video/fbdev/atmel_lcdfb.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- 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 at 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 at 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: