From patchwork Thu May 26 08:52:01 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 6750 Return-path: Envelope-to: mchehab@pedra Delivery-date: Thu, 26 May 2011 06:09:40 -0300 Received: from mchehab by pedra with local (Exim 4.72) (envelope-from ) id 1QPWZY-00074r-4j for mchehab@pedra; Thu, 26 May 2011 06:09:40 -0300 Received: from casper.infradead.org [85.118.1.10] by pedra with IMAP (fetchmail-6.3.17) for (single-drop); Thu, 26 May 2011 06:09:40 -0300 (BRT) Received: from vger.kernel.org ([209.132.180.67]) by casper.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QPWYY-0001SL-VB; Thu, 26 May 2011 09:08:39 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757087Ab1EZIw3 (ORCPT + 1 other); Thu, 26 May 2011 04:52:29 -0400 Received: from mail-bw0-f46.google.com ([209.85.214.46]:33538 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756953Ab1EZIw2 (ORCPT ); Thu, 26 May 2011 04:52:28 -0400 Received: by bwz15 with SMTP id 15so254899bwz.19 for ; Thu, 26 May 2011 01:52:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:date:from:to:cc:subject:message-id:mime-version :content-type:content-disposition:user-agent; bh=qn4UQ3FwTaoIJMRfareNzLCnbSEKQ/S4EpENqzhHGhg=; b=rN2kxT9CLOSbxR6IlEytZsuN3W3EeKR2QeED4jvgaiVvu5ObIT6EenoVfGp19I7xBB QoJYLRPuGbLS7SiWuYDT9RlFarw21qmpdPKQgR1sONmrzr+kTe3x48taliPlkk+DHsFI ENEDlrUfAS3n6jtuQlMuoLzMgdfQMpGWehHek= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=irkAydKNEJQXAfByJYGi31ak9Faym/RFJCR9cuHgMdjpAueil49uvdTUlxVDhHLB3L 5a/3H67JecX4hoi5dlVVaSqIl5VtF9W9d4T5JTEBzwdGqB0GdZ4ZvL6syIpjamA6b61P vJUSk/WkuaUx/aLTtuCw2NejHRAYZkZM0v51Q= Received: by 10.205.82.202 with SMTP id ad10mr398472bkc.156.1306399946958; Thu, 26 May 2011 01:52:26 -0700 (PDT) Received: from shale.localdomain ([212.49.88.34]) by mx.google.com with ESMTPS id x6sm282040bkv.0.2011.05.26.01.52.21 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 26 May 2011 01:52:25 -0700 (PDT) Date: Thu, 26 May 2011 11:52:01 +0300 From: Dan Carpenter To: Mauro Carvalho Chehab Cc: Jarod Wilson , David =?iso-8859-1?Q?H=E4rdeman?= , Dmitry Torokhov , "open list:MEDIA INPUT INFRA..." , kernel-janitors@vger.kernel.org Subject: [patch] [media] rc: double unlock in rc_register_device() Message-ID: <20110526085201.GF14591@shale.localdomain> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Sender: If change_protocol() fails and we goto out_raw, then it calls unlock twice. I noticed that the other time we called change_protocol() we held the &dev->lock, so I changed it to hold it here too. Signed-off-by: Dan Carpenter Reviewed-by: Jarod Wilson Acked-by: Jarod Wilson --- Compile tested only. -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index f57cd56..136a6c6 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c @@ -1097,7 +1097,6 @@ int rc_register_device(struct rc_dev *dev) if (rc < 0) goto out_input; } - mutex_unlock(&dev->lock); if (dev->change_protocol) { rc = dev->change_protocol(dev, rc_map->rc_type); @@ -1105,6 +1104,8 @@ int rc_register_device(struct rc_dev *dev) goto out_raw; } + mutex_unlock(&dev->lock); + IR_dprintk(1, "Registered rc%ld (driver: %s, remote: %s, mode %s)\n", dev->devno, dev->driver_name ? dev->driver_name : "unknown",