1. 02 10月, 2017 1 次提交
  2. 02 3月, 2017 1 次提交
  3. 04 4月, 2016 1 次提交
  4. 24 3月, 2016 1 次提交
  5. 14 3月, 2014 1 次提交
    • B
      HID: sony: do not rely on hid_output_raw_report · e534a935
      Benjamin Tissoires 提交于
      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 3a75b249
      (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: NDavid Herrmann <dh.herrmann@gmail.com>
      Signed-off-by: NBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Tested-by: NAntonio Ospite <ao2@ao2.it>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      e534a935
  6. 26 2月, 2014 1 次提交
    • F
      HID: hidraw: fix warning destroying hidraw device files after parent · 47587fc0
      Fernando Luis Vázquez Cao 提交于
      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:
       [<ffffffff814cd684>] ? dump_stack+0x41/0x51
       [<ffffffff810616e7>] ? warn_slowpath_common+0x77/0x90
       [<ffffffff8106174c>] ? warn_slowpath_fmt+0x4c/0x50
       [<ffffffff81374fd0>] ? device_del+0x40/0x1b0
       [<ffffffff8137516f>] ? device_unregister+0x2f/0x50
       [<ffffffff813751fa>] ? device_destroy+0x3a/0x40
       [<ffffffffa03ca245>] ? drop_ref+0x55/0x120 [hid]
       [<ffffffffa03ca3e6>] ? hidraw_release+0x96/0xb0 [hid]
       [<ffffffff811929da>] ? __fput+0xca/0x210
       [<ffffffff8107fe17>] ? task_work_run+0x97/0xd0
       [<ffffffff810139a9>] ? do_notify_resume+0x69/0xa0
       [<ffffffff814dbd22>] ? 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: NFernando Luis Vazquez Cao <fernando@oss.ntt.co.jp>
      Reviewed-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Cc: stable@vger.kernel.org	# 3.13
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      47587fc0
  7. 25 2月, 2014 1 次提交
  8. 17 2月, 2014 2 次提交
  9. 06 1月, 2014 1 次提交
  10. 02 10月, 2013 1 次提交
  11. 27 8月, 2013 1 次提交
  12. 09 8月, 2013 1 次提交
  13. 01 8月, 2013 1 次提交
  14. 23 2月, 2013 1 次提交
  15. 19 2月, 2013 1 次提交
  16. 28 11月, 2012 1 次提交
  17. 26 11月, 2012 1 次提交
  18. 01 11月, 2012 1 次提交
    • J
      HID: hidraw: put old deallocation mechanism in place · df0cfd69
      Jiri Kosina 提交于
      This basically reverts commit 4fe9f8e2. 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: NJiri Kosina <jkosina@suse.cz>
      df0cfd69
  19. 01 10月, 2012 1 次提交
  20. 16 8月, 2012 1 次提交
  21. 20 7月, 2012 1 次提交
  22. 28 4月, 2012 1 次提交
  23. 28 9月, 2011 1 次提交
  24. 20 9月, 2011 1 次提交
    • J
      HID: hidraw: protect hidraw_disconnect() better · 65b01bd5
      James Hogan 提交于
      The function hidraw_disconnect() only acquires the hidraw minors_lock
      when clearing the entry in hidraw_table. However the device_destroy()
      call can cause a userland read/write to return with an error. It may
      cause the program to release the file descripter before the disconnect
      is finished. hidraw_disconnect() has already set hidraw->exist to 0,
      which makes hidraw_release() kfree the hidraw structure, which
      hidraw_disconnect() continues to access and even tries to kfree again.
      Similarly if a hidraw_release() occurs after setting hidraw->exist to 0,
      the same thing can happen.
      
      This is fixed by expanding the mutex critical section to cover the whole
      function from setting hidraw->exist to 0 to freeing the hidraw
      structure, preventing a hidraw_release() from interfering.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Tested-by: NDavid Herrmann <dh.herrmann@googlemail.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      65b01bd5
  25. 07 9月, 2011 1 次提交
  26. 18 5月, 2011 1 次提交
  27. 28 3月, 2011 1 次提交
  28. 11 2月, 2011 1 次提交
  29. 01 2月, 2011 1 次提交
  30. 31 1月, 2011 1 次提交
  31. 04 1月, 2011 1 次提交
  32. 10 12月, 2010 1 次提交
    • J
      HID: Add and use hid_<level>: dev_<level> equivalents · 4291ee30
      Joe Perches 提交于
      Neaten current uses of dev_<level> by adding and using
      hid specific hid_<level> macros.
      
      Convert existing uses of dev_<level> uses to hid_<level>.
      Convert hid-pidff printk uses to hid_<level>.
      
      Remove err_hid and use hid_err instead.
      
      Add missing newlines to logging messages where necessary.
      Coalesce format strings.
      
      Add and use pr_fmt(fmt) KBUILD_MODNAME ": " fmt
      
      Other miscellaneous changes:
      
      Add const struct hid_device * argument to hid-core functions
      extract() and implement() so hid_<level> can be used by them.
      Fix bad indentation in hid-core hid_input_field function
      that calls extract() function above.
      Signed-off-by: NJoe Perches <joe@perches.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      4291ee30
  33. 08 12月, 2010 1 次提交
  34. 18 11月, 2010 1 次提交
  35. 20 10月, 2010 1 次提交
  36. 15 10月, 2010 1 次提交
    • A
      llseek: automatically add .llseek fop · 6038f373
      Arnd Bergmann 提交于
      All file_operations should get a .llseek operation so we can make
      nonseekable_open the default for future file operations without a
      .llseek pointer.
      
      The three cases that we can automatically detect are no_llseek, seq_lseek
      and default_llseek. For cases where we can we can automatically prove that
      the file offset is always ignored, we use noop_llseek, which maintains
      the current behavior of not returning an error from a seek.
      
      New drivers should normally not use noop_llseek but instead use no_llseek
      and call nonseekable_open at open time.  Existing drivers can be converted
      to do the same when the maintainer knows for certain that no user code
      relies on calling seek on the device file.
      
      The generated code is often incorrectly indented and right now contains
      comments that clarify for each added line why a specific variant was
      chosen. In the version that gets submitted upstream, the comments will
      be gone and I will manually fix the indentation, because there does not
      seem to be a way to do that using coccinelle.
      
      Some amount of new code is currently sitting in linux-next that should get
      the same modifications, which I will do at the end of the merge window.
      
      Many thanks to Julia Lawall for helping me learn to write a semantic
      patch that does all this.
      
      ===== begin semantic patch =====
      // This adds an llseek= method to all file operations,
      // as a preparation for making no_llseek the default.
      //
      // The rules are
      // - use no_llseek explicitly if we do nonseekable_open
      // - use seq_lseek for sequential files
      // - use default_llseek if we know we access f_pos
      // - use noop_llseek if we know we don't access f_pos,
      //   but we still want to allow users to call lseek
      //
      @ open1 exists @
      identifier nested_open;
      @@
      nested_open(...)
      {
      <+...
      nonseekable_open(...)
      ...+>
      }
      
      @ open exists@
      identifier open_f;
      identifier i, f;
      identifier open1.nested_open;
      @@
      int open_f(struct inode *i, struct file *f)
      {
      <+...
      (
      nonseekable_open(...)
      |
      nested_open(...)
      )
      ...+>
      }
      
      @ read disable optional_qualifier exists @
      identifier read_f;
      identifier f, p, s, off;
      type ssize_t, size_t, loff_t;
      expression E;
      identifier func;
      @@
      ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
      {
      <+...
      (
         *off = E
      |
         *off += E
      |
         func(..., off, ...)
      |
         E = *off
      )
      ...+>
      }
      
      @ read_no_fpos disable optional_qualifier exists @
      identifier read_f;
      identifier f, p, s, off;
      type ssize_t, size_t, loff_t;
      @@
      ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
      {
      ... when != off
      }
      
      @ write @
      identifier write_f;
      identifier f, p, s, off;
      type ssize_t, size_t, loff_t;
      expression E;
      identifier func;
      @@
      ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
      {
      <+...
      (
        *off = E
      |
        *off += E
      |
        func(..., off, ...)
      |
        E = *off
      )
      ...+>
      }
      
      @ write_no_fpos @
      identifier write_f;
      identifier f, p, s, off;
      type ssize_t, size_t, loff_t;
      @@
      ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
      {
      ... when != off
      }
      
      @ fops0 @
      identifier fops;
      @@
      struct file_operations fops = {
       ...
      };
      
      @ has_llseek depends on fops0 @
      identifier fops0.fops;
      identifier llseek_f;
      @@
      struct file_operations fops = {
      ...
       .llseek = llseek_f,
      ...
      };
      
      @ has_read depends on fops0 @
      identifier fops0.fops;
      identifier read_f;
      @@
      struct file_operations fops = {
      ...
       .read = read_f,
      ...
      };
      
      @ has_write depends on fops0 @
      identifier fops0.fops;
      identifier write_f;
      @@
      struct file_operations fops = {
      ...
       .write = write_f,
      ...
      };
      
      @ has_open depends on fops0 @
      identifier fops0.fops;
      identifier open_f;
      @@
      struct file_operations fops = {
      ...
       .open = open_f,
      ...
      };
      
      // use no_llseek if we call nonseekable_open
      ////////////////////////////////////////////
      @ nonseekable1 depends on !has_llseek && has_open @
      identifier fops0.fops;
      identifier nso ~= "nonseekable_open";
      @@
      struct file_operations fops = {
      ...  .open = nso, ...
      +.llseek = no_llseek, /* nonseekable */
      };
      
      @ nonseekable2 depends on !has_llseek @
      identifier fops0.fops;
      identifier open.open_f;
      @@
      struct file_operations fops = {
      ...  .open = open_f, ...
      +.llseek = no_llseek, /* open uses nonseekable */
      };
      
      // use seq_lseek for sequential files
      /////////////////////////////////////
      @ seq depends on !has_llseek @
      identifier fops0.fops;
      identifier sr ~= "seq_read";
      @@
      struct file_operations fops = {
      ...  .read = sr, ...
      +.llseek = seq_lseek, /* we have seq_read */
      };
      
      // use default_llseek if there is a readdir
      ///////////////////////////////////////////
      @ fops1 depends on !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      identifier readdir_e;
      @@
      // any other fop is used that changes pos
      struct file_operations fops = {
      ... .readdir = readdir_e, ...
      +.llseek = default_llseek, /* readdir is present */
      };
      
      // use default_llseek if at least one of read/write touches f_pos
      /////////////////////////////////////////////////////////////////
      @ fops2 depends on !fops1 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      identifier read.read_f;
      @@
      // read fops use offset
      struct file_operations fops = {
      ... .read = read_f, ...
      +.llseek = default_llseek, /* read accesses f_pos */
      };
      
      @ fops3 depends on !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      identifier write.write_f;
      @@
      // write fops use offset
      struct file_operations fops = {
      ... .write = write_f, ...
      +	.llseek = default_llseek, /* write accesses f_pos */
      };
      
      // Use noop_llseek if neither read nor write accesses f_pos
      ///////////////////////////////////////////////////////////
      
      @ fops4 depends on !fops1 && !fops2 && !fops3 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      identifier read_no_fpos.read_f;
      identifier write_no_fpos.write_f;
      @@
      // write fops use offset
      struct file_operations fops = {
      ...
       .write = write_f,
       .read = read_f,
      ...
      +.llseek = noop_llseek, /* read and write both use no f_pos */
      };
      
      @ depends on has_write && !has_read && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      identifier write_no_fpos.write_f;
      @@
      struct file_operations fops = {
      ... .write = write_f, ...
      +.llseek = noop_llseek, /* write uses no f_pos */
      };
      
      @ depends on has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      identifier read_no_fpos.read_f;
      @@
      struct file_operations fops = {
      ... .read = read_f, ...
      +.llseek = noop_llseek, /* read uses no f_pos */
      };
      
      @ depends on !has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      @@
      struct file_operations fops = {
      ...
      +.llseek = noop_llseek, /* no read or write fn */
      };
      ===== End semantic patch =====
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Cc: Julia Lawall <julia@diku.dk>
      Cc: Christoph Hellwig <hch@infradead.org>
      6038f373
  37. 06 10月, 2010 2 次提交
  38. 25 5月, 2010 1 次提交