From patchwork Wed Aug 24 11:27:46 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 1092072 X-Patchwork-Delegate: jikos@jikos.cz Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p7OBU5JY016151 for ; Wed, 24 Aug 2011 11:30:05 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753680Ab1HXLaE (ORCPT ); Wed, 24 Aug 2011 07:30:04 -0400 Received: from mail-ww0-f44.google.com ([74.125.82.44]:35293 "EHLO mail-ww0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752725Ab1HXLaE (ORCPT ); Wed, 24 Aug 2011 07:30:04 -0400 Received: by wwf5 with SMTP id 5so1103077wwf.1 for ; Wed, 24 Aug 2011 04:30:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=BdL0A2Rs0N5j7bZbwoWBVyjHMsINLc8Z1hrbH1RxE/o=; b=nYT8kFaGHxS5BgDBQ4DW7zygo3CFAcV6MsB/WSTVD/MUcIqMfh58LfpAQ4vWMhQrsR xinU2+uCGsflz4zXWvA9cISOcoURcJwiT2kM64VQkR5dgNqM5APHEJ2cfm99zcN/3J/R qOZpUCmlsGDqyJQ/pJNQ8V+tmmkqpc5CF1oOg= Received: by 10.227.167.75 with SMTP id p11mr1300621wby.4.1314185402499; Wed, 24 Aug 2011 04:30:02 -0700 (PDT) Received: from shale.localdomain ([212.49.88.34]) by mx.google.com with ESMTPS id p18sm758311wbh.38.2011.08.24.04.29.58 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 24 Aug 2011 04:30:01 -0700 (PDT) Date: Wed, 24 Aug 2011 14:27:46 +0300 From: Dan Carpenter To: Jiri Kosina , dh.herrmann@googlemail.com Cc: "open list:HID CORE LAYER" , kernel-janitors@vger.kernel.org Subject: [patch -next] HID: unlock on error path in hid_device_probe() Message-ID: <20110824112745.GB5975@shale.localdomain> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 24 Aug 2011 11:30:06 +0000 (UTC) We recently introduced locking into this function, but we missed an error path which needs an unlock. Signed-off-by: Dan Carpenter --- To unsubscribe from this list: send the line "unsubscribe linux-input" 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/hid/hid-core.c b/drivers/hid/hid-core.c index 582be00..ed0cd09 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -1643,8 +1643,10 @@ static int hid_device_probe(struct device *dev) if (!hdev->driver) { id = hid_match_device(hdev, hdrv); - if (id == NULL) - return -ENODEV; + if (id == NULL) { + ret = -ENODEV; + goto unlock; + } hdev->driver = hdrv; if (hdrv->probe) { @@ -1657,7 +1659,7 @@ static int hid_device_probe(struct device *dev) if (ret) hdev->driver = NULL; } - +unlock: up(&hdev->driver_lock); return ret; }