diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2017-11-10 13:21:53 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2017-11-10 13:29:53 -0500 |
commit | 781f2dd0a5eb8e660c0a5dbb11a69aed72f26657 (patch) | |
tree | 03aa15ba86ca4dbc409f039bc844c6bf639e6252 | |
parent | 0145a7141e597e14c60f7561add76bea874768b2 (diff) |
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 <dan.carpenter@oracle.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r-- | drivers/input/misc/uinput.c | 6 |
1 files changed, 4 insertions, 2 deletions
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, | |||
857 | 857 | ||
858 | if (!udev->dev) { | 858 | if (!udev->dev) { |
859 | udev->dev = input_allocate_device(); | 859 | udev->dev = input_allocate_device(); |
860 | if (!udev->dev) | 860 | if (!udev->dev) { |
861 | return -ENOMEM; | 861 | retval = -ENOMEM; |
862 | goto out; | ||
863 | } | ||
862 | } | 864 | } |
863 | 865 | ||
864 | switch (cmd) { | 866 | switch (cmd) { |