Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp852465pxk; Thu, 17 Sep 2020 19:06:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAUSTrZueuX7YeMtXmqBavP1E6aDwwdFZS4htQqvEJgINnrMVJyClQCWgr9lTVyewwbaTs X-Received: by 2002:a17:906:fb15:: with SMTP id lz21mr21554309ejb.185.1600394773212; Thu, 17 Sep 2020 19:06:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600394773; cv=none; d=google.com; s=arc-20160816; b=Ql/VRf+KRJ5iHdJohnhfVQ19tZy4mRYJtJZDQN9IR333za7tG47/R2zeBbIR1pwzRp 8/wn7Kqmmh22cja9/Oul0DreBwNyEJDwsiKJ7/V2a+asjMSMKorNEoynR7nNbf7v2vtr VN/bboygImu4VP1R94pB4jKCORc+yeL/6hmCQ7cM50xZkmjWHAVJsz9ZAvz+FuBdsXHL iGOOKfFCrhAHzIFopYTA2EdnKMtyCM7ltz4PCoSqZCGgTkXbVkY4hSPlUV8Y0dcRqTEe 6TP44RppMtQRoB6tnCSa4Ze/MQ9ih1ZkJNPLz3Y63CFDFgkIMISgQCdS6q0/NQpxO20d iVBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hfbyJyZJ1CnO80At1R75KNKqwalCLI+774zDjUQ3LmE=; b=wm4EoIG04+FLlWR3focbt2HyFrs4+Qej8QUjdVLlQv3KFMT+EhMNpcDconA1fz9QpG J9d0quZknuJ0W13jARTFLQtGI7uX1KzmB7c1J4HLMlIewQMQivbIOP2U+pJPIM0DoxRS 4ZcknnIgjPmrEekj9KytLIHTDU2V2LcmPv9BG3fzQ/bqltQEyYcE7QBexufAAZzzgmQE eEG2ZogAIKPFG6Zdkn/BXKBqGLACOrJUuHJ2aKi0g74p99WQKr7eTGEpbmDiivuFqsmu 7rIRPvp3leh1Hl9ZWaqScl4tLWareLtaISc6A5I/dMY32/7Hqt76bzGs7d7yc97L5dV2 7CJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fLienNWS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w24si1255099ejq.224.2020.09.17.19.05.50; Thu, 17 Sep 2020 19:06:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fLienNWS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727183AbgIRCDx (ORCPT + 99 others); Thu, 17 Sep 2020 22:03:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:50362 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727137AbgIRCDp (ORCPT ); Thu, 17 Sep 2020 22:03:45 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5F78D23730; Fri, 18 Sep 2020 02:03:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600394624; bh=r4XzyFgrIDnrhs5XvlCuud1IHd6giWhagg01ZUiKYBA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fLienNWS3qzh2BUMyWVb19uPluewWbewR+sQ1rlIFaMEKNzyphv/kGjFQ+DtyKT/H pObE/MUsgj7V6CzAZ6bap+Atcyh9IefpjTZqx5DKR7brSoeIgTUb++Dd1VFJbZgZaq 534aTuVqC3sNj0iKHxxXf7WJAsI4X9lkCKXWsWR4= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Wen Yang , Laurent Pinchart , Mukesh Ojha , Tomi Valkeinen , David Airlie , Daniel Vetter , Sebastian Reichel , dri-devel@lists.freedesktop.org, Markus Elfring , Sasha Levin Subject: [PATCH AUTOSEL 5.4 125/330] drm/omap: fix possible object reference leak Date: Thu, 17 Sep 2020 21:57:45 -0400 Message-Id: <20200918020110.2063155-125-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200918020110.2063155-1-sashal@kernel.org> References: <20200918020110.2063155-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wen Yang [ Upstream commit 47340e46f34a3b1d80e40b43ae3d7a8da34a3541 ] The call to of_find_matching_node returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage. Detected by coccinelle with the following warnings: drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c:212:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 209, but without a corresponding object release within this function. drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c:237:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 209, but without a corresponding object release within this function. Signed-off-by: Wen Yang Reviewed-by: Laurent Pinchart Reviewed-by: Mukesh Ojha Cc: Tomi Valkeinen Cc: David Airlie Cc: Daniel Vetter Cc: Sebastian Reichel Cc: Laurent Pinchart Cc: dri-devel@lists.freedesktop.org Cc: linux-kernel@vger.kernel.org Cc: Markus Elfring Signed-off-by: Tomi Valkeinen Link: https://patchwork.freedesktop.org/patch/msgid/1554692313-28882-2-git-send-email-wen.yang99@zte.com.cn Signed-off-by: Sasha Levin --- drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c index 31502857f013d..ce67891eedd46 100644 --- a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c +++ b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c @@ -192,7 +192,7 @@ static int __init omapdss_boot_init(void) dss = of_find_matching_node(NULL, omapdss_of_match); if (dss == NULL || !of_device_is_available(dss)) - return 0; + goto put_node; omapdss_walk_device(dss, true); @@ -217,6 +217,8 @@ static int __init omapdss_boot_init(void) kfree(n); } +put_node: + of_node_put(dss); return 0; } -- 2.25.1