Linux Media Controller development
 help / color / mirror / Atom feed
* [PATCH v2 0/7] media: Fix mishandling of MEDIA_PAD_FL_MUST_CONNECT flag
@ 2024-01-16  8:42 Laurent Pinchart
  2024-01-16  8:42 ` [PATCH v2 1/7] media: mc: Add local pad to pipeline regardless of the link state Laurent Pinchart
                   ` (6 more replies)
  0 siblings, 7 replies; 11+ messages in thread
From: Laurent Pinchart @ 2024-01-16  8:42 UTC (permalink / raw)
  To: linux-media
  Cc: Alexander Shiyan, Fabio Estevam, Frieder Schrempf, Jacopo Mondi,
	Kieran Bingham, Marek Vasut, Martin Kepplinger, Rui Miguel Silva,
	Sakari Ailus, Tim Harvey, Purism Kernel Team

Hello,

This patch series fixes mishandling of the MEDIA_PAD_FL_MUST_CONNECT
flag.

The issue has been introduced in commit ae219872834a ("media: mc:
entity: Rewrite media_pipeline_start()") when reworking the media
controller pipeline validation code. It is known to cause crashes in the
imx-mipi-csis driver (see [1]) and most likely affects multiple other
drivers. Patch 1/7 and 2/7 fix the problem.

Patches 3/7 to 7/7 fix an additional related issue affecting the
imx8-isi driver. It is however not a regression introduced by commit
ae219872834a. The problem causes a NULL pointer dereference when
enabling streams if the pipeline is configured with the imx8-isi
crossbar sink pad not being connected. Patch 3/7, initially submitted by
Marek, fixes the issue in the imx8-isi driver itself.

As the problem is very similar to what the MUST_CONNECT flag was
designed to handled, I considered the bug to be better solved by using
the MUST_CONNECT flag in the imx8-isi driver. This requires expanding
the purpose of the flag (patch 6/7), after a few drive-by fixes and
reworks (patches 4/7 and 5/7). Finally, patch 7/7 sets the MUST_CONNECT
flag in the imx8-isi driver, effectively reverting the changes from
patch 3/7.

I have decided to still include patch 3/7 in the series, as in the even
that the changes in patches 4/7 to 7/7 were to be reverted later (or
simply require more discussions and new versions), patches 1/7 to 3/7
could be merged without delay and fix the issue for users.

Compared to v1, minor review comments have been taken into account. As
the approach seems to be generally welcome, I plan to send a pull
request once v6.8-rc1 will be merged in the media tree.

[1] https://lore.kernel.org/linux-media/7658a15a-80c5-219f-2477-2a94ba6c6ba1@kontron.de

Laurent Pinchart (6):
  media: mc: Add local pad to pipeline regardless of the link state
  media: mc: Fix flags handling when creating pad links
  media: mc: Add num_links flag to media_pad
  media: mc: Rename pad variable to clarify intent
  media: mc: Expand MUST_CONNECT flag to always require an enabled link
  media: nxp: imx8-isi: Mark all crossbar sink pads as MUST_CONNECT

Marek Vasut (1):
  media: nxp: imx8-isi: Check whether crossbar pad is non-NULL before
    access

 .../media/mediactl/media-types.rst            | 11 +--
 drivers/media/mc/mc-entity.c                  | 93 ++++++++++++++-----
 .../platform/nxp/imx8-isi/imx8-isi-crossbar.c |  4 +-
 include/media/media-entity.h                  |  2 +
 4 files changed, 78 insertions(+), 32 deletions(-)


base-commit: 0dd3ee31125508cd67f7e7172247f05b7fd1753a
-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-01-16 13:55 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-16  8:42 [PATCH v2 0/7] media: Fix mishandling of MEDIA_PAD_FL_MUST_CONNECT flag Laurent Pinchart
2024-01-16  8:42 ` [PATCH v2 1/7] media: mc: Add local pad to pipeline regardless of the link state Laurent Pinchart
2024-01-16 11:27   ` Sakari Ailus
2024-01-16 13:35     ` Laurent Pinchart
2024-01-16 13:55       ` Sakari Ailus
2024-01-16  8:42 ` [PATCH v2 2/7] media: mc: Fix flags handling when creating pad links Laurent Pinchart
2024-01-16  8:42 ` [PATCH v2 3/7] media: nxp: imx8-isi: Check whether crossbar pad is non-NULL before access Laurent Pinchart
2024-01-16  8:42 ` [PATCH v2 4/7] media: mc: Add num_links flag to media_pad Laurent Pinchart
2024-01-16  8:42 ` [PATCH v2 5/7] media: mc: Rename pad variable to clarify intent Laurent Pinchart
2024-01-16  8:42 ` [PATCH v2 6/7] media: mc: Expand MUST_CONNECT flag to always require an enabled link Laurent Pinchart
2024-01-16  8:42 ` [PATCH v2 7/7] media: nxp: imx8-isi: Mark all crossbar sink pads as MUST_CONNECT Laurent Pinchart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox