diff options
author | Amit Nagal <helloin.amit@gmail.com> | 2011-09-27 19:41:58 +0200 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2011-09-27 18:42:22 +0200 |
commit | f554ff80339b4005856e6a86454d6ea2bb962ee5 (patch) | |
tree | cb3c9c31c9d15a31a112e885176e5931630848e0 /drivers | |
parent | HID: hiddev: potential info leak in hiddev_ioctl() (diff) | |
download | linux-f554ff80339b4005856e6a86454d6ea2bb962ee5.tar.xz linux-f554ff80339b4005856e6a86454d6ea2bb962ee5.zip |
HID: hidraw: open count should not increase if error
In hidraw_open, if hid_hw_power returns with error, hidraw device open count
should not increase.
Signed-off-by: Amit Nagal <helloin.amit@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/hid/hidraw.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index a8c2b7b6220a..6d65d4e35120 100644 --- a/drivers/hid/hidraw.c +++ b/drivers/hid/hidraw.c @@ -272,8 +272,10 @@ static int hidraw_open(struct inode *inode, struct file *file) dev = hidraw_table[minor]; if (!dev->open++) { err = hid_hw_power(dev->hid, PM_HINT_FULLON); - if (err < 0) + if (err < 0) { + dev->open--; goto out_unlock; + } err = hid_hw_open(dev->hid); if (err < 0) { |