27 Jan, 2020

1 commit


10 Jan, 2020

1 commit

  • hidraw and uhid device nodes are always available for writing so we should
    always report EPOLLOUT and EPOLLWRNORM bits, not only in the cases when
    there is nothing to read.

    Reported-by: Linus Torvalds
    Fixes: be54e7461ffdc ("HID: uhid: Fix returning EPOLLOUT from uhid_char_poll")
    Fixes: 9f3b61dc1dd7b ("HID: hidraw: Fix returning EPOLLOUT from hidraw_poll")
    Signed-off-by: Jiri Kosina

    Jiri Kosina
     

11 Dec, 2019

1 commit


09 Dec, 2019

1 commit

  • When polling a connected /dev/hidrawX device, it is useful to get the
    EPOLLOUT when writing is possible. Since writing is possible as soon as
    the device is connected, always return it.

    Right now EPOLLOUT is only returned when there are also input reports
    are available. This works if devices start sending reports when
    connected, but some HID devices might need an output report first before
    sending any input reports. This change will allow using EPOLLOUT here as
    well.

    Fixes: 378b80370aa1 ("hidraw: Return EPOLLOUT from hidraw_poll")
    Signed-off-by: Marcel Holtmann
    Cc: stable@vger.kernel.org
    Signed-off-by: Jiri Kosina

    Marcel Holtmann
     

02 Dec, 2019

1 commit

  • Pull HID updates from Jiri Kosina:

    - Support for Logitech G15 (Hans de Goede)

    - HID parser improvements, improving support for some devices; e.g.
    Windows Precision Touchpad, products from Primax, etc. (Blaž
    Hrastnik, Candle Sun)

    - robustification of tablet mode support in google-whiskers driver
    (Dmitry Torokhov)

    - assorted small fixes, device-specific quirks and device ID additions

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid: (23 commits)
    HID: rmi: Check that the RMI_STARTED bit is set before unregistering the RMI transport device
    HID: quirks: remove hid-led devices from hid_have_special_driver
    HID: Improve Windows Precision Touchpad detection.
    HID: i2c-hid: Reset ALPS touchpads on resume
    HID: i2c-hid: fix no irq after reset on raydium 3118
    HID: logitech-hidpp: Silence intermittent get_battery_capacity errors
    HID: i2c-hid: remove orphaned member sleep_delay
    HID: quirks: Add quirk for HP MSU1465 PIXART OEM mouse
    HID: core: check whether Usage Page item is after Usage ID items
    HID: intel-ish-hid: Spelling s/diconnect/disconnect/
    HID: google: Detect base folded usage instead of hard-coding whiskers
    HID: logitech: Add depends on LEDS_CLASS to Logitech Kconfig entry
    HID: lg-g15: Add support for the G510's M1-M3 and MR LEDs
    HID: lg-g15: Add support for controlling the G510's RGB backlight
    HID: lg-g15: Add support for the G510 keyboards' gaming keys
    HID: lg-g15: Add support for the M1-M3 and MR LEDs
    HID: lg-g15: Add keyboard and LCD backlight control
    HID: Add driver for Logitech gaming keyboards (G15, G15 v2)
    Input: Add event-codes for macro keys found on various keyboards
    HID: hidraw: replace printk() with corresponding pr_xx() variant
    ...

    Linus Torvalds
     

23 Oct, 2019

1 commit

  • The .ioctl and .compat_ioctl file operations have the same prototype so
    they can both point to the same function, which works great almost all
    the time when all the commands are compatible.

    One exception is the s390 architecture, where a compat pointer is only
    31 bit wide, and converting it into a 64-bit pointer requires calling
    compat_ptr(). Most drivers here will never run in s390, but since we now
    have a generic helper for it, it's easy enough to use it consistently.

    I double-checked all these drivers to ensure that all ioctl arguments
    are used as pointers or are ignored, but are not interpreted as integer
    values.

    Acked-by: Jason Gunthorpe
    Acked-by: Daniel Vetter
    Acked-by: Mauro Carvalho Chehab
    Acked-by: Greg Kroah-Hartman
    Acked-by: David Sterba
    Acked-by: Darren Hart (VMware)
    Acked-by: Jonathan Cameron
    Acked-by: Bjorn Andersson
    Acked-by: Dan Williams
    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     

01 Oct, 2019

1 commit


23 Sep, 2019

1 commit


22 Aug, 2019

1 commit

  • The syzbot fuzzer has reported a pair of problems in the
    hidraw_ioctl() function: slab-out-of-bounds read and use-after-free
    read. An example of the first:

    BUG: KASAN: slab-out-of-bounds in strlen+0x79/0x90 lib/string.c:525
    Read of size 1 at addr ffff8881c8035f38 by task syz-executor.4/2833

    CPU: 1 PID: 2833 Comm: syz-executor.4 Not tainted 5.3.0-rc2+ #1
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
    Google 01/01/2011
    Call Trace:
    __dump_stack lib/dump_stack.c:77 [inline]
    dump_stack+0xca/0x13e lib/dump_stack.c:113
    print_address_description+0x6a/0x32c mm/kasan/report.c:351
    __kasan_report.cold+0x1a/0x33 mm/kasan/report.c:482
    kasan_report+0xe/0x12 mm/kasan/common.c:612
    strlen+0x79/0x90 lib/string.c:525
    strlen include/linux/string.h:281 [inline]
    hidraw_ioctl+0x245/0xae0 drivers/hid/hidraw.c:446
    vfs_ioctl fs/ioctl.c:46 [inline]
    file_ioctl fs/ioctl.c:509 [inline]
    do_vfs_ioctl+0xd2d/0x1330 fs/ioctl.c:696
    ksys_ioctl+0x9b/0xc0 fs/ioctl.c:713
    __do_sys_ioctl fs/ioctl.c:720 [inline]
    __se_sys_ioctl fs/ioctl.c:718 [inline]
    __x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:718
    do_syscall_64+0xb7/0x580 arch/x86/entry/common.c:296
    entry_SYSCALL_64_after_hwframe+0x49/0xbe
    RIP: 0033:0x459829
    Code: fd b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7
    48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 3d 01 f0 ff
    ff 0f 83 cb b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00
    RSP: 002b:00007f7a68f6dc78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
    RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000459829
    RDX: 0000000000000000 RSI: 0000000080404805 RDI: 0000000000000004
    RBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000
    R10: 0000000000000000 R11: 0000000000000246 R12: 00007f7a68f6e6d4
    R13: 00000000004c21de R14: 00000000004d5620 R15: 00000000ffffffff

    The two problems have the same cause: hidraw_ioctl() fails to test
    whether the device has been removed. This patch adds the missing test.

    Reported-and-tested-by: syzbot+5a6c4ec678a0c6ee84ba@syzkaller.appspotmail.com
    Signed-off-by: Alan Stern
    CC:
    Signed-off-by: Jiri Kosina

    Alan Stern
     

05 Aug, 2019

1 commit

  • Always return EPOLLOUT from hidraw_poll when a device is connected.
    This is safe since writes are always possible (but will always block).

    hidraw does not support non-blocking writes and instead always calls
    blocking backend functions on write requests. Hence, so far, a call to
    poll never returned EPOLLOUT, which confuses tools like socat.

    Signed-off-by: Fabian Henneke
    In-reply-to:
    Signed-off-by: Jiri Kosina

    Fabian Henneke
     

05 Jun, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms and conditions of the gnu general public license
    version 2 as published by the free software foundation you should
    have received a copy of the gnu general public license along with
    this program if not write to the free software foundation inc 51
    franklin st fifth floor boston ma 02110 1301 usa

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 2 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Reviewed-by: Richard Fontana
    Reviewed-by: Alexios Zavras
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190529141902.078500636@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

12 Nov, 2018

1 commit


13 Jun, 2018

1 commit

  • The kmalloc() function has a 2-factor argument form, kmalloc_array(). This
    patch replaces cases of:

    kmalloc(a * b, gfp)

    with:
    kmalloc_array(a * b, gfp)

    as well as handling cases of:

    kmalloc(a * b * c, gfp)

    with:

    kmalloc(array3_size(a, b, c), gfp)

    as it's slightly less ugly than:

    kmalloc_array(array_size(a, b), c, gfp)

    This does, however, attempt to ignore constant size factors like:

    kmalloc(4 * 1024, gfp)

    though any constants defined via macros get caught up in the conversion.

    Any factors with a sizeof() of "unsigned char", "char", and "u8" were
    dropped, since they're redundant.

    The tools/ directory was manually excluded, since it has its own
    implementation of kmalloc().

    The Coccinelle script used for this was:

    // Fix redundant parens around sizeof().
    @@
    type TYPE;
    expression THING, E;
    @@

    (
    kmalloc(
    - (sizeof(TYPE)) * E
    + sizeof(TYPE) * E
    , ...)
    |
    kmalloc(
    - (sizeof(THING)) * E
    + sizeof(THING) * E
    , ...)
    )

    // Drop single-byte sizes and redundant parens.
    @@
    expression COUNT;
    typedef u8;
    typedef __u8;
    @@

    (
    kmalloc(
    - sizeof(u8) * (COUNT)
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(__u8) * (COUNT)
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(char) * (COUNT)
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(unsigned char) * (COUNT)
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(u8) * COUNT
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(__u8) * COUNT
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(char) * COUNT
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(unsigned char) * COUNT
    + COUNT
    , ...)
    )

    // 2-factor product with sizeof(type/expression) and identifier or constant.
    @@
    type TYPE;
    expression THING;
    identifier COUNT_ID;
    constant COUNT_CONST;
    @@

    (
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * (COUNT_ID)
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * COUNT_ID
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * (COUNT_CONST)
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * COUNT_CONST
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * (COUNT_ID)
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * COUNT_ID
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * (COUNT_CONST)
    + COUNT_CONST, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * COUNT_CONST
    + COUNT_CONST, sizeof(THING)
    , ...)
    )

    // 2-factor product, only identifiers.
    @@
    identifier SIZE, COUNT;
    @@

    - kmalloc
    + kmalloc_array
    (
    - SIZE * COUNT
    + COUNT, SIZE
    , ...)

    // 3-factor product with 1 sizeof(type) or sizeof(expression), with
    // redundant parens removed.
    @@
    expression THING;
    identifier STRIDE, COUNT;
    type TYPE;
    @@

    (
    kmalloc(
    - sizeof(TYPE) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kmalloc(
    - sizeof(THING) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kmalloc(
    - sizeof(THING) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kmalloc(
    - sizeof(THING) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kmalloc(
    - sizeof(THING) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    )

    // 3-factor product with 2 sizeof(variable), with redundant parens removed.
    @@
    expression THING1, THING2;
    identifier COUNT;
    type TYPE1, TYPE2;
    @@

    (
    kmalloc(
    - sizeof(TYPE1) * sizeof(TYPE2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    kmalloc(
    - sizeof(THING1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    kmalloc(
    - sizeof(THING1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    )

    // 3-factor product, only identifiers, with redundant parens removed.
    @@
    identifier STRIDE, SIZE, COUNT;
    @@

    (
    kmalloc(
    - (COUNT) * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - COUNT * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - COUNT * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - (COUNT) * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - COUNT * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - (COUNT) * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - (COUNT) * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - COUNT * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    )

    // Any remaining multi-factor products, first at least 3-factor products,
    // when they're not all constants...
    @@
    expression E1, E2, E3;
    constant C1, C2, C3;
    @@

    (
    kmalloc(C1 * C2 * C3, ...)
    |
    kmalloc(
    - (E1) * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    kmalloc(
    - (E1) * (E2) * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    kmalloc(
    - (E1) * (E2) * (E3)
    + array3_size(E1, E2, E3)
    , ...)
    |
    kmalloc(
    - E1 * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    )

    // And then all remaining 2 factors products when they're not all constants,
    // keeping sizeof() as the second factor argument.
    @@
    expression THING, E1, E2;
    type TYPE;
    constant C1, C2, C3;
    @@

    (
    kmalloc(sizeof(THING) * C2, ...)
    |
    kmalloc(sizeof(TYPE) * C2, ...)
    |
    kmalloc(C1 * C2 * C3, ...)
    |
    kmalloc(C1 * C2, ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * (E2)
    + E2, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * E2
    + E2, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * (E2)
    + E2, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * E2
    + E2, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - (E1) * E2
    + E1, E2
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - (E1) * (E2)
    + E1, E2
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - E1 * E2
    + E1, E2
    , ...)
    )

    Signed-off-by: Kees Cook

    Kees Cook
     

09 Apr, 2018

1 commit

  • Doing `ioctl(HIDIOCGFEATURE)` in a tight loop on a hidraw device
    and then disconnecting the device, or unloading the driver, can
    cause a NULL pointer dereference.

    When a hidraw device is destroyed it sets 0 to `dev->exist`.
    Most functions check 'dev->exist' before doing its work, but
    `hidraw_get_report()` was missing that check.

    Cc: stable@vger.kernel.org
    Signed-off-by: Rodrigo Rivas Costa
    Signed-off-by: Jiri Kosina

    Rodrigo Rivas Costa
     

12 Feb, 2018

1 commit

  • This is the mindless scripted replacement of kernel use of POLL*
    variables as described by Al, done by this script:

    for V in IN OUT PRI ERR RDNORM RDBAND WRNORM WRBAND HUP RDHUP NVAL MSG; do
    L=`git grep -l -w POLL$V | grep -v '^t' | grep -v /um/ | grep -v '^sa' | grep -v '/poll.h$'|grep -v '^D'`
    for f in $L; do sed -i "-es/^\([^\"]*\)\(\\)/\\1E\\2/" $f; done
    done

    with de-mangling cleanups yet to come.

    NOTE! On almost all architectures, the EPOLL* constants have the same
    values as the POLL* constants do. But they keyword here is "almost".
    For various bad reasons they aren't the same, and epoll() doesn't
    actually work quite correctly in some cases due to this on Sparc et al.

    The next patch from Al will sort out the final differences, and we
    should be all done.

    Scripted-by: Al Viro
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

29 Nov, 2017

1 commit


02 Oct, 2017

1 commit

  • We should not try to bring HID device out of full power state before
    calling hid_hw_close(), so that transport driver operates on powered up
    device (making this inverse of the opening sequence).

    Signed-off-by: Dmitry Torokhov
    Reviewed-by: Guenter Roeck
    Reviewed-by: Benson Leung
    Signed-off-by: Jiri Kosina

    Dmitry Torokhov
     

02 Mar, 2017

1 commit


17 May, 2016

1 commit


04 Apr, 2016

1 commit


24 Mar, 2016

1 commit


02 Apr, 2014

1 commit


14 Mar, 2014

1 commit

  • hid_out_raw_report is going to be obsoleted as it is not part of the
    unified HID low level transport documentation
    (Documentation/hid/hid-transport.txt)

    To do so, we need to introduce two new quirks:
    * HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP: this quirks prevents the
    transport driver to use the interrupt channel to send output report
    (and thus force to use HID_REQ_SET_REPORT command)
    * HID_QUIRK_SKIP_OUTPUT_REPORT_ID: this one forces usbhid to not
    include the report ID in the buffer it sends to the device through
    HID_REQ_SET_REPORT in case of an output report

    This also fixes a regression introduced in commit 3a75b24949a8
    (HID: hidraw: replace hid_output_raw_report() calls by appropriates ones).
    The hidraw API was not able to communicate with the PS3 SixAxis
    controllers in USB mode.

    Reviewed-by: David Herrmann
    Signed-off-by: Benjamin Tissoires
    Tested-by: Antonio Ospite
    Signed-off-by: Jiri Kosina

    Benjamin Tissoires
     

26 Feb, 2014

1 commit

  • I noticed that after hot unplugging a Logitech unifying receiver
    (drivers/hid/hid-logitech-dj.c) the kernel would occasionally spew a
    stack trace similar to this:

    usb 1-1.1.2: USB disconnect, device number 7
    WARNING: CPU: 0 PID: 2865 at fs/sysfs/group.c:216 device_del+0x40/0x1b0()
    sysfs group ffffffff8187fa20 not found for kobject 'hidraw0'
    [...]
    CPU: 0 PID: 2865 Comm: upowerd Tainted: G W 3.14.0-rc4 #7
    Hardware name: LENOVO 7783PN4/ , BIOS 9HKT43AUS 07/11/2011
    0000000000000009 ffffffff814cd684 ffff880427ccfdf8 ffffffff810616e7
    ffff88041ec61800 ffff880427ccfe48 ffff88041e444d80 ffff880426fab8e8
    ffff880429359960 ffffffff8106174c ffffffff81714b98 0000000000000028
    Call Trace:
    [] ? dump_stack+0x41/0x51
    [] ? warn_slowpath_common+0x77/0x90
    [] ? warn_slowpath_fmt+0x4c/0x50
    [] ? device_del+0x40/0x1b0
    [] ? device_unregister+0x2f/0x50
    [] ? device_destroy+0x3a/0x40
    [] ? drop_ref+0x55/0x120 [hid]
    [] ? hidraw_release+0x96/0xb0 [hid]
    [] ? __fput+0xca/0x210
    [] ? task_work_run+0x97/0xd0
    [] ? do_notify_resume+0x69/0xa0
    [] ? int_signal+0x12/0x17
    ---[ end trace 63f4a46f6566d737 ]---

    During device removal hid_disconnect() is called via hid_hw_stop() to
    stop the device and free all its resources, including the sysfs
    files. The problem is that if a user space process, such as upowerd,
    holds a reference to a hidraw file the corresponding sysfs files will
    be kept around (drop_ref() does not call device_destroy() if the open
    counter is not 0) and it will be usb_disconnect() who, by calling
    device_del() for the USB device, will indirectly remove the sysfs
    files of the hidraw device (sysfs_remove_dir() is recursive these
    days). Because of this, by the time user space releases the last
    reference to the hidraw file and drop_ref() tries to destroy the
    device the sysfs files are already gone and the kernel will print
    the warning above.

    Fix this by calling device_destroy() at USB disconnect time.

    Signed-off-by: Fernando Luis Vazquez Cao
    Reviewed-by: David Herrmann
    Cc: stable@vger.kernel.org # 3.13
    Signed-off-by: Jiri Kosina

    Fernando Luis Vázquez Cao
     

25 Feb, 2014

1 commit


17 Feb, 2014

2 commits


06 Jan, 2014

1 commit


02 Oct, 2013

1 commit


04 Sep, 2013

1 commit


27 Aug, 2013

1 commit

  • It is unsafe to call list_for_each_entry in hidraw_report_event to
    traverse each hidraw_list node without a lock protection, the list
    could be modified if someone calls hidraw_release and list_del to
    remove itself from the list, this can cause hidraw_report_event
    to touch a deleted list struct and panic.

    To prevent this, introduce a spinlock in struct hidraw to protect
    list from concurrent access.

    Signed-off-by: Yonghua Zheng
    Signed-off-by: Jiri Kosina

    Yonghua Zheng
     

09 Aug, 2013

1 commit

  • This changes puts the commit 4fe9f8e203f back in place
    with the fixes for slab corruption because of the commit.

    When a device is unplugged, wait for all processes that
    have opened the device to close before deallocating the device.

    This commit was solving kernel crash because of the corruption in
    rb tree of vmalloc. The rootcause was the device data pointer was
    geting excessed after the memory associated with hidraw was freed.

    The commit 4fe9f8e203f was buggy as it was also freeing the hidraw
    first and then calling delete operation on the list associated with
    that hidraw leading to slab corruption.

    Signed-off-by: Manoj Chourasia
    Tested-by: Peter Wu
    Cc: stable@vger.kernel.org
    Signed-off-by: Jiri Kosina

    Manoj Chourasia
     

01 Aug, 2013

1 commit

  • Mutex can not be released unless all hid_device members are properly
    initialized. Otherwise it would result in a race condition that can
    cause NULL pointer kernel panic issue in hidraw_open where it uses
    uninitialized 'list' member in list_add_tail().

    Signed-off-by: Yonghua Zheng
    Signed-off-by: Jiri Kosina

    Yonghua Zheng
     

27 Feb, 2013

1 commit

  • Pull vfs pile (part one) from Al Viro:
    "Assorted stuff - cleaning namei.c up a bit, fixing ->d_name/->d_parent
    locking violations, etc.

    The most visible changes here are death of FS_REVAL_DOT (replaced with
    "has ->d_weak_revalidate()") and a new helper getting from struct file
    to inode. Some bits of preparation to xattr method interface changes.

    Misc patches by various people sent this cycle *and* ocfs2 fixes from
    several cycles ago that should've been upstream right then.

    PS: the next vfs pile will be xattr stuff."

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (46 commits)
    saner proc_get_inode() calling conventions
    proc: avoid extra pde_put() in proc_fill_super()
    fs: change return values from -EACCES to -EPERM
    fs/exec.c: make bprm_mm_init() static
    ocfs2/dlm: use GFP_ATOMIC inside a spin_lock
    ocfs2: fix possible use-after-free with AIO
    ocfs2: Fix oops in ocfs2_fast_symlink_readpage() code path
    get_empty_filp()/alloc_file() leave both ->f_pos and ->f_version zero
    target: writev() on single-element vector is pointless
    export kernel_write(), convert open-coded instances
    fs: encode_fh: return FILEID_INVALID if invalid fid_type
    kill f_vfsmnt
    vfs: kill FS_REVAL_DOT by adding a d_weak_revalidate dentry op
    nfsd: handle vfs_getattr errors in acl protocol
    switch vfs_getattr() to struct path
    default SET_PERSONALITY() in linux/elf.h
    ceph: prepopulate inodes only when request is aborted
    d_hash_and_lookup(): export, switch open-coded instances
    9p: switch v9fs_set_create_acl() to inode+fid, do it before d_instantiate()
    9p: split dropping the acls from v9fs_set_create_acl()
    ...

    Linus Torvalds
     

23 Feb, 2013

1 commit


19 Feb, 2013

1 commit


28 Nov, 2012

1 commit


26 Nov, 2012

1 commit

  • When nonblock read the condition check (file->f_flags & O_NONBLOCK) always be
    true, signal_pending and device exist checking never get a chance to run, so
    the user mode code always get EAGAIN even if device removed. move nonblock mode
    checking to the last can fix this problem.

    Signed-off-by: Founder Fang
    Reviewed-by: Dmitry Torokhov
    Signed-off-by: Jiri Kosina

    Founder Fang
     

01 Nov, 2012

1 commit

  • This basically reverts commit 4fe9f8e203fda. It causes multiple problems,
    namely:

    - after rmmod/modprobe cycle of bus driver, the input is not claimed any
    more. This is likely because of misplaced hid_hw_close()
    - it causes memory corruption on hidraw_list

    As original patch author is not responding to requests to fix his patch,
    and the original deallocation mechanism is not exposing any problems, I
    am reverting back to it.

    Signed-off-by: Jiri Kosina

    Jiri Kosina
     

01 Oct, 2012

1 commit