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 8435A2459FF; Mon, 23 Jun 2025 13:14: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=1750684471; cv=none; b=prxYXqU/bi1JzwRwdp5FPU4h3/lOmbFqgKvvFrnovdhdssqa6T8icI4HQZ7nPB8EEc2lbBzH28wmMxF4ou52z7/BTW0/5/o9pgQiOWhKgtD/DFMnICttjv5Zx3kvpPqRNB3fAktg4TDcnLMYiDpbmDFwUjgZkD0quM5UNw7dKCE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750684471; c=relaxed/simple; bh=xC2ujuLai4JYW/ph5Lpw/eQwdPIBU4KSAQ5fnppHuSA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QORuXeqc1QllwF+CfgWKSoBIG3Oi7ECpFsl0s/btvSN9CZ/wyUTm7WCd9AYaGRHKd4ac3RC+cMAf/N05I9whaKuDrHnL5bHx85CEz+N//ViTYhToUTYermfIA4R17LvIQjnjxYiKKhVU8Hsa05Nj7xjWJhYzDhj9aeIqpVEv6G4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=U/vu+SUD; 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="U/vu+SUD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19586C4CEF1; Mon, 23 Jun 2025 13:14:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1750684471; bh=xC2ujuLai4JYW/ph5Lpw/eQwdPIBU4KSAQ5fnppHuSA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U/vu+SUDUe0Yul0kNGXF9NFK+n+WKG732Kmv3xilayKUiVA+njldlzuXIz6BMU9n3 9WnU1oa1hOhtREzDDULFRaZw208G/GLcd347bqrJlfBTHXP6UUteCU5pvR3UFAea7j KiOqFpxhvU+qMiIzVRFWI+rWDEpXRMtT+fiaEK20= 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 6.15 082/592] media: videobuf2: use sgtable-based scatterlist wrappers Date: Mon, 23 Jun 2025 15:00:40 +0200 Message-ID: <20250623130702.227333570@linuxfoundation.org> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250623130700.210182694@linuxfoundation.org> References: <20250623130700.210182694@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.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 @@ -469,7 +469,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; } @@ -480,7 +480,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; }