Received: by 10.213.65.68 with SMTP id h4csp1714626imn; Mon, 19 Mar 2018 11:14:32 -0700 (PDT) X-Google-Smtp-Source: AG47ELsjPPlmDNFMV5LDHodF17QyScfMOlkWd5e1GVvllqGxqd3y0qd47l1slH8/LoSnIy7IRmCo X-Received: by 2002:a17:902:be14:: with SMTP id r20-v6mr13286542pls.302.1521483272721; Mon, 19 Mar 2018 11:14:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521483272; cv=none; d=google.com; s=arc-20160816; b=bGppuqkuknlwed3Uyb9qjbexiO6/LjKYzaBj9QoXrqoqcTdFxNQr4wvlYIQLUkhoxN ZmrQx0Hp92vzkYVnegnaTlOU0pzCQadGRXLgG+kHTO8bUQxse+02ITxaa2KnhjYnNvqK fCDMC8D9hgH3dQ2rLR4Gdk/HEImTqf3l8ggxiu0+WII8D7YAmLlUB5tizy9XrEvDycsV iHEczQ9bP3yu8HQzwNroZ9avQliD7b9d5E8bokIH+OJ+4U18gC0bFDMIq/w2C+j5bZPc inhciYlarv7iPKWvZaGDdXswULNhLO+GUGtYr8NFaBz+6SvdnqBgwZqqRGKg4N5CHzxi mnOA== 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=f6jR6iVmpbwRQwhqW86oV+Dpyg+j7uLQpixQLPggFDA=; b=GgWuVs8CZd/HiUIgMCzxuHwuPK8TPhZoVVkm2BDAhhEpLq9rzJyJc7WYp3x4KO7Diy v+Wz8Eh+nH1Kx0C2wMcD59k4LC+Y479crxjDvQ8oJhQubXrvK3JCNus8Zq0hKJ8QNaiC dD2qwMVUQyYH1QIvYkbhEs4OAUBTxb0C6k1SkOV41e8tCjU+3cohunEDZdnfFCVBEc3G gY87ZVKNF7bZd70TqYupXetgdOI9BMbmbduoN276fXQla8nVgL0IBaADK0IWltUWYRtT AbKM4V/SN1CiRKorl0T4q7TUG/dar56UQ8EOq2p/gCpAQEGjmjB2/S3sLO2ZomreMW5A 0V9g== 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 z23-v6si381864plo.272.2018.03.19.11.14.17; Mon, 19 Mar 2018 11:14:32 -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 S1030474AbeCSSM4 (ORCPT + 99 others); Mon, 19 Mar 2018 14:12:56 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:42912 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933213AbeCSSMt (ORCPT ); Mon, 19 Mar 2018 14:12:49 -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 D237811B4; Mon, 19 Mar 2018 18:12:48 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anton Sviridenko , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.4 024/134] [media] solo6x10: release vb2 buffers in solo_stop_streaming() Date: Mon, 19 Mar 2018 19:05:07 +0100 Message-Id: <20180319171852.709380660@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180319171849.024066323@linuxfoundation.org> References: <20180319171849.024066323@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.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Anton Sviridenko [ Upstream commit 6e4c8480bd2eb95309ad3c875e11d2cad98f9188 ] Fixes warning that appears in dmesg after closing V4L2 userspace application that plays video from the display device (first device from V4L2 device nodes provided by solo, usually /dev/video0 when no other V4L2 devices are present). Encoder device nodes are not affected. Can be reproduced by starting and closing ffplay -f video4linux2 /dev/video0 [ 8130.281251] ------------[ cut here ]------------ [ 8130.281256] WARNING: CPU: 1 PID: 20414 at drivers/media/v4l2-core/videobuf2-core.c:1651 __vb2_queue_cancel+0x14b/0x230 [ 8130.281257] Modules linked in: ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat solo6x10 x86_pkg_temp_thermal vboxpci(O) vboxnetadp(O) vboxnetflt(O) vboxdrv(O) [ 8130.281264] CPU: 1 PID: 20414 Comm: ffplay Tainted: G O 4.10.0-gentoo #1 [ 8130.281264] Hardware name: ASUS All Series/B85M-E, BIOS 2301 03/30/2015 [ 8130.281265] Call Trace: [ 8130.281267] dump_stack+0x4f/0x72 [ 8130.281270] __warn+0xc7/0xf0 [ 8130.281271] warn_slowpath_null+0x18/0x20 [ 8130.281272] __vb2_queue_cancel+0x14b/0x230 [ 8130.281273] vb2_core_streamoff+0x23/0x90 [ 8130.281275] vb2_streamoff+0x24/0x50 [ 8130.281276] vb2_ioctl_streamoff+0x3d/0x50 [ 8130.281278] v4l_streamoff+0x15/0x20 [ 8130.281279] __video_do_ioctl+0x25e/0x2f0 [ 8130.281280] video_usercopy+0x279/0x520 [ 8130.281282] ? v4l_enum_fmt+0x1330/0x1330 [ 8130.281285] ? unmap_region+0xdf/0x110 [ 8130.281285] video_ioctl2+0x10/0x20 [ 8130.281286] v4l2_ioctl+0xce/0xe0 [ 8130.281289] do_vfs_ioctl+0x8b/0x5b0 [ 8130.281290] ? __fget+0x72/0xa0 [ 8130.281291] SyS_ioctl+0x74/0x80 [ 8130.281294] entry_SYSCALL_64_fastpath+0x13/0x94 [ 8130.281295] RIP: 0033:0x7ff86fee6b27 [ 8130.281296] RSP: 002b:00007ffe467f6a08 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 [ 8130.281297] RAX: ffffffffffffffda RBX: 00000000d1a4d788 RCX: 00007ff86fee6b27 [ 8130.281297] RDX: 00007ffe467f6a14 RSI: 0000000040045613 RDI: 0000000000000006 [ 8130.281298] RBP: 000000000373f8d0 R08: 00000000ffffffff R09: 00007ff860001140 [ 8130.281298] R10: 0000000000000243 R11: 0000000000000246 R12: 0000000000000000 [ 8130.281299] R13: 00000000000000a0 R14: 00007ffe467f6530 R15: 0000000001f32228 [ 8130.281300] ---[ end trace 00695dc96be646e7 ]--- Signed-off-by: Anton Sviridenko Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/media/pci/solo6x10/solo6x10-v4l2.c | 11 +++++++++++ 1 file changed, 11 insertions(+) --- a/drivers/media/pci/solo6x10/solo6x10-v4l2.c +++ b/drivers/media/pci/solo6x10/solo6x10-v4l2.c @@ -342,6 +342,17 @@ static void solo_stop_streaming(struct v struct solo_dev *solo_dev = vb2_get_drv_priv(q); solo_stop_thread(solo_dev); + + spin_lock(&solo_dev->slock); + while (!list_empty(&solo_dev->vidq_active)) { + struct solo_vb2_buf *buf = list_entry( + solo_dev->vidq_active.next, + struct solo_vb2_buf, list); + + list_del(&buf->list); + vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR); + } + spin_unlock(&solo_dev->slock); INIT_LIST_HEAD(&solo_dev->vidq_active); }