From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4888E370AC8 for ; Fri, 21 Aug 2026 18:36:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787337398; cv=none; b=miItSxOHZNneMGe8sgZbgaRKTxOQqWdBB08SNtHLEdT/Q1JagOz/eiZH3X3WVszISbfyVq001fiMDX7mAxNxOGCLZ0EcvL3BrXjK0BjNA4tGHtDKapk9IRuIurY5z8atNSHGQLMVRyrYMCvcx5qnU+gEBi7AuCY8yVoDhWWcono= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787337398; c=relaxed/simple; bh=WkR+wBn5rWHo2juP9fwXXl8qDi9aXwLygzvkehc/ToE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=AwSmyws0GI3zWwGVdH96CxdaxxiZ49Sy82cewaF7WgaREuuyj32Tsga82nZ7uiiOwAQKiUrJ7/H8TpvIzHdudKJuk+DOOC1Z8YQUm759ZgCKSHBYNsLFcYgK/XVG4y4qewu1ohz4UOcQgq/GlUQ/jEb+Y6UmXUMsF8+2yLZfJNQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=lLY6yy0f; arc=none smtp.client-ip=209.85.216.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lLY6yy0f" Received: by mail-pj1-f49.google.com with SMTP id 98e67ed59e1d1-38d489b6b71so1321833a91.0 for ; Fri, 21 Aug 2026 11:36:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787337395; x=1787942195; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=WWwVfN6RhXJbFaz6Mb6103XR01JhOX/M+rzE4uTiAHs=; b=lLY6yy0fRdnKT28ETL2FZlGIxOGUd8t3qIXmcDMO+ayMZcVH8wHU0C9ZiaOMzE8rJV vFOdzFd4lnmj7DvllhtySVBAbuB4HB5RklWR8E5wuukzS7otgrvzyL4PESiusuKjJhmO mz1WSh/Ic/bmY3iIqC07cwu+ugjOfmTl1474hyNtm7sJxu81gjYlm3tJ9wXHYAG5benz TLo0EtSCWsQvhCnjGUZDVxVWAR1wTjtHvrPU65vgpqfM/S/fsnmxdzNTMaWBbt559b+c PKf5AaC4RwbEhJtRsYZhin9AXf/RMZuzmjRolAN1CPzdrrDJLIQMLxyTz8TFPzwp2gDn uShA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787337395; x=1787942195; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=WWwVfN6RhXJbFaz6Mb6103XR01JhOX/M+rzE4uTiAHs=; b=s9royOxFoZlgA6lhaWd77eyeHTQ/z+NlC4rgF4cMpJCa587uoRVaAUa1ebbVAwB2Vu lfF0L/WU9XWqcYxPXI396Gq1vXWQwqMYjltTirLnkd4ube3Qy65AegrZCmtg9GxNGd0B aAsvOzc2aiznRjo4PTi3IqDJwuuPRTJi/kRSOAq/p8H/3hT/jlbehCPIW95X/V+Y/Lav gtuGgIAOzkxHHocJTXFGlJ2rtl+p7LKQ5qcG/aCiHZxV/TVl3vYMLtjg3CvKEh0GMU7R zKESlbNb7pz82lIqnrtXXk0wDgoIi8IX1eLVZwLrcT2GW5IWVknbOeTzRDbmAkXIuW0H QuIQ== X-Forwarded-Encrypted: i=1; AHgh+RqP8dGr+w7OnPoQw5ni0fXhCz1S7l7Plgqf05cIahF2SOegDxfKkWXLqVemFV+yJY4J2o9fWofK70Zzxw8=@vger.kernel.org X-Gm-Message-State: AFuF++mpsqeE+nugi1FYWRtyfLKq95igYYwKXNwAj1J7N0gR2unCJCvL CTA1/T++MqoqkYe1YxCIqpZ0HjfVyciPGGUta1BNFtJhsxT94Bkwv09Z X-Gm-Gg: AR+sD10Amthk7OAHt6m7UZzwjmFmKVkjfF6jg5buiVB4XaijXzTbgeKch8y05C6/agx ExAwgGlgJ36Ig77mvH3WuiZUf0Pve5CVrgx6M+Mq1F8dP2ZM8JNkr14g9KZMhybGFlq7C8bRaJf xfzcL01LJAmpIydAWCACcWoff3mPURLj4Eh3kyBY209Q69nRwsqBrnZU0WeG17iwaDB5Yq7/dCz 3wjk0jPeBr/evCOMIt3LPoege4llX2DOYjEjlkf3AJq2c7sz/MGBqc4qhMZ8dG0bat6eLDY6Gt9 8KRv9u5XvJ03aZcs43HD12tx4vCAwb4REz6peP+5oNNZPRZcPLJSU9x6EZ8Mjretp5FhXIyQ9ys of7yKwKHvGGzKyqulG0oQxXi+wk1XB9ykhLIxj+vnR4XV0tXXQwp2qQ812FoInNacuRDH3qabS1 kBXf1uakwU3ayOLjMoopiHS9AYvD8DQnxI9GyXHokn4J9Kc9Lw6bxvwts6QvbMw6FgyKchsuqr0 QVYjqcKJM4tLVJmNQO7ygE= X-Received: by 2002:a17:90b:1d83:b0:380:9f17:6df3 with SMTP id 98e67ed59e1d1-395c3367376mr12407437a91.4.1787337395495; Fri, 21 Aug 2026 11:36:35 -0700 (PDT) Received: from niharika-QEMU-Virtual-Machine ([223.181.119.104]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-141860ec7f7sm78192c88.6.2026.08.21.11.36.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2026 11:36:34 -0700 (PDT) From: Niharika Khare To: sakari.ailus@linux.intel.com, laurent.pinchart@ideasonboard.com, mchehab@kernel.org Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Subject: [PATCH] media: mc: Remove spurious WARN_ON in __media_pipeline_start Date: Fri, 21 Aug 2026 22:28:07 +0530 Message-ID: <20260821165833.10042-1-niharikakhare2101@gmail.com> X-Mailer: git-send-email 2.53.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Vimc driver's entity topology has three capture nodes and two of those (Raw Capture 0 and RGB/YUV Capture) are reachable from each other via enabled links. The crash report and the C repro show that the two capture nodes attempt to invoke a STREAMON session one after the other, which resulted in the WARNING getting triggered by the media controller. vimc link validate: Sensor A:src:640x480 (0x42474752, 0, 0, 0, 0) Raw Capture 0:snk:640x480 (0x42474752, 8, 0, 0, 0) vimc link validate: Scaler:src:640x480 (0x33424752, 8, 0, 0, 0) RGB/YUV Capture:snk:640x480 (0x33424752, 8, 0, 0, 0) origin->pipe && origin->pipe != pipe WARNING: drivers/media/mc/mc-entity.c:785 at __media_pipeline_start+0x1add/0x22b0, CPU#1: syz.0.17/5912 The graph walk originating from Raw Capture 0 (first STREAMON in C repro on /dev/video0) reaches RGB/YUV Capture and marks its origin pad's pipe with its own pipe. When RGB/YUV Capture's graph walk starts (second STREAMON in C repro on /dev/video4), the pad is already claimed. This is a legitimate userspace request but not something that kernel should allow while the pad remains claimed. Hence, the kernel checks the pipe and returns -EBUSY instead of raising a bug, same as the other non-origin pads. The check on origin pad's pipe needs to stay otherwise the origin pad case would go through the increment on the start_count path, even though there exists a loop few lines below this block to check the pad and return -EBUSY. The check also provides early failure detection and prevents the complete graph walk. Fixes: ae219872834a ("media: mc: entity: Rewrite media_pipeline_start()") Reported-by: syzbot+68e901d044baaea1f60c@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=68e901d044baaea1f60c Tested-by: syzbot+68e901d044baaea1f60c@syzkaller.appspotmail.com Signed-off-by: Niharika Khare --- drivers/media/mc/mc-entity.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/media/mc/mc-entity.c b/drivers/media/mc/mc-entity.c index 3fa0bc687..7b4ef2c95 100644 --- a/drivers/media/mc/mc-entity.c +++ b/drivers/media/mc/mc-entity.c @@ -778,12 +778,18 @@ __must_check int __media_pipeline_start(struct media_pad *origin, lockdep_assert_held(&mdev->graph_mutex); - /* - * If the pad is already part of a pipeline, that pipeline must be the - * same as the pipe given to media_pipeline_start(). - */ - if (WARN_ON(origin->pipe && origin->pipe != pipe)) - return -EINVAL; + /* + * If the pad is part of a different pipeline than the one passed on to + * media_pipeline_start(), the pad must wait for the ongoing session on + * this previous pipeline to complete before it starts a new session. + * The request for starting the pipeline, although valid, cannot be + * served until the ongoing request finishes. + */ + if (origin->pipe && origin->pipe != pipe) { + dev_dbg(mdev->dev, "Failed to start pipeline: pad '%s':%u busy\n", + origin->entity->name, origin->index); + return -EBUSY; + } /* * If the pipeline has already been started, it is guaranteed to be -- 2.53.0