Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2380765lqp; Sun, 24 Mar 2024 16:52:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX8OdtypUX2e0pIFgAORHcqv6tTT+ZKLwxJhYSSd9pIqnwVjHvBcaOV6xyez9jl4DULimnnRgAyzxelVgv/i+2Am1sgAnvfZA38SWZnGg== X-Google-Smtp-Source: AGHT+IEswAQBJ4NFyjDsV+kMjQHlfCRoeOFZNqh/4zOLdqq2ZtrZsddSkmBAFybeya6kE5TzCtaz X-Received: by 2002:a17:902:d2cf:b0:1de:f840:fb22 with SMTP id n15-20020a170902d2cf00b001def840fb22mr6272407plc.12.1711324377173; Sun, 24 Mar 2024 16:52:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711324377; cv=pass; d=google.com; s=arc-20160816; b=Nay9ysOGy6j5BQGFYzkcoauAmI7FDNogfHQ6xpZRlDYUvz2y28lMmqqW5aG0xvJhR6 9yAFXdAgo4VnYp0HtVOka8wgQUJugRM0neE95VZMSvmXDgZk7uh/QlgbNi4zwcSiWLJU X69JeUX+n0hIyOhwW1pL9EAIed4dediz9chNUqGh9KmxF/CGIrJ8d5eDW5SbNs3dAa3T dRDlPLsKIlKEc37PqlAANyimAWN6Nd97N0EcPlPVdDjlQBAoAQzwnkW/YQ6i6Gc4OTZe YMw+z6JpoZYhbkm/HBE9dJNqc0QwspTGH3t7ZrfoPp1zQyjkQIMH8ijEHZwCzWaaSZMN EDPA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=OjipzOf34IpLefdIWq8+AKaRD1n6dwy29mNpRPz/Wc0=; fh=Cj0Y2tk+d10LBKiUs6tQvlX+lUI1tgKyv4hYLBJ8GNU=; b=EgexTpk09JnCuhLhZ91yt4zqcSf3uu/xB4NjWbnvtu5O645eY8u1TFT73GgsE8DB3a KuPedIjt2RtT9vumyFoFp+2MH/kQ+WEP/LuGEb6vh9AzG7F5isjf4824fenqDfEkQ984 pJ7DBBPr0sCuG9QxUKLFTqm4ipPZ8BqtELT/K1/hSFlvD/MGQHXfYGZQqFjwTcw3Ebgp vQv0hRyOhSCzSwPVf/+5tYtSIufKhfxqHYwJVNLMCiRJOEveKswkFOW+N16JYo4hc0u4 asto7is8jTYBu36s8Zb+jqlKYlKbpGR/mawwNx2m8NRbIsKuqyJ1+GILk6AwdAqgMvtA NtLQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gpJx3hUF; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113241-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113241-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id n2-20020a170902f60200b001e0968003cfsi4090982plg.383.2024.03.24.16.52.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 16:52:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113241-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gpJx3hUF; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113241-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113241-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id D012E289B2F for ; Sun, 24 Mar 2024 23:52:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EBD2B1856A7; Sun, 24 Mar 2024 22:40:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gpJx3hUF" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 03AFD184F0E; Sun, 24 Mar 2024 22:40:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320042; cv=none; b=DrAM481EWMBlxAlxrSSn40lctqx/awQRceo20c9yJD3NMgJ9oNdM1Xedi9rl+fsF5JpCZyOz74OVo2xgNGQKtG1885GOiame4rh1Sp7hd3mMSmnEqDUMBGdXLjEOdLm2hgLXctZCEtbs6YfduPVh8ouAoeps3gOp37iJZaoe4IE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320042; c=relaxed/simple; bh=1wD1lMemO0UeL75hTPilrXieqNAbYo6cSZgOGib9LQ8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=alQoa0aTNK7GRU+nhuM4RhA89lIvN/oeRuaC4kLeEqcESounLK6muP/yKjJileykuhJKYFxmw1vacu2JWrmDC6u+9qgXILUKYegSMWPVDSmbraFmFpzRYZ/wVrxcDTPUhiwHaSxifPIoS18e4xZn+x4wlS1WX3JlRkkvV+Nbei8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gpJx3hUF; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 468C0C433C7; Sun, 24 Mar 2024 22:40:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711320041; bh=1wD1lMemO0UeL75hTPilrXieqNAbYo6cSZgOGib9LQ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gpJx3hUFCMHfU7vGziacMttX6Kr8GJN5wAMxLC8drdjiVYMyPoYkLNvZ1/0vAtK84 MUCkCqX/lHysGqPbbfbNST6z3Wn2Eh+w4etSFAe5El1gGG2WBkGcvhzGdKvefHjQBR Al8dd0XlCaymXMYnkw35DebDyXs7u5M1aDpNces3z+mqUnNinruUBmi7kYe+fOOhc6 SA30XluDD+TKE0NvdyWzS7WWqU62kRH9W4Cc8h4GqAfUEIguuRDwI+ONEDmpcIDT07 0UxNa1XrxCjmAP234aJe3oEyHc0qyLIMXXM9bDqtn4q8QnqqPnR+I9htHT9ptI+rDo QzpXgvO9tu/1w== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Chen Ni , Thierry Reding , Sasha Levin Subject: [PATCH 6.8 350/715] drm/tegra: dsi: Add missing check for of_find_device_by_node Date: Sun, 24 Mar 2024 18:28:49 -0400 Message-ID: <20240324223455.1342824-351-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Chen Ni [ Upstream commit afe6fcb9775882230cd29b529203eabd5d2a638d ] Add check for the return value of of_find_device_by_node() and return the error if it fails in order to avoid NULL pointer dereference. Fixes: e94236cde4d5 ("drm/tegra: dsi: Add ganged mode support") Signed-off-by: Chen Ni Signed-off-by: Thierry Reding Link: https://patchwork.freedesktop.org/patch/msgid/20231024080738.825553-1-nichen@iscas.ac.cn Signed-off-by: Sasha Levin --- drivers/gpu/drm/tegra/dsi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c index fbfe92a816d4b..e419b76e57d3e 100644 --- a/drivers/gpu/drm/tegra/dsi.c +++ b/drivers/gpu/drm/tegra/dsi.c @@ -1544,9 +1544,11 @@ static int tegra_dsi_ganged_probe(struct tegra_dsi *dsi) np = of_parse_phandle(dsi->dev->of_node, "nvidia,ganged-mode", 0); if (np) { struct platform_device *gangster = of_find_device_by_node(np); + of_node_put(np); + if (!gangster) + return -EPROBE_DEFER; dsi->slave = platform_get_drvdata(gangster); - of_node_put(np); if (!dsi->slave) { put_device(&gangster->dev); -- 2.43.0