From: Dan Carpenter Date: Fri, 10 Nov 2017 18:21:53 +0000 (-0800) Subject: Input: uinput - unlock on allocation failure in ioctl X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=781f2dd0a5eb8e660c0a5dbb11a69aed72f26657;p=openwrt%2Fstaging%2Fblogic.git Input: uinput - unlock on allocation failure in ioctl We have to unlock before returning if input_allocate_device() fails. Fixes: 04ce40a61a91 ("Input: uinput - remove uinput_allocate_device()") Signed-off-by: Dan Carpenter Signed-off-by: Dmitry Torokhov --- 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) {