From patchwork Sat Dec 8 12:50:50 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 1852491 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 8E78A400ED for ; Sat, 8 Dec 2012 12:51:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755962Ab2LHMvV (ORCPT ); Sat, 8 Dec 2012 07:51:21 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:25483 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755041Ab2LHMvU (ORCPT ); Sat, 8 Dec 2012 07:51:20 -0500 Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by userp1040.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id qB8CpAei009717 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 8 Dec 2012 12:51:11 GMT Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id qB8Cp93v016630 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 8 Dec 2012 12:51:09 GMT Received: from abhmt116.oracle.com (abhmt116.oracle.com [141.146.116.68]) by acsmt357.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id qB8Cp9kO006382; Sat, 8 Dec 2012 06:51:09 -0600 Received: from lappy.hsd1.ma.comcast.net. (/50.133.228.71) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 08 Dec 2012 04:51:08 -0800 From: Sasha Levin To: mchehab@redhat.com Cc: david@hardeman.nu, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Sasha Levin Subject: [PATCH] rc-core: don't return from store_protocols without releasing device mutex Date: Sat, 8 Dec 2012 07:50:50 -0500 Message-Id: <1354971050-5784-1-git-send-email-sasha.levin@oracle.com> X-Mailer: git-send-email 1.8.0 X-Source-IP: acsinet21.oracle.com [141.146.126.237] Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Commit c003ab1b ("[media] rc-core: add separate defines for protocol bitmaps and numbers") has introduced a bug which allows store_protocols() to return without releasing the device mutex it's holding. Doing that would cause infinite hangs waiting on device mutex next time around. Signed-off-by: Sasha Levin Acked-by: David Härdeman --- drivers/media/rc/rc-main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index 601d1ac1..0510f4d 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c @@ -890,7 +890,8 @@ static ssize_t store_protocols(struct device *device, if (i == ARRAY_SIZE(proto_names)) { IR_dprintk(1, "Unknown protocol: '%s'\n", tmp); - return -EINVAL; + ret = -EINVAL; + goto out; } count++;