Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1144189imm; Wed, 1 Aug 2018 10:55:42 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcmugyCUtLWVzvpTz06rQPqSEx6i0iIY080uTyvPc6Kx/u3q/lNOfw4yEF00ZVt099agR5H X-Received: by 2002:a17:902:6ac3:: with SMTP id i3-v6mr25694628plt.252.1533146142884; Wed, 01 Aug 2018 10:55:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533146142; cv=none; d=google.com; s=arc-20160816; b=bJ2gpCGo8B7lZd2ZZVOC+rc8RmweSo1CfzMZgDquLl82dGH0jMKugd9BuUF3dwLZoz OAQ65yLXSG/VXLZDFB793RgTAD+ce/5XBXSXZY1+CSGfcEtJkWvxgwa/YyHSOSHb8pdS 7rEdCEV+8bWm18oQtVzRi2QJD+zCii72fWbJcjD2KK0rlDsjMd0/dYFgFBliSoMwMAx5 eFlENdEnu6xRcqPQXosTAC0fXyM3JNksZ+M31fLJ2wt0ttEKDoFGd/phw7wvD09ZG+OC QH+Clnk97gv0ELEtl3A/v7bm5oqUnWvvSinqoVxgHtaz4Flp7271VZ0oMrHh1e7IBjui 9TEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=CASynmCG5Ov5xSQ14DCfCCCXwTF7NIber6ATO3D847g=; b=gyaLjYEuuN6J/g1LPvWggaG2Dqomy6+jDbuxvr5HF1sMD11btnGrJ93ITmHUttD7OK flxpca4RiqjtVoRY+aem/aaLZcroOzy5rZ1bH4E1G7Tb+KtGrUkhnCBpAZQ8HM1C2lL7 4eNjAsX28yVZcHyxT8+kT+mmF9ubJZFF74anTF7atONptFaL8PXteoubwyxjT3rigu3u vOP0LE4u5C+n4V3Q3mLE3IDPmRrmwcDiRDbGZVv5RDb3VSvXDXKmz1DZs2dGwH3vHRvg Qwg2edILyCAWixtficOqNygZIk3GPKD76D/BOYIvuIEahg5ngwoaohAQpcMIiZQVfGp4 OknQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r10-v6si9552460pli.248.2018.08.01.10.55.28; Wed, 01 Aug 2018 10:55:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390464AbeHATlc (ORCPT + 99 others); Wed, 1 Aug 2018 15:41:32 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:50270 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405917AbeHATIk (ORCPT ); Wed, 1 Aug 2018 15:08:40 -0400 Received: from localhost (D57E6652.static.ziggozakelijk.nl [213.126.102.82]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 4BCB813A2; Wed, 1 Aug 2018 17:15:53 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.14 081/246] media: videobuf2-core: dont call memop finish when queueing Date: Wed, 1 Aug 2018 18:49:51 +0200 Message-Id: <20180801165015.592375752@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180801165011.700991984@linuxfoundation.org> References: <20180801165011.700991984@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Hans Verkuil [ Upstream commit 90b2da89a083e1395cb322521a42397c49ae4500 ] When a buffer is queued or requeued in vb2_buffer_done, then don't call the finish memop. In this case the buffer is only returned to vb2, not to userspace. Calling 'finish' here will cause an unbalance when the queue is canceled, since the core will call the same memop again. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/media/v4l2-core/videobuf2-core.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -912,9 +912,12 @@ void vb2_buffer_done(struct vb2_buffer * dprintk(4, "done processing on buffer %d, state: %d\n", vb->index, state); - /* sync buffers */ - for (plane = 0; plane < vb->num_planes; ++plane) - call_void_memop(vb, finish, vb->planes[plane].mem_priv); + if (state != VB2_BUF_STATE_QUEUED && + state != VB2_BUF_STATE_REQUEUEING) { + /* sync buffers */ + for (plane = 0; plane < vb->num_planes; ++plane) + call_void_memop(vb, finish, vb->planes[plane].mem_priv); + } spin_lock_irqsave(&q->done_lock, flags); if (state == VB2_BUF_STATE_QUEUED ||