From patchwork Thu Sep 19 07:40:32 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Zabel X-Patchwork-Id: 2910191 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 06C6A9F1BF for ; Thu, 19 Sep 2013 07:40:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EA7AF20452 for ; Thu, 19 Sep 2013 07:40:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D713E20450 for ; Thu, 19 Sep 2013 07:40:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752970Ab3ISHki (ORCPT ); Thu, 19 Sep 2013 03:40:38 -0400 Received: from metis.ext.pengutronix.de ([92.198.50.35]:55460 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751767Ab3ISHkh (ORCPT ); Thu, 19 Sep 2013 03:40:37 -0400 Received: from dude.hi.pengutronix.de ([10.1.0.7] helo=dude.pengutronix.de) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1VMYqo-0000Yq-Ap; Thu, 19 Sep 2013 09:40:34 +0200 From: Philipp Zabel To: linux-media@vger.kernel.org Cc: kernel@pengutronix.de, Mauro Carvalho Chehab , Kamil Debski , John Sheu , Pawel Osciak , Philipp Zabel Subject: [PATCH] [media] v4l2-mem2mem: fix context removal from job queue in v4l2_m2m_streamoff Date: Thu, 19 Sep 2013 09:40:32 +0200 Message-Id: <1379576432-26984-1-git-send-email-p.zabel@pengutronix.de> X-Mailer: git-send-email 1.8.4.rc3 X-SA-Exim-Connect-IP: 10.1.0.7 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-media@vger.kernel.org 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.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 Just clearing the m2m_ctx->queue list_head will leave the m2m_dev->job_queue in a broken state and can cause scheduling of device_runs after streamoff was called. Signed-off-by: Philipp Zabel --- drivers/media/v4l2-core/v4l2-mem2mem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-core/v4l2-mem2mem.c index 7c43712..8f116c2 100644 --- a/drivers/media/v4l2-core/v4l2-mem2mem.c +++ b/drivers/media/v4l2-core/v4l2-mem2mem.c @@ -480,7 +480,8 @@ 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. */ - INIT_LIST_HEAD(&m2m_ctx->queue); + if (m2m_ctx->job_flags & TRANS_QUEUED) + list_del(&m2m_ctx->queue); m2m_ctx->job_flags = 0; spin_lock_irqsave(&q_ctx->rdy_spinlock, flags);