From patchwork Thu Oct 31 00:58:28 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sungchun Kang X-Patchwork-Id: 3118191 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DD7C3BF924 for ; Thu, 31 Oct 2013 00:58:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0DA9C203DB for ; Thu, 31 Oct 2013 00:58:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9FBD2203DF for ; Thu, 31 Oct 2013 00:58:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752068Ab3JaA6h (ORCPT ); Wed, 30 Oct 2013 20:58:37 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:56008 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752021Ab3JaA6a (ORCPT ); Wed, 30 Oct 2013 20:58:30 -0400 Received: from epcpsbgr5.samsung.com (u145.gpu120.samsung.co.kr [203.254.230.145]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MVI00CG1DD80460@mailout1.samsung.com> for linux-media@vger.kernel.org; Thu, 31 Oct 2013 09:58:29 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [203.254.230.47]) by epcpsbgr5.samsung.com (EPCPMTA) with SMTP id 57.EC.07052.53BA1725; Thu, 31 Oct 2013 09:58:29 +0900 (KST) X-AuditID: cbfee691-b7f866d000001b8c-2d-5271ab352514 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id F3.79.09687.53BA1725; Thu, 31 Oct 2013 09:58:29 +0900 (KST) Received: from DOSUNGCHUNK01 ([12.23.118.79]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MVI0010UDDH91G0@mmp1.samsung.com>; Thu, 31 Oct 2013 09:58:29 +0900 (KST) From: =?ks_c_5601-1987?B?sK28usO1?= To: linux-media@vger.kernel.org, m.chehab@samsung.com, kgene.kim@samsung.com, sylvester.nawrocki@gmail.com Subject: [PATCH] media: v4l2-mem2mem: Fixed bug v4l2_m2m_streamoff function Date: Thu, 31 Oct 2013 09:58:28 +0900 Message-id: <000001ced5d4$4fd78330$ef868990$@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=ks_c_5601-1987 Content-transfer-encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-index: Ac7V03BcTTrmKTmISS6rqL06V1hfdw== Content-language: ko X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrMIsWRmVeSWpSXmKPExsVy+t8zfV3T1YVBBht3CVr0LrjKZtGzYSur xcV18hbzPu9kcmDx2DnrLrtH35ZVjB6fN8kFMEdx2aSk5mSWpRbp2yVwZWx4t4u94DZXxc3t 31gbGDdzdDFyckgImEicO/+PBcIWk7hwbz1bFyMXh5DAMkaJt5vfMcMULfjxigUisYhRYsHd i+wQzl9GiSOPljCBVLEJ2Et8X9AA1MHBISKQI9F4oQ4kLCzgLfHq9zKwEhYBVYmPP7eAbeMV sJQ4PmsyG4QtKPFj8j2wOLOAgcT7WX2sELa8xOY1b6GOUJDYcfY1I8R4PYn1F6ohSkQk9r14 xwhyjoTAPHaJt2+2M0LsEpD4NvkQC0i9hICsxKYDUGMkJQ6uuMEygVF0FpLNs5BsnoVk8ywk KxYwsqxiFE0tSC4oTkovMtUrTswtLs1L10vOz93ECImgiTsY7x+wPsSYDLR+IrOUaHI+MALz SuINjc2MLExNTI2NzC3NSBNWEudNf5QUJ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w/HCAdeQG4zdKLMUZiYZazEXFiQDdyOBbEwMA AA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 In multi-instance scenario with multi-core, m2m_ctx->queue is removed again sometimes. So, it is need to check whether the queue is removed or not. Change-Id: Ie938e9026039304388a369d5d10d1654213ba3b1 Signed-off-by: Sungchun Kang --- drivers/media/v4l2-core/v4l2-mem2mem.c | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2- core/v4l2-mem2mem.c index 8512314..47b8fdd 100644 --- a/drivers/media/v4l2-core/v4l2-mem2mem.c +++ b/drivers/media/v4l2-core/v4l2-mem2mem.c @@ -438,9 +438,14 @@ int v4l2_m2m_streamoff(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, m2m_dev = m2m_ctx->m2m_dev; spin_lock_irqsave(&m2m_dev->job_spinlock, flags_job); /* We should not be scheduled anymore, since we're dropping a queue. */ - if (!list_empty(&m2m_dev->job_queue)) - list_del(&m2m_ctx->queue); - + if (!list_empty(&m2m_dev->job_queue)) { + struct v4l2_m2m_ctx *list_ctx, *temp_ctx; + list_for_each_entry_safe(list_ctx, temp_ctx, + &m2m_dev->job_queue, queue) { + if (list_ctx == m2m_ctx) + list_del(&m2m_ctx->queue); + } + } INIT_LIST_HEAD(&m2m_ctx->queue); m2m_ctx->job_flags = 0;