27 Sep, 2016

1 commit

  • Current implementation of joydev's input_device_id table recognizes only
    devices with ABS_X, ABS_WHEEL or ABS_THROTTLE axes as joysticks.

    There are joystick devices that do not have those axes, for example TRC
    Rudder device. The device in question has ABS_Z, ABS_RX and ABS_RY axes
    causing it not being detected as joystick.

    This patch adds ABS_Z to the input_device_id list allowing devices with
    ABS_Z axis to be detected correctly.

    Signed-off-by: Ville Ranki
    Signed-off-by: Dmitry Torokhov

    Ville Ranki
     

07 Oct, 2015

1 commit

  • Commit 5702222c9a7a ("Input: joydev - use memdup_user() to duplicate
    memory from user-space") changed the kmalloc() and copy_from_user()
    with a single call to memdup_user() but wrongly used the same error
    path than the old code in which the buffer allocated by kmalloc() was
    freed if copy_from_user() failed.

    This is of course wrong since if memdup_user() fails, no memory was
    allocated and the error in the error-valued pointer should be returned.

    Fixes: 5702222c9a7a ("Input: joydev - use memdup_user() to duplicate
    memory from user-space")
    Reported-by: Dan Carpenter
    Signed-off-by: Javier Martinez Canillas
    Signed-off-by: Dmitry Torokhov

    Javier Martinez Canillas
     

03 Oct, 2015

1 commit

  • The memdup_user() helper function can be used to duplicate a memory region
    from user-space to kernel-space. There is no need to open code the same
    logic using kmalloc() and copy_from_user() instead. This was found with
    make coccicheck that reported the following warning:

    drivers/input/joydev.c:447:10-17: WARNING opportunity for memdup_user
    drivers/input/joydev.c:483:10-17: WARNING opportunity for memdup_user

    Signed-off-by: Javier Martinez Canillas
    Signed-off-by: Dmitry Torokhov

    Javier Martinez Canillas
     

21 Jul, 2015

1 commit


09 Jul, 2015

1 commit


22 May, 2015

1 commit

  • Joydev is currently thinking some absolute mice are joystick, and that
    messes up games in VMware guests, as the cursor typically gets stuck in
    the top left corner.

    Try to detect the event signature of a VMmouse input device and back off
    for such devices. We're still incorrectly detecting, for example, the
    VMware absolute USB mouse as a joystick, but adding an event signature
    matching also that device would be considerably more risky, so defer that
    to a later merge window.

    Signed-off-by: Thomas Hellstrom
    Signed-off-by: Dmitry Torokhov

    Thomas Hellstrom
     

22 Oct, 2012

1 commit

  • Commit 7f8d4cad1e4e ("Input: extend the number of event (and other)
    devices") made evdev, joydev and mousedev to embed struct cdev into
    their respective structures representing input devices.

    Unfortunately character device structure may outlive the parent
    structure unless we do not set it up as parent of character device so
    that it will stay pinned until character device is freed.

    Also, now that parent structure is pinned while character device exists
    we do not need to pin and unpin it every time user opens or closes it.

    Reported-by: Dave Jones
    Signed-off-by: Dmitry Torokhov
    Acked-by: Al Viro
    Signed-off-by: Linus Torvalds

    Dmitry Torokhov
     

09 Oct, 2012

1 commit

  • Extend the amount of character devices, such as eventX, mouseX and jsX,
    from a hard limit of 32 per input handler to about 1024 shared across
    all handlers.

    To be compatible with legacy installations input handlers will start
    creating char devices with minors in their legacy range, however once
    legacy range is exhausted they will start allocating minors from the
    dynamic range 256-1024.

    Reviewed-by: David Herrmann
    Signed-off-by: Dmitry Torokhov

    Dmitry Torokhov
     

22 Aug, 2012

1 commit


29 Mar, 2012

1 commit


12 May, 2011

1 commit


31 Mar, 2011

1 commit


01 Dec, 2010

1 commit


23 Oct, 2010

1 commit

  • * 'llseek' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl:
    vfs: make no_llseek the default
    vfs: don't use BKL in default_llseek
    llseek: automatically add .llseek fop
    libfs: use generic_file_llseek for simple_attr
    mac80211: disallow seeks in minstrel debug code
    lirc: make chardev nonseekable
    viotape: use noop_llseek
    raw: use explicit llseek file operations
    ibmasmfs: use generic_file_llseek
    spufs: use llseek in all file operations
    arm/omap: use generic_file_llseek in iommu_debug
    lkdtm: use generic_file_llseek in debugfs
    net/wireless: use generic_file_llseek in debugfs
    drm: use noop_llseek

    Linus Torvalds
     

15 Oct, 2010

1 commit

  • 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(...)
    {

    }

    @ open exists@
    identifier open_f;
    identifier i, f;
    identifier open1.nested_open;
    @@
    int open_f(struct inode *i, struct file *f)
    {

    }

    @ 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)
    {

    }

    @ 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)
    {

    }

    @ 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: Arnd Bergmann
    Cc: Julia Lawall
    Cc: Christoph Hellwig

    Arnd Bergmann
     

21 Sep, 2010

1 commit


03 Aug, 2010

1 commit

  • Change all call sites in drivers/input to not access the ABS axis
    information directly anymore. Make them use the access helpers instead.

    Also use input_set_abs_params() when possible.
    Did some code refactoring as I was on it.

    Signed-off-by: Daniel Mack
    Cc: Dmitry Torokhov
    Signed-off-by: Dmitry Torokhov

    Daniel Mack
     

16 Jul, 2010

1 commit


21 May, 2010

1 commit


04 May, 2010

1 commit


04 Feb, 2010

2 commits


05 Oct, 2009

1 commit


28 Aug, 2009

1 commit

  • Up to now axis and button map validation was done after the user-supplied
    values were copied over the driver's map. This patch copies the
    user-supplied values into temporary buffers and validated them before
    overwriting the driver's permanent maps.

    Also change JSIOCGBTNMAP and JSIOCGAXMAP to return number of bytes returned
    to userspace instead of 0.

    Signed-off-by: Stephen Kitt
    Signed-off-by: Dmitry Torokhov

    Stephen Kitt
     

12 Aug, 2009

1 commit

  • The KEY_MAX change in 2.6.28 changed the values of the JSIOCSBTNMAP and
    JSIOCGBTNMAP constants; software compiled with the old values no longer
    works with kernels following 2.6.28, because the ioctl switch statement
    no longer matches the values given by the software. This patch handles
    these ioctls independently of the length of data specified, and applies the
    same treatment to JSIOCSAXMAP and JSIOCGAXMAP which currently depend on
    ABS_MAX.

    Signed-off-by: Stephen Kitt
    Signed-off-by: Dmitry Torokhov

    Stephen Kitt
     

14 Jul, 2009

1 commit

  • Commit 3d5cb60e ("Input: simplify name handling for certain input
    handles") introduced a regression for the EVIOCGNAME/JSIOCGNAME
    ioctl.

    Before this, patch, the platform device's name was given back to
    userspace which was good to identify devices. After this patch, the
    device is ("event%d", minor) which is not descriptive at all.

    This fixes the behaviour by taking dev->name.

    Reported-by: Sven Neumann
    Signed-off-by: Daniel Mack
    Reviewed-by: Thadeu Lima de Souza Cascardo
    Signed-off-by: Dmitry Torokhov

    Daniel Mack
     

11 Jun, 2009

1 commit


11 May, 2009

1 commit


08 May, 2009

1 commit

  • BTN_TOUCH is not set by the wacom driver which causes it to be handled by the
    joydev driver while the resulting device is broken. This causes problems with
    applications that try to use a joystick device.

    Ubuntu BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/300143

    Signed-off-by: Tim Cole
    Signed-off-by: Stefan Bader
    Acked-by: Tim Gardner
    Acked-by: Amit Kucheria
    Signed-off-by: Dmitry Torokhov

    Tim Cole
     

16 Mar, 2009

1 commit

  • Most fasync implementations do something like:

    return fasync_helper(...);

    But fasync_helper() will return a positive value at times - a feature used
    in at least one place. Thus, a number of other drivers do:

    err = fasync_helper(...);
    if (err < 0)
    return err;
    return 0;

    In the interests of consistency and more concise code, it makes sense to
    map positive return values onto zero where ->fasync() is called.

    Cc: Al Viro
    Signed-off-by: Jonathan Corbet

    Jonathan Corbet
     

20 Dec, 2008

1 commit


02 Nov, 2008

1 commit

  • As it is, all instances of ->release() for files that have ->fasync()
    need to remember to evict file from fasync lists; forgetting that
    creates a hole and we actually have a bunch that *does* forget.

    So let's keep our lives simple - let __fput() check FASYNC in
    file->f_flags and call ->fasync() there if it's been set. And lose that
    crap in ->release() instances - leaving it there is still valid, but we
    don't have to bother anymore.

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

    Al Viro
     

30 Oct, 2008

1 commit


01 Apr, 2008

1 commit


20 Oct, 2007

1 commit

  • get rid of input BIT* duplicate defines

    use newly global defined macros for input layer. Also remove includes of
    input.h from non-input sources only for BIT macro definiton. Define the
    macro temporarily in local manner, all those local definitons will be
    removed further in this patchset (to not break bisecting).
    BIT macro will be globally defined (1<
    Cc:
    Acked-by: Jiri Kosina
    Cc:
    Acked-by: Marcel Holtmann
    Cc:
    Acked-by: Mauro Carvalho Chehab
    Cc:
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiri Slaby
     

14 Oct, 2007

1 commit

  • RT guys alerted me to the fact that in their tree spinlocks
    are preemptible and it is better to use full RCU API
    (rcu_read_lock()/rcu_read_unlock()) to be safe.

    Signed-off-by: Dmitry Torokhov

    Dmitry Torokhov
     

13 Oct, 2007

1 commit


30 Aug, 2007

1 commit


10 Jul, 2007

1 commit


05 Jun, 2007

1 commit