Received: by 10.223.185.116 with SMTP id b49csp6365455wrg; Wed, 28 Feb 2018 08:13:44 -0800 (PST) X-Google-Smtp-Source: AH8x225V9UHqVWb5R/fQjj83DxILJOlVeQ5Y2tobh7RXbALLpI8dJSrrNywfqMNQa2+MjAvp2jd0 X-Received: by 10.98.147.27 with SMTP id b27mr18279230pfe.145.1519834424056; Wed, 28 Feb 2018 08:13:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519834424; cv=none; d=google.com; s=arc-20160816; b=bg20aYqtg0NOqYSeNavENBCvNESLpR8BuTqJQV1lnQ8KiYVhu7L6i856AHzWAc3Am/ aVMKhLz9u6ejJDrYv5Mt3jb7uOAHAFwyFqR9hqjP0I7ym/ni6EF/CLhUmXzKBJkRAW7/ T6ECdJP/iWJMCuKlab82s76wlzzrwywAeL5F1FNnFK1ksBDg+KM4fDf1TFxfmDfDIWGp 7rcpJ9CsZSLGqWVVmsSgcxJ/RslLaP6z/D/t027/OWBghyzfQeVIQ/fD3yx9xNlqW9nb 9vzgGI3KC0Gc2mYJN8w4k1WydNhSe10KwSBXHndUdXGDuvHOqYSmxq6DWf8rBdsVV30L Ki5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=DvKMAdHhncXRkDTJtR+K98OpeeVDfiP5pdMJsuRR0J0=; b=ppQ7HInUyOoW/wsh4XndWPfdF08jqpU/3uoLWZNR/hCpNZE2aJVyQmv+DpnDg94tYg DwzAaj/e+yo5oV8bhNl7covmZ/eUKwForgr9/5TKKgYFCeYmi7IRAtpfdV/tR0gbMNPA bICCjZC3PzC9RyxHD3S/KKl8K6QNsQAWJswoEaGv3VT4dVZG5jUqu6X3alfVWDJwGvDW vzfY/9dqMy3tRP+tmhrBbuVk6wzB1RuCuTl4IgL9C5vhByKDamSbx1wFwf0HOn1+25Hn qGUmt54ZKhJoy42QxY+5THIgvOj3yLtet/H3AUiEWCRptMyklO0W0lPH5Jh8ytPFPAhp JNQg== 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 r12si1166130pgt.200.2018.02.28.08.13.28; Wed, 28 Feb 2018 08:13:44 -0800 (PST) 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 S934508AbeB1QM2 (ORCPT + 99 others); Wed, 28 Feb 2018 11:12:28 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:35034 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932702AbeB1QMT (ORCPT ); Wed, 28 Feb 2018 11:12:19 -0500 Received: from [2a02:8011:400e:2:6f00:88c8:c921:d332] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1er3Ym-0006XQ-Gg; Wed, 28 Feb 2018 15:22:25 +0000 Received: from ben by deadeye with local (Exim 4.90_1) (envelope-from ) id 1er3Yk-0000JO-Sp; Wed, 28 Feb 2018 15:22:22 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Mauro Carvalho Chehab" , "Hans Verkuil" , "Ricardo Ribalda" , "Dimitrios Katsaros" Date: Wed, 28 Feb 2018 15:20:18 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 241/254] vb2: V4L2_BUF_FLAG_DONE is set after DQBUF In-Reply-To: X-SA-Exim-Connect-IP: 2a02:8011:400e:2:6f00:88c8:c921:d332 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.55-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Ricardo Ribalda commit 3171cc2b4eb9831ab4df1d80d0410a945b8bc84e upstream. According to the doc, V4L2_BUF_FLAG_DONE is cleared after DQBUF: V4L2_BUF_FLAG_DONE 0x00000004 ... After calling the VIDIOC_QBUF or VIDIOC_DQBUF it is always cleared ... Unfortunately, it seems that videobuf2 keeps it set after DQBUF. This can be tested with vivid and dev_debug: [257604.338082] video1: VIDIOC_DQBUF: 71:33:25.00260479 index=3, type=vid-cap, flags=0x00002004, field=none, sequence=163, memory=userptr, bytesused=460800, offset/userptr=0x344b000, length=460800 This patch forces FLAG_DONE to 0 after calling DQBUF. Reported-by: Dimitrios Katsaros Signed-off-by: Ricardo Ribalda Delgado Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Ben Hutchings --- drivers/media/v4l2-core/videobuf2-core.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index e63a7904bf5b..ee8b697972bb 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -2069,6 +2069,11 @@ static int vb2_internal_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b, bool n dprintk(1, "dqbuf of buffer %d, with state %d\n", vb->v4l2_buf.index, vb->state); + /* + * After calling the VIDIOC_DQBUF V4L2_BUF_FLAG_DONE must be + * cleared. + */ + b->flags &= ~V4L2_BUF_FLAG_DONE; return 0; }