From patchwork Wed Nov 6 08:39:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda Delgado X-Patchwork-Id: 3145531 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 CB4D1BEEB2 for ; Wed, 6 Nov 2013 08:39:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6F50A20549 for ; Wed, 6 Nov 2013 08:39:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5A39520544 for ; Wed, 6 Nov 2013 08:39:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756104Ab3KFIjq (ORCPT ); Wed, 6 Nov 2013 03:39:46 -0500 Received: from mail-la0-f45.google.com ([209.85.215.45]:51105 "EHLO mail-la0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753440Ab3KFIjp (ORCPT ); Wed, 6 Nov 2013 03:39:45 -0500 Received: by mail-la0-f45.google.com with SMTP id el20so1425746lab.4 for ; Wed, 06 Nov 2013 00:39:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=x63s2sJ0Rm22NrkmKSJ/PWn3gS/uvTruQsbCRchQBtU=; b=U41Wvh24uKyCHYSYbvAcBbYukoFX1KRomHUX9POHo9bFrF7yBIsQxDl0Y9JkLYbQVl L8NCPiq5ZLI25wRvOD6a+cbnW5zUP7NuDJdvhZT9u+75peIAmQhL95kBD6dRiqb7KePO U36gUCHQIXfaMgatMAvTAE8viFZzIhQ9sD3ek2TGgdvMN0yEvyyNsXy4D87kLFN8xX8f c+MMOubYFmAgzwuI75jJ97WXL2M/0P0e7uerp1YxQNQIZYD1MYd0sft3lfEyDMxPy2AC yVKsNPz7q4DLNhGE2+VRyBWSf23FB4Xd7UmRwLAo1IbzUb8wivS0a2CeWcjzBSJFj97q Hi/Q== X-Received: by 10.152.22.131 with SMTP id d3mr1441072laf.35.1383727184234; Wed, 06 Nov 2013 00:39:44 -0800 (PST) Received: from neopili.qtec.com (0x4dd4aed9.adsl.cybercity.dk. [77.212.174.217]) by mx.google.com with ESMTPSA id vo1sm23198101lbb.1.2013.11.06.00.39.42 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Nov 2013 00:39:43 -0800 (PST) From: Ricardo Ribalda Delgado To: linux-media@vger.kernel.org Cc: Ricardo Ribalda Delgado Subject: [PATCH] em28xx-video: Swap release order to avoid lock nesting Date: Wed, 6 Nov 2013 09:39:35 +0100 Message-Id: <1383727175-26052-1-git-send-email-ricardo.ribalda@gmail.com> X-Mailer: git-send-email 1.8.4.rc3 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 vb2_fop_release might take the video queue mutex lock. In order to avoid nesting mutexes the private mutex is taken after the fop_release has finished. Signed-off-by: Ricardo Ribalda Delgado Acked-by: Hans Verkuil --- drivers/media/usb/em28xx/em28xx-video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c index 9d10334..b5c3360 100644 --- a/drivers/media/usb/em28xx/em28xx-video.c +++ b/drivers/media/usb/em28xx/em28xx-video.c @@ -1663,8 +1663,8 @@ static int em28xx_v4l2_close(struct file *filp) em28xx_videodbg("users=%d\n", dev->users); - mutex_lock(&dev->lock); vb2_fop_release(filp); + mutex_lock(&dev->lock); if (dev->users == 1) { /* the device is already disconnect,