From patchwork Sun Mar 29 13:30:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 6115651 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 89A48BF4A6 for ; Sun, 29 Mar 2015 13:30:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B8BD2201E4 for ; Sun, 29 Mar 2015 13:30:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DDC4B20268 for ; Sun, 29 Mar 2015 13:30:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752665AbbC2Naw (ORCPT ); Sun, 29 Mar 2015 09:30:52 -0400 Received: from nblzone-211-213.nblnetworks.fi ([83.145.211.213]:54898 "EHLO hillosipuli.retiisi.org.uk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752610AbbC2Nav (ORCPT ); Sun, 29 Mar 2015 09:30:51 -0400 Received: from valkosipuli.retiisi.org.uk (vihersipuli.retiisi.org.uk [IPv6:2001:1bc8:102:7fc9::84:2]) by hillosipuli.retiisi.org.uk (Postfix) with ESMTP id 165EE60093; Sun, 29 Mar 2015 16:30:49 +0300 (EEST) Received: by valkosipuli.retiisi.org.uk (Postfix, from userid 1005) id F31C1210B4; Sun, 29 Mar 2015 16:30:48 +0300 (EEST) From: Sakari Ailus To: linux-media@vger.kernel.org Cc: mchehab@osg.samsung.com, hverkuil@xs4all.nl, stable@vger.kernel.org Subject: [RESEND 2 PATCH 1/1] vb2: Fix dma_dir setting for dma-contig mem type Date: Sun, 29 Mar 2015 16:30:48 +0300 Message-Id: <1427635848-30253-1-git-send-email-sakari.ailus@iki.fi> X-Mailer: git-send-email 1.7.10.4 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sakari Ailus (This time with correct stable address.) The last argument of vb2_dc_get_user_pages() is of type enum dma_data_direction, but the caller, vb2_dc_get_userptr() passes a value which is the result of comparison dma_dir == DMA_FROM_DEVICE. This results in the write parameter to get_user_pages() being zero in all cases, i.e. that the caller has no intent to write there. This was broken by patch "vb2: replace 'write' by 'dma_dir'". Signed-off-by: Sakari Ailus Cc: stable@vger.kernel.org Acked-by: Hans Verkuil Fixes: cd474037c4a9 ("[media] vb2: replace 'write' by 'dma_dir'") --- Hi, This fixes videobuf2 dma-contig memory type USERPTR support for v3.19. The pull req for the patch was submitted some time ago: Mauro, let us know if you have objections. Thanks. drivers/media/v4l2-core/videobuf2-dma-contig.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/media/v4l2-core/videobuf2-dma-contig.c b/drivers/media/v4l2-core/videobuf2-dma-contig.c index b481d20..69e0483 100644 --- a/drivers/media/v4l2-core/videobuf2-dma-contig.c +++ b/drivers/media/v4l2-core/videobuf2-dma-contig.c @@ -632,8 +632,7 @@ static void *vb2_dc_get_userptr(void *alloc_ctx, unsigned long vaddr, } /* extract page list from userspace mapping */ - ret = vb2_dc_get_user_pages(start, pages, n_pages, vma, - dma_dir == DMA_FROM_DEVICE); + ret = vb2_dc_get_user_pages(start, pages, n_pages, vma, dma_dir); if (ret) { unsigned long pfn; if (vb2_dc_get_user_pfn(start, n_pages, vma, &pfn) == 0) {