From patchwork Mon Nov 6 03:34:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Limonciello, Mario" X-Patchwork-Id: 10042571 X-Patchwork-Delegate: dvhart@infradead.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 96392603FF for ; Mon, 6 Nov 2017 03:34:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 83E4029083 for ; Mon, 6 Nov 2017 03:34:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7916429098; Mon, 6 Nov 2017 03:34:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2FFF829083 for ; Mon, 6 Nov 2017 03:34:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750817AbdKFDeq (ORCPT ); Sun, 5 Nov 2017 22:34:46 -0500 Received: from esa3.dell-outbound.iphmx.com ([68.232.153.94]:47905 "EHLO esa3.dell-outbound.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750914AbdKFDep (ORCPT ); Sun, 5 Nov 2017 22:34:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=dell.com; i=@dell.com; q=dns/txt; s=smtpout; t=1509938877; x=1541474877; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=60Kw4dWvZWCEVNZVsvovBaSbGW7qjJiZViUjP/O03xw=; b=ZPk9dtlAj5nPpUetVN+8RQIh2/nxakPlh1UF9e/W/AzHcMIxfA1NTS7W nUGa6H2NwkETbEC0e9DFMN2PP6FgDy3rSmrnG6bFnSIkxNDO5S7aWspbD 2ZifhvXYIhtEd7r0yjTSL3XCqyqyyLEVgggFpVBuytjTtQwf2fw7HdM7H g=; Received: from esa5.dell-outbound2.iphmx.com ([68.232.153.203]) by esa3.dell-outbound.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Nov 2017 21:27:56 -0600 Received: from ausc60ps301.us.dell.com ([143.166.148.206]) by esa5.dell-outbound2.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Nov 2017 09:32:02 +0600 X-LoopCount0: from 10.208.86.39 X-IronPort-AV: E=Sophos;i="5.44,350,1505797200"; d="scan'208";a="1053966445" X-DLP: DLP_GlobalPCIDSS From: Mario Limonciello To: dvhart@infradead.org, Andy Shevchenko Cc: LKML , platform-driver-x86@vger.kernel.org, Mario Limonciello Subject: [PATCH 1/2] platform/x86: wmi: release mutex on module acquistion failure Date: Sun, 5 Nov 2017 21:34:33 -0600 Message-Id: <1509939274-2813-2-git-send-email-mario.limonciello@dell.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1509939274-2813-1-git-send-email-mario.limonciello@dell.com> References: <1509939274-2813-1-git-send-email-mario.limonciello@dell.com> Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This failure mode should have also released the mutex. Signed-off-by: Mario Limonciello --- drivers/platform/x86/wmi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index 8c31ed4..791449a 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c @@ -868,8 +868,10 @@ static long wmi_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) /* let the driver do any filtering and do the call */ wdriver = container_of(wblock->dev.dev.driver, struct wmi_driver, driver); - if (!try_module_get(wdriver->driver.owner)) - return -EBUSY; + if (!try_module_get(wdriver->driver.owner)) { + ret = -EBUSY; + goto out_ioctl; + } ret = wdriver->filter_callback(&wblock->dev, cmd, buf); module_put(wdriver->driver.owner); if (ret)