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 E94971F3B96; Mon, 23 Jun 2025 21:35:31 +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=1750714533; cv=none; b=lqivSr8eozDYIRtBJxE7ZPG0QDkSEaEvU7Lee4iGMqcR/wN3imMOZUyepQ0mxE4n7h3+nFmJ7ysHW3kAJzux9ifi6ubTzg4nNkS9M3U4F4nkoV+KbTi2H/hWK/KQVyY/DJyDv4ViOLda76QiCZGAG8CjZRrqMucNl+oPGiCISJY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750714533; c=relaxed/simple; bh=L6mZOAfQ2mRmRwK5ae4KN83rtCDnAXAnKGLH5VDibqI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rkfWQAAio0C9eV5AQiLbxKvDpVcvxTYXOLcb1anLudNUQ2gVa3D2+SNvtss+bmHu/zWBTl3jlrYELM+FTbcDW1vTizXM0laLIOtLCET9QQewmO+UDn8FBqLXCAdMalu+SoZUkBXoOD5VezF/uFPoAuuGxCq8R73EEHIWZYXzVE8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=O6KzWitB; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="O6KzWitB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44869C4CEEA; Mon, 23 Jun 2025 21:35:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1750714531; bh=L6mZOAfQ2mRmRwK5ae4KN83rtCDnAXAnKGLH5VDibqI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O6KzWitBpCsL9rVrcRkwxLy7+Lpnh7v/j03wAQRStG4oeqTnlGyCqhBB1n61JzmIs Gnb2mhLXbDAc4GmPVM8C1EHpygFtr5Hx1JbjIk3DdWFbMAbih+zbG4M23GiQz0iKMO aPrxrrPMEXjiscAQFmUpOaSFIfy39ZzWzUxmZAGU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Marek Szyprowski , Sergey Senozhatsky , Tomasz Figa , Hans Verkuil Subject: [PATCH 5.15 214/411] media: videobuf2: use sgtable-based scatterlist wrappers Date: Mon, 23 Jun 2025 15:05:58 +0200 Message-ID: <20250623130639.054503324@linuxfoundation.org> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250623130632.993849527@linuxfoundation.org> References: <20250623130632.993849527@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Marek Szyprowski commit a704a3c503ae1cfd9de8a2e2d16a0c9430e98162 upstream. Use common wrappers operating directly on the struct sg_table objects to fix incorrect use of scatterlists sync calls. dma_sync_sg_for_*() functions have to be called with the number of elements originally passed to dma_map_sg_*() function, not the one returned in sgt->nents. Fixes: d4db5eb57cab ("media: videobuf2: add begin/end cpu_access callbacks to dma-sg") CC: stable@vger.kernel.org Signed-off-by: Marek Szyprowski Reviewed-by: Sergey Senozhatsky Acked-by: Tomasz Figa Signed-off-by: Hans Verkuil Signed-off-by: Greg Kroah-Hartman --- drivers/media/common/videobuf2/videobuf2-dma-sg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/media/common/videobuf2/videobuf2-dma-sg.c +++ b/drivers/media/common/videobuf2/videobuf2-dma-sg.c @@ -471,7 +471,7 @@ vb2_dma_sg_dmabuf_ops_begin_cpu_access(s struct vb2_dma_sg_buf *buf = dbuf->priv; struct sg_table *sgt = buf->dma_sgt; - dma_sync_sg_for_cpu(buf->dev, sgt->sgl, sgt->nents, buf->dma_dir); + dma_sync_sgtable_for_cpu(buf->dev, sgt, buf->dma_dir); return 0; } @@ -482,7 +482,7 @@ vb2_dma_sg_dmabuf_ops_end_cpu_access(str struct vb2_dma_sg_buf *buf = dbuf->priv; struct sg_table *sgt = buf->dma_sgt; - dma_sync_sg_for_device(buf->dev, sgt->sgl, sgt->nents, buf->dma_dir); + dma_sync_sgtable_for_device(buf->dev, sgt, buf->dma_dir); return 0; }