mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alex Kazinsky <a.kazinsky@ideco.ru>
To: Thierry Reding <thierry.reding@kernel.org>
Cc: Alex Kazinsky <a.kazinsky@ideco.ru>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	Sowjanya Komatineni <skomatineni@nvidia.com>,
	Luca Ceresoli <luca.ceresoli@bootlin.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Hans Verkuil <hverkuil@kernel.org>,
	linux-media@vger.kernel.org, linux-tegra@vger.kernel.org,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
	lvc-project@linuxtesting.org, stable@vger.kernel.org
Subject: [PATCH] media: tegra-video: Check CSI subdev before error recovery
Date: Fri, 23 Oct 2026 17:18:50 +0400	[thread overview]
Message-ID: <20261023131859.95819-1-a.kazinsky@ideco.ru> (raw)

tegra_channel_get_remote_csi_subdev() can return NULL when no remote
pad is found or the remote subdevice is not a Tegra CSI subdevice.
Passing NULL to tegra_csi_error_recover() would cause an invalid
memory access through to_csi_chan().

Check the lookup result before attempting CSI recovery. This keeps
the recovery path consistent with the helper's nullable return value
and allows VI recovery to complete without accessing an absent CSI
subdevice.

This defensive check addresses a potential invalid memory access
identified by source code analysis. No runtime failure has been
reproduced.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 1ebaeb09830f ("media: tegra-video: Add support for external sensor capture")
Cc: stable@vger.kernel.org
Signed-off-by: Alex Kazinsky <a.kazinsky@ideco.ru>
---
 drivers/staging/media/tegra-video/tegra210.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/media/tegra-video/tegra210.c b/drivers/staging/media/tegra-video/tegra210.c
index a6606768fa03..82d054c9c34c 100644
--- a/drivers/staging/media/tegra-video/tegra210.c
+++ b/drivers/staging/media/tegra-video/tegra210.c
@@ -346,7 +346,8 @@ static void tegra_channel_capture_error_recover(struct tegra_vi_channel *chan,
 
 	/* recover CSI block */
 	subdev = tegra_channel_get_remote_csi_subdev(chan);
-	tegra_csi_error_recover(subdev);
+	if (subdev)
+		tegra_csi_error_recover(subdev);
 }
 
 static struct tegra_channel_buffer *
-- 
2.56.0



                 reply	other threads:[~2026-10-23 13:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261023131859.95819-1-a.kazinsky@ideco.ru \
    --to=a.kazinsky@ideco.ru \
    --cc=gregkh@linuxfoundation.org \
    --cc=hverkuil@kernel.org \
    --cc=jonathanh@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=linux-tegra@vger.kernel.org \
    --cc=luca.ceresoli@bootlin.com \
    --cc=lvc-project@linuxtesting.org \
    --cc=mchehab@kernel.org \
    --cc=skomatineni@nvidia.com \
    --cc=stable@vger.kernel.org \
    --cc=thierry.reding@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®