aboutsummaryrefslogtreecommitdiff
path: root/drivers/hid/hidraw.c
AgeCommit message (Collapse)Author
2009-01-04Merge branch 'upstream-fixes' into for-nextJiri Kosina
Conflicts: drivers/hid/hid-ids.h
2009-01-04HID: fix reference count leak hidrawOliver Neukum
The hidraw subsystem has a bug that prevents the close syscall from ever reaching the low level driver, leading to a resource leak. Fix by replacing postdecrement with predecrement. Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-01-04HID: set proper dev.parent in hidrawJiri Kosina
We need to properly set parent of the hidraw device (which is the corresponding physical device itself) in order to hidraw devices not end up under virtual device tree. Reported-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-01-04HID: add phys and name ioctls to hidrawJiri Kosina
The hiddev interface provides ioctl() calls which can be used to obtain phys and raw name of the underlying device. Add the corresponding support also into hidraw. Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2008-11-13HID: fix locking in hidraw_open()Oliver Neukum
As open needs to sleep hidraw was wrong to call it with a spinlock held. Furthermore, open can of course fail which needs to be handled. Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2008-10-23HID: fix lock imbalance in hidrawJiri Slaby
Add omitted unlock_kernel() to hidraw_ioctl(). Added in 979c407e3b89b606e810fa494ef316896eadbfad (HID: Push down BKL into ioctl handler in hidraw). Corresponing sparse warning: drivers/hid/hidraw.c:267:9: warning: context imbalance in 'hidraw_ioctl': wrong count at exit drivers/hid/hidraw.c:267:9: context 'kernel_lock': wanted 0, got 1 Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2008-10-17HID: fix hidraw_exit section mismatchJiri Slaby
hidraw_exit() marked as __exit is called from __init function from HID core. Remove the section placement from that function. Reported-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2008-10-16device create: misc: convert device_create_drvdata to device_createGreg Kroah-Hartman
Now that device_create() has been audited, rename things back to the original call to be sane. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-10-14HID: fix incorrent length condition in hidraw_write()Jiri Kosina
The bound check on the buffer length if (count > HID_MIN_BUFFER_SIZE) is of course incorrent, the proper check is if (count > HID_MAX_BUFFER_SIZE) Fix it. Reported-by: Jerry Ryle <jerry@mindtribe.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2008-10-14HID: hid, make parsing event drivenJiri Slaby
Next step for complete hid bus, this patch includes: - call parser either from probe or from hid-core if there is no probe. - add ll_driver structure and centralize some stuff there (open, close...) - split and merge usb_hid_configure and hid_probe into several functions to allow hooks/fixes between them Signed-off-by: Jiri Slaby <jslaby@suse.cz> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2008-07-23Merge branches 'upstream' and 'upstream-fixes' into for-linusJiri Kosina
2008-07-23HID: fix memory leak in hidraw_releaseJiri Kosina
hidraw_release() forgot to free the linked list structure, causing memory leak. Reported-by: Juan Marcos Diez Esteban <juan_m_diez@yahoo.es> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2008-07-23HID: Push down BKL into ioctl handler in hidrawAlan Cox
In this case I simply wrapped it as code review suggests the locking already terminally broken and I didn't want to make it first. See added comment Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2008-07-21device create: hid: convert device_create to device_create_drvdataGreg Kroah-Hartman
device_create() is race-prone, so use the race-free device_create_drvdata() instead as device_create() is going away. Signed-off-by: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-06-20HID: cdev lock_kernel() pushdownJonathan Corbet
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
2007-10-19Use helpers to obtain task pid in printksPavel Emelyanov
The task_struct->pid member is going to be deprecated, so start using the helpers (task_pid_nr/task_pid_vnr/task_pid_nr_ns) in the kernel. The first thing to start with is the pid, printed to dmesg - in this case we may safely use task_pid_nr(). Besides, printks produce more (much more) than a half of all the explicit pid usage. [akpm@linux-foundation.org: git-drm went and changed lots of stuff] Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Cc: Dave Airlie <airlied@linux.ie> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-15HID: fix HIDIOCGRDESC memory access in hidrawJiri Kosina
Fix bogus copying of data into userspace when HIDIOCGRDESC is issued. HID-transport layer makes sure that dev->hid->rdesc is not larger than HID_MAX_DESCRIPTOR_SIZE. Noticed-by: Al Viro <viro@ftp.linux.org.uk> Signed-off-by: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-14HID: hidraw_connect() memleak fixMariusz Kozlowski
It looks like hidraw_connect() is leaking memory in case of failure. Also it should return -ENOMEM when kzalloc fails. Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2007-10-14HID: add hidraw interfaceJiri Kosina
hidraw is an interface that is going to obsolete hiddev one day. Many userland applications are using libusb instead of using kernel-provided hiddev interface. This is caused by various reasons - the HID parser in kernel doesn't handle all the HID hardware on the planet properly, some devices might require its own specific quirks/drivers, etc. hiddev interface tries to do its best to parse all the received reports properly, and presents only parsed usages into userspace. This is however often not enough, and that's the reason why many userland applications just don't use hiddev at all, and rather use libusb to read raw USB events and process them on their own. Another drawback of hiddev is that it is USB-specific. hidraw interface provides userspace readers with really raw HID reports, no matter what the low-level transport layer is (USB/BT), and gives the userland applications all the freedom to process the HID reports in a way they wish to. Signed-off-by: Jiri Kosina <jkosina@suse.cz>