From mboxrd@z Thu Jan 1 00:00:00 1970 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 C48CA37E66C; Sat, 28 Feb 2026 17:36:07 +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=1772300167; cv=none; b=G1AtnuV0XuSdqiw2mYQoYs13FmSrgauiazJZBVp8dAaNf8s8HiNy9Vz0wfQ5//rIo0BxMm9KqTXhpd95C4br+nzkvkmDhsIu2k16DIAGITbtPvQEwaXmtxJr8rAsYsvGRDwjFtZ2CTL2iFxgdQY+/brhzQ+f6/LIcEsztccHKz0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772300167; c=relaxed/simple; bh=qN7FlshoqMU79pI9pEyR07XAtSCL+xPGJYwlXEJa1Y4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=j+egkOyecVXmaB0gpGzsuTRWh+MZ574dfIQou6J5ktqo/fmp52zFwBNg1xSB4NAi3fmnwkxpFM24NXeLubEolsb029NZgvbCqWLR2Oj0QEb4PIQ6YjlwtiIr1wkScDAUjAQ4GjU78XqWYqN3NDYULUVd37fiP0CtAE6iDJtJAgI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZvWpVR9I; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZvWpVR9I" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5B2CC19424; Sat, 28 Feb 2026 17:36:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772300167; bh=qN7FlshoqMU79pI9pEyR07XAtSCL+xPGJYwlXEJa1Y4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZvWpVR9IVf5ioFbyEfbUqyCn2e/VPkukTirljmvl2NnPKQ8/i2ZRPPyjPqz5sJDSM gu83pNjgJvy2xD/DuyIFDaNzIxIqeTSMeaHf2GLKqpDIG6LWfuZVteMHkqz5wWPGUw CiECp0rJid3nhQci2cEaRivy17zlqPNZssd/ciSN1eD5GwXhDY9Xbh1UCUWXMIyWUV /m1x1aWg1XUzkRoGl/QoYXE1UaWdzkALpmDlstLJ4yRQScbbfQmSBzPDA+b54mZybO 1z8PRUSntOQOngNZtHZJnWZiG+zADqainhO7HJQWrYmob2aim2mAUPUdlN690vaWtL mFT8D+htOCgtw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Sakari Ailus , Hans Verkuil , Sasha Levin Subject: [PATCH 6.19 186/844] media: ipu6: Ensure stream_mutex is acquired when dealing with node list Date: Sat, 28 Feb 2026 12:21:39 -0500 Message-ID: <20260228173244.1509663-187-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260228173244.1509663-1-sashal@kernel.org> References: <20260228173244.1509663-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: stable@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: Sakari Ailus [ Upstream commit 779bdaad2abf718fb8116839e818e58852874b4d ] The ipu6 isys driver maintains the list of video buffer queues related to a stream (in ipu6 context streams on the same CSI-2 virtual channel) and this list is modified through VIDIOC_STREAMON and VIDIOC_STREAMOFF IOCTLs. Ensure the common mutex is acquired when accessing the linked list, i.e. the isys device context's stream_mutex. Add a lockdep assert to ipu6_isys_get_buffer_list() and switch to guard() while at it as the error handling becomes more simple this way. Signed-off-by: Sakari Ailus Signed-off-by: Hans Verkuil Signed-off-by: Sasha Levin --- drivers/media/pci/intel/ipu6/ipu6-isys-queue.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/media/pci/intel/ipu6/ipu6-isys-queue.c b/drivers/media/pci/intel/ipu6/ipu6-isys-queue.c index aa2cf7287477c..8f05987cdb4e7 100644 --- a/drivers/media/pci/intel/ipu6/ipu6-isys-queue.c +++ b/drivers/media/pci/intel/ipu6/ipu6-isys-queue.c @@ -3,6 +3,7 @@ * Copyright (C) 2013--2024 Intel Corporation */ #include +#include #include #include #include @@ -201,6 +202,8 @@ static int buffer_list_get(struct ipu6_isys_stream *stream, unsigned long flags; unsigned long buf_flag = IPU6_ISYS_BUFFER_LIST_FL_INCOMING; + lockdep_assert_held(&stream->mutex); + bl->nbufs = 0; INIT_LIST_HEAD(&bl->head); @@ -294,9 +297,8 @@ static int ipu6_isys_stream_start(struct ipu6_isys_video *av, struct ipu6_isys_buffer_list __bl; int ret; - mutex_lock(&stream->isys->stream_mutex); + guard(mutex)(&stream->isys->stream_mutex); ret = ipu6_isys_video_set_streaming(av, 1, bl); - mutex_unlock(&stream->isys->stream_mutex); if (ret) goto out_requeue; @@ -637,10 +639,10 @@ static void stop_streaming(struct vb2_queue *q) mutex_lock(&av->isys->stream_mutex); if (stream->nr_streaming == stream->nr_queues && stream->streaming) ipu6_isys_video_set_streaming(av, 0, NULL); + list_del(&aq->node); mutex_unlock(&av->isys->stream_mutex); stream->nr_streaming--; - list_del(&aq->node); stream->streaming = 0; mutex_unlock(&stream->mutex); -- 2.51.0