From patchwork Mon Jan 15 10:30:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 98601 Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Mon, 15 Jan 2024 10:30:41 +0000 Received: from bombadil.infradead.org [198.137.202.133] by coco.lan with IMAP (fetchmail-6.4.37) for (single-drop); Mon, 15 Jan 2024 11:31:33 +0100 (CET) Received: from sv.mirrors.kernel.org ([139.178.88.99]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rPKEp-008aT4-2Q for mchehab@infradead.org; Mon, 15 Jan 2024 10:30:41 +0000 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 52488281FF7 for ; Mon, 15 Jan 2024 10:30:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7222C12E70; Mon, 15 Jan 2024 10:30:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="pfR9D4MM" X-Original-To: linux-media@vger.kernel.org Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 F2E44101E3 for ; Mon, 15 Jan 2024 10:30:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Received: from pendragon.ideasonboard.com (89-27-53-110.bb.dnainternet.fi [89.27.53.110]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id E39F4326; Mon, 15 Jan 2024 11:29:16 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1705314557; bh=2T7f2438772OFGVL5IBvxzEQ1k+PrW13zdRkxCWvc2o=; h=From:To:Cc:Subject:Date:From; b=pfR9D4MMnL1XYpU7Ukx5xj7Kpry6e6P7cPqoSAFJYxwTUyqe3qJ8bFb5uorCsi9v1 SRQ6WpkQ6xCaIUpkmPlPKYnED/B0TFgOBMW9gKc5bBsmQ/wzOwSK4lxtM6w1boVHUK FRizwZo+EUJ56EPu+yitRVomUziy+ZxVBhytjjDM= From: Laurent Pinchart To: linux-media@vger.kernel.org Cc: Sakari Ailus , Jacopo Mondi , Alexander Shiyan , Fabio Estevam , Frieder Schrempf , Marek Vasut , Martin Kepplinger , Rui Miguel Silva , Tim Harvey , Purism Kernel Team Subject: [PATCH 0/7] media: Fix mishandling of MEDIA_PAD_FL_MUST_CONNECT flag Date: Mon, 15 Jan 2024 12:30:22 +0200 Message-ID: <20240115103029.28055-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240115_023039_942747_6C066BE9 X-CRM114-Status: GOOD ( 15.52 ) X-Spam-Score: -3.2 (---) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 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 [...] Content analysis details: (-3.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [139.178.88.99 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager 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. [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