Received: by 10.192.165.148 with SMTP id m20csp2543320imm; Sun, 22 Apr 2018 09:13:18 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/3Wri2MNwFY5yHh2onxb07WyVh+sla54Pq2WflO+nyddELVujuq98BfjBHU2p3uudaed5U X-Received: by 2002:a17:902:b68e:: with SMTP id c14-v6mr17782279pls.286.1524413598557; Sun, 22 Apr 2018 09:13:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524413598; cv=none; d=google.com; s=arc-20160816; b=u3KjRNLM17PSYpRvcKCyERcWEpsU+1nVbYf6bAn0pEWuZuWf0Tn9yCmRI0QUaLe4s1 SWhTkQZdfn64kmvnjMcz7uCY7tjRNZJCuKqd2rqwi3rkGxCW/u/qME4/5G9dzfz2UglZ WXE+AIG4hOPQZUV1LGWa5Lvk609m1979i7/n9TJcd6QK3V0p4NygYJuynIyBThtnI6NA qrxQhno9VegO0u6+RWtNwWtY9y4689BKAcAcKPo8MBnXgMJ5vIGwLNWw9qTVGtMMKWH0 3wDIKZ9Kb6FKgrj64dL0gtqN96hJgtjLM1CYhkHx75skD4iD7KE/rBM/AvmQHeYD12w5 Bdhg== 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=9lQaqgxy2LLU0D9ZWFj1KTE1HWbgNYNsARPw3zYbt40=; b=W/p4KHj1dosoVG8LbyeRs9Q2bK7O81GO8d4ETsBPoa5hCpUluuyYRTkvkBSUTV4eUQ 2Sv6NyNI2dc0SHHG6xHf1n4CxfEBkS+TX8WuA6F6Ymz6qEaAetnMZc+Vp5/4t85iN1/b KtTT+89K/rWIz01M9iuLP2LDPxqs54jTe7xR61DlR2r0XK4in66G/pMWFzniMpuV8xNb JdLqLgAHm0Zzf8d5jH7LDurrHxe5IppeZiq90f+sW3FCAWkUzq3NwPeqEbQQbnmE9Jzz VA4arwaUU6oswwXomTln+YCz6v+nhDXIucqSgyCeQHiN5FftyqHlZeWCv+atW5nT6atK nR6w== 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 91-v6si9735312plf.78.2018.04.22.09.13.04; Sun, 22 Apr 2018 09:13:18 -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 S1753694AbeDVQME (ORCPT + 99 others); Sun, 22 Apr 2018 12:12:04 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:44800 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753608AbeDVNzs (ORCPT ); Sun, 22 Apr 2018 09:55:48 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id B231A8FF; Sun, 22 Apr 2018 13:55:47 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sakari Ailus , Devin Heitmueller , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 4.16 033/196] media: vb2: core: Finish buffers at the end of the stream Date: Sun, 22 Apr 2018 15:50:53 +0200 Message-Id: <20180422135105.816331285@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180422135104.278511750@linuxfoundation.org> References: <20180422135104.278511750@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.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sakari Ailus commit 03703ed1debf777ea845aa9b50ba2e80a5e7dd3c upstream. If buffers were prepared or queued and the buffers were released without starting the queue, the finish mem op (corresponding to the prepare mem op) was never called to the buffers. Before commit a136f59c0a1f there was no need to do this as in such a case the prepare mem op had not been called yet. Address the problem by explicitly calling finish mem op when the queue is stopped if the buffer is in either prepared or queued state. Fixes: a136f59c0a1f ("[media] vb2: Move buffer cache synchronisation to prepare from queue") Cc: stable@vger.kernel.org # for v4.13 and up Signed-off-by: Sakari Ailus Tested-by: Devin Heitmueller Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/media/common/videobuf2/videobuf2-core.c | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/drivers/media/common/videobuf2/videobuf2-core.c +++ b/drivers/media/common/videobuf2/videobuf2-core.c @@ -1696,6 +1696,15 @@ static void __vb2_queue_cancel(struct vb for (i = 0; i < q->num_buffers; ++i) { struct vb2_buffer *vb = q->bufs[i]; + if (vb->state == VB2_BUF_STATE_PREPARED || + vb->state == VB2_BUF_STATE_QUEUED) { + unsigned int plane; + + for (plane = 0; plane < vb->num_planes; ++plane) + call_void_memop(vb, finish, + vb->planes[plane].mem_priv); + } + if (vb->state != VB2_BUF_STATE_DEQUEUED) { vb->state = VB2_BUF_STATE_PREPARED; call_void_vb_qop(vb, buf_finish, vb);