From patchwork Wed Nov 8 08:39:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 10047993 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 7F5AC6032D for ; Wed, 8 Nov 2017 08:40:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E5152A362 for ; Wed, 8 Nov 2017 08:40:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6318B2A3A2; Wed, 8 Nov 2017 08:40:23 +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.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY 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 4F13A2A362 for ; Wed, 8 Nov 2017 08:40:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751013AbdKHIkR (ORCPT ); Wed, 8 Nov 2017 03:40:17 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:33486 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750720AbdKHIkP (ORCPT ); Wed, 8 Nov 2017 03:40:15 -0500 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id vA88e8pF004131 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 8 Nov 2017 08:40:08 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id vA88e82a014813 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 8 Nov 2017 08:40:08 GMT Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id vA88e78O008431; Wed, 8 Nov 2017 08:40:07 GMT Received: from mwanda (/129.205.6.86) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 08 Nov 2017 00:40:06 -0800 Date: Wed, 8 Nov 2017 11:39:46 +0300 From: Dan Carpenter To: Dmitry Torokhov Cc: Henrik Rydberg , Benjamin Tissoires , linux-input@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] Input: uinput - unlock on allocation failure in ioctl Message-ID: <20171108083946.vbsixgkodhw6jh4q@mwanda> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: NeoMutt/20170609 (1.8.3) X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We have to unlock before returning if input_allocate_device() fails. Fixes: 04ce40a61a91 ("Input: uinput - remove uinput_allocate_device()") 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/input/misc/uinput.c b/drivers/input/misc/uinput.c index 7b41aad7ec27..39ddd9a73feb 100644 --- a/drivers/input/misc/uinput.c +++ b/drivers/input/misc/uinput.c @@ -857,8 +857,10 @@ static long uinput_ioctl_handler(struct file *file, unsigned int cmd, if (!udev->dev) { udev->dev = input_allocate_device(); - if (!udev->dev) - return -ENOMEM; + if (!udev->dev) { + retval = -ENOMEM; + goto out; + } } switch (cmd) {