From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C9CEC43444 for ; Wed, 16 Jan 2019 16:14:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 11C2D206C2 for ; Wed, 16 Jan 2019 16:14:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547655241; bh=GlqLSc9xC5lbNceuxiqNcfxyUYcp418MFBSj03ocT+M=; h=From:Date:Subject:To:Cc:Reply-to:List-ID:From; b=1sdHEsB117pJrcnYE7m7V0pxN2vhmZuCdaxZunNMH0ufRm9Epdhk3FKLtAx+ZTeDT dQtNmNAgcFajt0MISjmgzplY7fICwv0U/k5VSwywDVWuRnaU+gKfYZzmgrCjoirvfi EXBJY4leyWhf4A4dt5GLo5ngbNofLPuWoULdKErU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727878AbfAPQOA (ORCPT ); Wed, 16 Jan 2019 11:14:00 -0500 Received: from www.linuxtv.org ([130.149.80.248]:56736 "EHLO www.linuxtv.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727881AbfAPQOA (ORCPT ); Wed, 16 Jan 2019 11:14:00 -0500 Received: from mchehab by www.linuxtv.org with local (Exim 4.84_2) (envelope-from ) id 1gjnpG-0006FG-El; Wed, 16 Jan 2019 16:13:58 +0000 From: Mauro Carvalho Chehab Date: Wed, 16 Jan 2019 16:13:25 +0000 Subject: [git:media_tree/fixes] media: vim2m: only cancel work if it is for right context To: linuxtv-commits@linuxtv.org Cc: stable@vger.kernel.org, Hans Verkuil Mail-followup-to: linux-media@vger.kernel.org Forward-to: linux-media@vger.kernel.org Reply-to: linux-media@vger.kernel.org Message-Id: Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org This is an automatic generated email to let you know that the following patch were queued: Subject: media: vim2m: only cancel work if it is for right context Author: Hans Verkuil Date: Fri Jan 11 07:07:25 2019 -0500 cancel_delayed_work_sync() was called for any queue, but it should only be called for the queue that is associated with the currently running job. Otherwise, if two filehandles are streaming at the same time, then closing the first will cancel the work which might still be running for a job from the second filehandle. As a result the second filehandle will never be able to finish the job and an attempt to stop streaming on that second filehandle will stall. Fixes: 52117be68b82 ("media: vim2m: use cancel_delayed_work_sync instead of flush_schedule_work") Signed-off-by: Hans Verkuil Cc: # for v4.20 and up Signed-off-by: Mauro Carvalho Chehab drivers/media/platform/vim2m.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- diff --git a/drivers/media/platform/vim2m.c b/drivers/media/platform/vim2m.c index d01821a6906a..89d9c4c21037 100644 --- a/drivers/media/platform/vim2m.c +++ b/drivers/media/platform/vim2m.c @@ -807,7 +807,9 @@ static void vim2m_stop_streaming(struct vb2_queue *q) struct vb2_v4l2_buffer *vbuf; unsigned long flags; - cancel_delayed_work_sync(&dev->work_run); + if (v4l2_m2m_get_curr_priv(dev->m2m_dev) == ctx) + cancel_delayed_work_sync(&dev->work_run); + for (;;) { if (V4L2_TYPE_IS_OUTPUT(q->type)) vbuf = v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx);