137 Commits

Author SHA1 Message Date
lucaswei
ec98b24735 Merge android-4.9-q (4.9.228) into android-msm-pixel-4.9-lts
Merge 4.9.228 into android-4.9-q
Linux 4.9.228
    perf symbols: Fix debuginfo search for Ubuntu
    perf probe: Do not show the skipped events
    w1: omap-hdq: cleanup to add missing newline for some dev_dbg
    mtd: rawnand: pasemi: Fix the probe error path
    mtd: rawnand: brcmnand: fix hamming oob layout
  * sunrpc: clean up properly in gss_mech_unregister()
      include/linux/sunrpc/gss_api.h
    sunrpc: svcauth_gss_register_pseudoflavor must reject duplicate registrations.
  * kbuild: force to build vmlinux if CONFIG_MODVERSION=y
      Makefile
    drivers/macintosh: Fix memleak in windfarm_pm112 driver
    ARM: tegra: Correct PL310 Auxiliary Control Register initialization
  * kernel/cpu_pm: Fix uninitted local in cpu_pm
      kernel/cpu_pm.c
    sparc64: fix misuses of access_process_vm() in genregs32_[sg]et()
    sparc32: fix register window handling in genregs32_[gs]et()
    pinctrl: samsung: Save/restore eint_mask over suspend for EINT_TYPE GPIOs
    power: vexpress: add suppress_bind_attrs to true
    igb: Report speed and duplex as unknown when device is runtime suspended
    b43_legacy: Fix connection problem with WPA3
    b43: Fix connection problem with WPA3
    b43legacy: Fix case where channel status is corrupted
    media: go7007: fix a miss of snd_card_free
    carl9170: remove P2P_GO support
    e1000e: Relax condition to trigger reset for ME workaround
  * PCI: Program MPS for RCiEP devices
      drivers/pci/probe.c
  * blk-mq: move blk_mq_update_nr_hw_queues synchronize_rcu call
      block/blk-mq.c
    btrfs: fix error handling when submitting direct I/O bio
  * ext4: fix race between ext4_sync_parent() and rename()
      fs/ext4/fsync.c
  * ext4: fix EXT_MAX_EXTENT/INDEX to check for zeroed eh_max
      fs/ext4/ext4_extents.h
    evm: Fix possible memory leak in evm_calc_hmac_or_hash()
    ima: Directly assign the ima_default_policy pointer to ima_rules
    ima: Fix ima digest hash table key calculation
    mm: thp: make the THP mapcount atomic against __split_huge_pmd_locked()
    btrfs: send: emit file capabilities after chown
  * cpuidle: Fix three reference count leaks
      drivers/cpuidle/sysfs.c
    spi: dw: Return any value retrieved from the dma_transfer callback
    mmc: sdhci-esdhc-imx: fix the mask for tuning start point
    ixgbe: fix signed-integer-overflow warning
    staging: greybus: sdio: Respect the cmd->busy_timeout from the mmc core
    MIPS: Fix IRQ tracing when call handle_fpe() and handle_msa_fpe()
  * PCI: Don't disable decoding when mmio_always_on is set
      drivers/pci/probe.c
    macvlan: Skip loopback packets in RX handler
    m68k: mac: Don't call via_flush_cache() on Mac IIfx
    x86/mm: Stop printing BRK addresses
    mips: Add udelay lpj numbers adjustment
    x86/boot: Correct relocation destination on old linkers
    mwifiex: Fix memory corruption in dump_station
    rtlwifi: Fix a double free in _rtl_usb_tx_urb_setup()
    md: don't flush workqueue unconditionally in md_open
  * kgdb: Fix spurious true from in_dbg_master()
      include/linux/kgdb.h
    mips: cm: Fix an invalid error code of INTVN_*_ERR
    MIPS: Truncate link address into 32bit for 32bit kernel
    powerpc/spufs: fix copy_to_user while atomic
    net: allwinner: Fix use correct return type for ndo_start_xmit()
    net: lpc-enet: fix error return code in lpc_mii_init()
  * exit: Move preemption fixup up, move blocking operations down
      kernel/exit.c
  * lib/mpi: Fix 64-bit MIPS build with Clang
      lib/mpi/longlong.h
    netfilter: nft_nat: return EOPNOTSUPP if type or flags are not supported
    MIPS: Make sparse_init() using top-down allocation
    media: platform: fcp: Set appropriate DMA parameters
    media: dvb: return -EREMOTEIO on i2c transfer failure.
    dt-bindings: display: mediatek: control dpi pins mode to avoid leakage
    e1000: Distribute switch variables for initialization
  * staging: android: ion: use vmap instead of vm_map_ram
      drivers/staging/android/ion/ion_heap.c
    net: vmxnet3: fix possible buffer overflow caused by bad DMA value in vmxnet3_get_rss()
  * x86/kvm/hyper-v: Explicitly align hcall param for kvm_hyperv_exit
      include/uapi/linux/kvm.h
    ARM: 8978/1: mm: make act_mm() respect THREAD_SIZE
    btrfs: do not ignore error from btrfs_next_leaf() when inserting checksums
    clocksource: dw_apb_timer_of: Fix missing clockevent timers
    spi: dw: Enable interrupts in accordance with DMA xfer mode
  * kgdb: Prevent infinite recursive entries to the debugger
      kernel/debug/debug_core.c
  * Bluetooth: Add SCO fallback for invalid LMP parameters error
      net/bluetooth/hci_event.c
    spi: dw: Zero DMA Tx and Rx configurations on stack
    net: ena: fix error returning in ena_com_get_hash_function()
    objtool: Ignore empty alternatives
    media: si2157: Better check for running tuner in init
    ACPI: GED: use correct trigger type field in _Exx / _Lxx handling
  * media: dvb_frontend: ensure that inital front end status initialized
      drivers/media/dvb-core/dvb_frontend.c
      include/uapi/linux/dvb/frontend.h
    can: kvaser_usb: kvaser_usb_leaf: Fix some info-leaks to USB devices
    agp/intel: Reinforce the barrier after GTT updates
  * perf: Add cond_resched() to task_function_call()
      kernel/events/core.c
  * fat: don't allow to mount if the FAT length == 0
      fs/fat/inode.c
  * mm/slub: fix a memory leak in sysfs_slab_add()
      mm/slub.c
  * Smack: slab-out-of-bounds in vsscanf
      security/smack/smackfs.c
    ath9k: Fix general protection fault in ath9k_hif_usb_rx_cb
    ath9x: Fix stack-out-of-bounds Write in ath9k_hif_usb_rx_cb
    ath9k: Fix use-after-free Write in ath9k_htc_rx_msg
    ath9k: Fix use-after-free Read in ath9k_wmi_ctrl_rx
  * KVM: arm64: Make vcpu_cp1x() work on Big Endian hosts
      arch/arm64/include/asm/kvm_host.h
    KVM: MIPS: Fix VPN2_MASK definition for variable cpu_vmbits
    KVM: MIPS: Define KVM_ENTRYHI_ASID to cpu_asid_mask(&boot_cpu_data)
    KVM: nVMX: Consult only the "basic" exit reason when routing nested exit
    KVM: nSVM: leave ASID aside in copy_vmcb_control_area
    video: fbdev: w100fb: Fix a potential double free.
  * proc: Use new_inode not new_inode_pseudo
      fs/proc/inode.c
      fs/proc/self.c
      fs/proc/thread_self.c
  * ovl: initialize error in ovl_copy_xattr
      fs/overlayfs/copy_up.c
    spi: bcm2835: Fix controller unregister order
    spi: pxa2xx: Fix controller unregister order
  * spi: Fix controller unregister order
      drivers/spi/spi.c
  * spi: No need to assign dummy value in spi_unregister_controller()
      drivers/spi/spi.c
    spi: dw: Fix controller unregister order
    spi: dw: fix possible race condition
    x86/speculation: PR_SPEC_FORCE_DISABLE enforcement for indirect branches.
    x86/speculation: Avoid force-disabling IBPB based on STIBP and enhanced IBRS.
    x86/speculation: Add support for STIBP always-on preferred mode
    x86/speculation: Change misspelled STIPB to STIBP
  * ALSA: pcm: disallow linking stream to itself
      sound/core/pcm_native.c
    spi: bcm-qspi: when tx/rx buffer is NULL set to 0
    spi: bcm2835aux: Fix controller unregister order
    nilfs2: fix null pointer dereference at nilfs_segctor_do_construct()
  * cgroup, blkcg: Prepare some symbols for module and !CONFIG_CGROUP usages
      fs/fs-writeback.c
    ACPI: PM: Avoid using power resources if there are none for D0
    ACPI: GED: add support for _Exx / _Lxx handler methods
    ACPI: CPPC: Fix reference count leak in acpi_cppc_processor_probe()
    ACPI: sysfs: Fix reference count leak in acpi_sysfs_add_hotplug_profile()
  * ALSA: usb-audio: Fix inconsistent card PM state after resume
      sound/usb/card.c
      sound/usb/usbaudio.h
    ALSA: es1688: Add the missed snd_card_free()
    efi/efivars: Add missing kobject_put() in sysfs entry creation error path
    x86/reboot/quirks: Add MacBook6,1 reboot quirk
    x86/speculation: Prevent rogue cross-process SSBD shutdown
    x86/PCI: Mark Intel C620 MROMs as having non-compliant BARs
    x86_64: Fix jiffies ODR violation
    ath9k_htc: Silence undersized packet warnings
    drivers/net/ibmvnic: Update VNIC protocol version reporting
  * sched/fair: Don't NUMA balance for kthreads
      kernel/sched/fair.c
    ARM: 8977/1: ptrace: Fix mask for thumb breakpoint hook
    crypto: talitos - fix ECB and CBC algs ivsize
  * scsi: return correct blkprep status code in case scsi_init_io() fails.
      drivers/scsi/scsi_lib.c
    vxlan: Avoid infinite loop when suppressing NS messages with invalid options
  * ipv6: fix IPV6_ADDRFORM operation logic
      net/ipv6/ipv6_sockglue.c
    Merge 4.9.227 into android-4.9-q
Linux 4.9.227
    uprobes: ensure that uprobe->offset and ->ref_ctr_offset are properly aligned
    iio: vcnl4000: Fix i2c swapped word reading.
    x86/speculation: Add Ivy Bridge to affected list
    x86/speculation: Add SRBDS vulnerability and mitigation documentation
  * x86/speculation: Add Special Register Buffer Data Sampling (SRBDS) mitigation
      drivers/base/cpu.c
    x86/cpu: Add 'table' argument to cpu_matches()
  * x86/cpu: Add a steppings field to struct x86_cpu_id
      include/linux/mod_devicetable.h
  * nvmem: qfprom: remove incorrect write support
      drivers/nvmem/qfprom.c
    staging: rtl8712: Fix IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK
    tty: hvc_console, fix crashes on parallel open/close
  * vt: keyboard: avoid signed integer overflow in k_ascii
      drivers/tty/vt/keyboard.c
    usb: musb: Fix runtime PM imbalance on error
    USB: serial: option: add Telit LE910C1-EUX compositions
    USB: serial: usb_wwan: do not resubmit rx urb on fatal errors
    USB: serial: qcserial: add DW5816e QDL support
  * l2tp: add sk_family checks to l2tp_validate_socket
      net/l2tp/l2tp_core.c
    vsock: fix timeout in vsock_accept()
    NFC: st21nfca: add missed kfree_skb() in an error path
    net: usb: qmi_wwan: add Telit LE910C1-EUX composition
  * l2tp: do not use inet_hash()/inet_unhash()
      net/l2tp/l2tp_ip.c
      net/l2tp/l2tp_ip6.c
  * devinet: fix memleak in inetdev_init()
      net/ipv4/devinet.c
    airo: Fix read overflows sending packets
  * scsi: ufs: Release clock if DMA map fails
      drivers/scsi/ufs/ufshcd.c
    slip: not call free_netdev before rtnl_unlock in slip_open
    slcan: Fix double-free on slcan_open() error path
  * mmc: fix compilation of user API
      include/uapi/linux/mmc/ioctl.h
    kernel/relay.c: handle alloc_percpu returning NULL in relay_open
    p54usb: add AirVasT USB stick device-id
    HID: i2c-hid: add Schneider SCL142ALM to descriptor override
  * mm: Fix mremap not considering huge pmd devmap
      mm/mremap.c
  * pppoe: only process PADT targeted at local interfaces
      drivers/net/ppp/pppoe.c
    net: smsc911x: Fix runtime PM imbalance on error
    net: ethernet: stmmac: Enable interface clocks on probe for IPQ806x
    net/ethernet/freescale: rework quiesce/activate for ucc_geth
    net: bmac: Fix read of MAC address from ROM
    x86/mmiotrace: Use cpumask_available() for cpumask_var_t variables
    ARC: Fix ICCM & DCCM runtime size checks
    s390/ftrace: save traced function caller
    spi: dw: use "smp_mb()" to avoid sending spi data error
  * esp6: fix memleak on error path in esp6_input
      net/ipv6/esp6.c
    usb: gadget: f_uac2: fix error handling in afunc_bind (again)
  * scsi: scsi_devinfo: fixup string compare
      drivers/scsi/scsi_devinfo.c
    Merge 4.9.226 into android-4.9-q
Linux 4.9.226
    scsi: zfcp: fix request object use-after-free in send path causing wrong traces
    net: hns: Fixes the missing put_device in positive leg for roce reset
    sc16is7xx: move label 'err_spi' to correct section
  * mm/vmalloc.c: don't dereference possible NULL pointer in __vunmap()
      mm/vmalloc.c
  * net: rtnl_configure_link: fix dev flags changes arg to __dev_notify_flags
      net/core/rtnetlink.c
    genirq/generic_pending: Do not lose pending affinity update
  * netfilter: nf_conntrack_pptp: fix compilation warning with W=1 build
      include/linux/netfilter/nf_conntrack_pptp.h
      net/netfilter/nf_conntrack_pptp.c
  * bonding: Fix reference count leak in bond_sysfs_slave_add.
      drivers/net/bonding/bond_sysfs_slave.c
    qlcnic: fix missing release in qlcnic_83xx_interrupt_test.
  * netfilter: nf_conntrack_pptp: prevent buffer overflows in debug code
      include/linux/netfilter/nf_conntrack_pptp.h
      net/ipv4/netfilter/nf_nat_pptp.c
      net/netfilter/nf_conntrack_pptp.c
    netfilter: ipset: Fix subcounter update skip
    netfilter: nft_reject_bridge: enable reject with bridge vlan
  * ip_vti: receive ipip packet by calling ip_tunnel_rcv
      net/ipv4/ip_vti.c
  * vti4: eliminated some duplicate code.
      net/ipv4/ip_vti.c
  * xfrm: fix a NULL-ptr deref in xfrm_local_error
      net/xfrm/xfrm_output.c
  * xfrm: fix a warning in xfrm_policy_insert_list
      net/xfrm/xfrm_policy.c
  * xfrm: allow to accept packets with ipv6 NEXTHDR_HOP in xfrm_input
      net/xfrm/xfrm_input.c
    x86/dma: Fix max PFN arithmetic overflow on 32 bit systems
    mac80211: mesh: fix discovery timer re-arming issue / crash
    parisc: Fix kernel panic in mem_init()
  * iommu: Fix reference count leak in iommu_group_alloc.
      drivers/iommu/iommu.c
  * include/asm-generic/topology.h: guard cpumask_of_node() macro argument
      include/asm-generic/topology.h
  * fs/binfmt_elf.c: allocate initialized memory in fill_thread_core_info()
      fs/binfmt_elf.c
  * mm: remove VM_BUG_ON(PageSlab()) from page_mapcount()
      include/linux/mm.h
    libceph: ignore pool overlay and cache logic on redirects
  * exec: Always set cap_ambient in cap_bprm_set_creds
      security/commoncap.c
  * ALSA: usb-audio: mixer: volume quirk for ESS Technology Asus USB DAC
      sound/usb/mixer.c
  * ALSA: hwdep: fix a left shifting 1 by 31 UB bug
      sound/core/hwdep.c
    ARM: dts/imx6q-bx50v3: Set display interface clock parents
    ARM: dts: imx6q-bx50v3: Add internal switch
    ARM: dts: imx: Correct B850v3 clock assignment
    IB/qib: Call kobject_put() when kobject_init_and_add() fails
    Input: synaptics-rmi4 - fix error return code in rmi_driver_probe()
    Input: i8042 - add ThinkPad S230u to i8042 reset list
  * Input: xpad - add custom init packet for Xbox One S controllers
      drivers/input/joystick/xpad.c
  * Input: evdev - call input_flush_device() on release(), not flush()
      drivers/input/evdev.c
    Input: usbtouchscreen - add support for BonXeon TP
    cifs: Fix null pointer check in cifs_read
    usb: gadget: legacy: fix redundant initialization warnings
    cachefiles: Fix race between read_waiter and read_copier involving op->to_do
    gfs2: move privileged user check to gfs2_quota_lock_check
    net: microchip: encx24j600: add missed kthread_stop
    gpio: tegra: mask GPIO IRQs during IRQ shutdown
    IB/cma: Fix reference count leak when no ipv4 addresses are set
  * uapi: fix linux/if_pppol2tp.h userspace compilation errors
      include/uapi/linux/l2tp.h
    net/mlx4_core: fix a memory leak bug.
    net: sun: fix missing release regions in cas_init_one().
    net/mlx5: Add command entry handling completion
    net: qrtr: Fix passing invalid reference to qrtr_local_enqueue()
    net/mlx5e: Update netdev txq on completions during closure
    sctp: Start shutdown on association restart if in SHUTDOWN-SENT state and socket is closed
  * net sched: fix reporting the first-time use timestamp
      include/net/act_api.h
  * net: revert "net: get rid of an signed integer overflow in ip_idents_reserve()"
      net/ipv4/route.c
    net: ipip: fix wrong address family in init error path
    ax25: fix setsockopt(SO_BINDTODEVICE)
    ANDROID: cuttlefish defconfig - enable mount/net/uts namespaces.
    Merge 4.9.225 into android-4.9-q
Linux 4.9.225
    iio: sca3000: Remove an erroneous 'get_device()'
    rapidio: fix an error in get_user_pages_fast() error handling
    mei: release me_cl object reference
    iio: dac: vf610: Fix an error handling path in 'vf610_dac_probe()'
    staging: greybus: Fix uninitialized scalar variable
    staging: iio: ad2s1210: Fix SPI reading
    Revert "gfs2: Don't demote a glock until its revokes are written"
    cxgb4/cxgb4vf: Fix mac_hlist initialization and free
    cxgb4: free mac_hlist properly
    libnvdimm/btt: Remove unnecessary code in btt_freelist_init
    platform/x86: alienware-wmi: fix kfree on potentially uninitialized pointer
  * ubsan: build ubsan.c more conservatively
      lib/Makefile
  * x86/uaccess, ubsan: Fix UBSAN vs. SMAP
      lib/Makefile
  * l2tp: device MTU setup, tunnel socket needs a lock
      include/linux/net.h
      net/l2tp/l2tp_eth.c
      net/socket.c
    dmaengine: tegra210-adma: Fix an error handling path in 'tegra_adma_probe()'
  * ALSA: pcm: fix incorrect hw_base increase
      sound/core/pcm_lib.c
  * l2tp: initialise PPP sessions before registering them
      net/l2tp/l2tp_ppp.c
  * l2tp: protect sock pointer of struct pppol2tp_session with RCU
      net/l2tp/l2tp_ppp.c
  * l2tp: initialise l2tp_eth sessions before registering them
      net/l2tp/l2tp_eth.c
  * l2tp: don't register sessions in l2tp_session_create()
      net/l2tp/l2tp_core.c
      net/l2tp/l2tp_core.h
      net/l2tp/l2tp_eth.c
      net/l2tp/l2tp_ppp.c
  * l2tp: fix l2tp_eth module loading
      net/l2tp/l2tp_eth.c
  * l2tp: pass tunnel pointer to ->session_create()
      net/l2tp/l2tp_core.h
      net/l2tp/l2tp_eth.c
      net/l2tp/l2tp_netlink.c
      net/l2tp/l2tp_ppp.c
  * l2tp: prevent creation of sessions on terminated tunnels
      net/l2tp/l2tp_core.c
      net/l2tp/l2tp_core.h
  * l2tp: hold tunnel used while creating sessions with netlink
      net/l2tp/l2tp_netlink.c
  * l2tp: hold tunnel while handling genl TUNNEL_GET commands
      net/l2tp/l2tp_netlink.c
  * l2tp: hold tunnel while handling genl tunnel updates
      net/l2tp/l2tp_netlink.c
  * l2tp: hold tunnel while processing genl delete command
      net/l2tp/l2tp_netlink.c
  * l2tp: hold tunnel while looking up sessions in l2tp_netlink
      net/l2tp/l2tp_core.c
      net/l2tp/l2tp_core.h
      net/l2tp/l2tp_netlink.c
  * l2tp: initialise session's refcount before making it reachable
      net/l2tp/l2tp_core.c
  * l2tp: define parameters of l2tp_tunnel_find*() as "const"
      net/l2tp/l2tp_core.c
      net/l2tp/l2tp_core.h
  * l2tp: define parameters of l2tp_session_get*() as "const"
      net/l2tp/l2tp_core.c
      net/l2tp/l2tp_core.h
  * l2tp: remove l2tp_session_find()
      net/l2tp/l2tp_core.c
      net/l2tp/l2tp_core.h
  * l2tp: remove useless duplicate session detection in l2tp_netlink
      net/l2tp/l2tp_netlink.c
  * L2TP:Adjust intf MTU, add underlay L3, L2 hdrs.
      net/l2tp/l2tp_eth.c
  * New kernel function to get IP overhead on a socket.
      include/linux/net.h
      net/socket.c
  * net: l2tp: ppp: change PPPOL2TP_MSG_* => L2TP_MSG_*
      net/l2tp/l2tp_ppp.c
  * net: l2tp: deprecate PPPOL2TP_MSG_* in favour of L2TP_MSG_*
      include/uapi/linux/if_pppol2tp.h
  * net: l2tp: export debug flags to UAPI
      include/uapi/linux/l2tp.h
      net/l2tp/l2tp_core.h
  * watchdog: Fix the race between the release of watchdog_core_data and cdev
      drivers/watchdog/watchdog_dev.c
    arm64: fix the flush_icache_range arguments in machine_kexec
    padata: purge get_cpu and reorder_via_wq from padata_do_serial
    padata: initialize pd->cpu with effective cpumask
    padata: Replace delayed timer with immediate workqueue in padata_reorder
    padata: set cpu_index of unused CPUs to -1
  * i2c: dev: Fix the race between the release of i2c_dev and cdev
      drivers/i2c/i2c-dev.c
    ARM: futex: Address build warning
    platform/x86: asus-nb-wmi: Do not load on Asus T100TA and T200TA
  * USB: core: Fix misleading driver bug report
      drivers/usb/core/message.c
    ceph: fix double unlock in handle_cap_export()
    gtp: set NLM_F_MULTI flag in gtp_genl_dump_pdp()
  * component: Silence bind error on -EPROBE_DEFER
      drivers/base/component.c
  * configfs: fix config_item refcnt leak in configfs_rmdir()
      fs/configfs/dir.c
  * HID: multitouch: add eGalaxTouch P80H84 support
      drivers/hid/hid-ids.h
      drivers/hid/hid-multitouch.c
  * gcc-common.h: Update for GCC 10
      scripts/gcc-plugins/Makefile
    i2c: mux: demux-pinctrl: Fix an error handling path in 'i2c_demux_pinctrl_probe()'
    iommu/amd: Fix over-read of ACPI UID from IVRS table
  * fix multiplication overflow in copy_fdtable()
      fs/file.c
    ima: Fix return value of ima_write_policy()
    evm: Check also if *tfm is an error pointer in init_desc()
    padata: ensure padata_do_serial() runs on the correct CPU
    padata: ensure the reorder timer callback runs on the correct CPU
    padata: get_next is never NULL
    padata: Remove unused but set variables
    igb: use igb_adapter->io_addr instead of e1000_hw->hw_addr
    Merge 4.9.224 into android-4.9-q
Linux 4.9.224
  * Makefile: disallow data races on gcc-10 as well
      Makefile
    KVM: x86: Fix off-by-one error in kvm_vcpu_ioctl_x86_setup_mce
    ARM: dts: r8a7740: Add missing extal2 to CPG node
    ARM: dts: r8a73a4: Add missing CMT1 interrupts
    Revert "ALSA: hda/realtek: Fix pop noise on ALC225"
    usb: gadget: legacy: fix error return code in cdc_bind()
    usb: gadget: legacy: fix error return code in gncm_bind()
    usb: gadget: audio: Fix a missing error return value in audio_bind()
    usb: gadget: net2272: Fix a memory leak in an error handling path in 'net2272_plat_probe()'
  * exec: Move would_dump into flush_old_exec
      fs/exec.c
  * x86: Fix early boot crash on gcc-10, third try
      include/linux/compiler.h
      init/main.c
    ARM: dts: imx27-phytec-phycard-s-rdk: Fix the I2C1 pinctrl entries
  * usb: xhci: Fix NULL pointer dereference when enqueuing trbs from urb sg list
      drivers/usb/host/xhci-ring.c
  * USB: gadget: fix illegal array access in binding with UDC
      drivers/usb/gadget/configfs.c
  * ALSA: usb-audio: Add control message quirk delay for Kingston HyperX headset
      sound/usb/quirks.c
  * ALSA: rawmidi: Fix racy buffer resize under concurrent accesses
      include/sound/rawmidi.h
      sound/core/rawmidi.c
  * ALSA: rawmidi: Initialize allocated buffers
      sound/core/rawmidi.c
    ALSA: hda/realtek - Limit int mic boost for Thinkpad T530
    netprio_cgroup: Fix unlimited memory leak of v2 cgroups
  * net: ipv4: really enforce backoff for redirects
      net/ipv4/route.c
  * Revert "ipv6: add mtu lock check in __ip6_rt_update_pmtu"
      net/ipv6/route.c
  * netlabel: cope with NULL catmap
      net/ipv4/cipso_ipv4.c
      net/ipv6/calipso.c
      net/netlabel/netlabel_kapi.c
  * net: fix a potential recursive NETDEV_FEAT_CHANGE
      net/core/dev.c
  * gcc-10: disable 'restrict' warning for now
      Makefile
  * gcc-10: disable 'stringop-overflow' warning for now
      Makefile
  * gcc-10: disable 'array-bounds' warning for now
      Makefile
  * gcc-10: disable 'zero-length-bounds' warning for now
      Makefile
  * gcc-10: avoid shadowing standard library 'free()' in crypto
      crypto/xts.c
    net: phy: micrel: Use strlcpy() for ethtool::get_strings
  * Stop the ad-hoc games with -Wno-maybe-initialized
      Makefile
      init/Kconfig
      kernel/trace/Kconfig
  * kbuild: compute false-positive -Wmaybe-uninitialized cases in Kconfig
      Makefile
      init/Kconfig
      kernel/trace/Kconfig
  * gcc-10 warnings: fix low-hanging fruit
      include/linux/fs.h
      include/linux/tty.h
    pnp: Use list_for_each_entry() instead of open coding
    IB/mlx4: Test return value of calls to ib_get_cached_pkey
  * netfilter: conntrack: avoid gcc-10 zero-length-bounds warning
      include/net/netfilter/nf_conntrack.h
      net/netfilter/nf_conntrack_core.c
    i40iw: Fix error handling in i40iw_manage_arp_cache()
    pinctrl: cherryview: Add missing spinlock usage in chv_gpio_irq_handler
    ipc/util.c: sysvipc_find_ipc() incorrectly updates position index
    drm/qxl: lost qxl_bo_kunmap_atomic_page in qxl_image_init_helper()
    ALSA: hda/hdmi: fix race in monitor detection during probe
    dmaengine: mmp_tdma: Reset channel error on release
    dmaengine: pch_dma.c: Avoid data race between probe and irq handler
    cifs: Fix a race condition with cifs_echo_request
    cifs: Check for timeout on Negotiate stage
    spi: spi-dw: Add lock protect dw_spi rx/tx to prevent concurrent calls
  * scsi: sg: add sg_remove_request in sg_write
      drivers/scsi/sg.c
    drop_monitor: work around gcc-10 stringop-overflow warning
    net: moxa: Fix a potential double 'free_irq()'
    net/sonic: Fix a resource leak in an error handling path in 'jazz_sonic_probe()'
  * shmem: fix possible deadlocks on shmlock_user_lock
      mm/shmem.c
    ptp: free ptp device pin descriptors properly
  * ptp: fix the race between the release of ptp_clock and cdev
      include/linux/posix-clock.h
      kernel/time/posix-clock.c
    ptp: Fix pass zero to ERR_PTR() in ptp_clock_register
  * chardev: add helper function to register char devs with a struct device
      fs/char_dev.c
      include/linux/cdev.h
    ptp: create "pins" together with the rest of attributes
    ptp: use is_visible method to hide unused attributes
    ptp: do not explicitly set drvdata in ptp_clock_register()
  * blktrace: fix dereference after null check
      kernel/trace/blktrace.c
  * blktrace: Protect q->blk_trace with RCU
      include/linux/blkdev.h
      include/linux/blktrace_api.h
      kernel/trace/blktrace.c
  * blktrace: fix trace mutex deadlock
      kernel/trace/blktrace.c
  * blktrace: fix unlocked access to init/start-stop/teardown
      kernel/trace/blktrace.c
  * blktrace: Fix potential deadlock between delete & sysfs ops
      block/blk-core.c
      include/linux/blkdev.h
      kernel/trace/blktrace.c
  * net: ipv6_stub: use ip6_dst_lookup_flow instead of ip6_dst_lookup
      include/net/addrconf.h
      net/ipv6/addrconf_core.c
      net/ipv6/af_inet6.c
  * net: ipv6: add net argument to ip6_dst_lookup_flow
      include/net/ipv6.h
      net/ipv6/af_inet6.c
      net/ipv6/datagram.c
      net/ipv6/inet6_connection_sock.c
      net/ipv6/ip6_output.c
      net/ipv6/raw.c
      net/ipv6/tcp_ipv6.c
      net/l2tp/l2tp_ip6.c
  * ext4: add cond_resched() to ext4_protect_reserved_inode
      fs/ext4/block_validity.c
  * binfmt_elf: Do not move brk for INTERP-less ET_EXEC
      fs/binfmt_elf.c
    scripts/decodecode: fix trapping instruction formatting
    objtool: Fix stack offset tracking for indirect CFAs
    batman-adv: Fix refcnt leak in batadv_v_ogm_process
    batman-adv: Fix refcnt leak in batadv_store_throughput_override
    batman-adv: Fix refcnt leak in batadv_show_throughput_override
    batman-adv: fix batadv_nc_random_weight_tq
  * mm/page_alloc: fix watchdog soft lockups during set_zone_contiguous()
      mm/page_alloc.c
  * tracing: Add a vmalloc_sync_mappings() for safe measure
      kernel/trace/trace.c
    USB: serial: garmin_gps: add sanity checking for data length
    USB: uas: add quirk for LaCie 2Big Quadra
  * binfmt_elf: move brk out of mmap when doing direct loader exec
      fs/binfmt_elf.c
    Revert "ACPI / video: Add force_native quirk for HP Pavilion dv6"
    bnxt_en: Improve AER slot reset.
    net/mlx5: Fix command entry leak in Internal Error State
    net/mlx5: Fix forced completion access non initialized command entry
    bnxt_en: Fix VLAN acceleration handling in bnxt_fix_features().
    sch_sfq: validate silly quantum values
    sch_choke: avoid potential panic in choke_reset()
    net: usb: qmi_wwan: add support for DW5816e
    net/mlx4_core: Fix use of ENOSPC around mlx4_counter_alloc()
    net: macsec: preserve ingress frame ordering
  * fq_codel: fix TCA_FQ_CODEL_DROP_BATCH_SIZE sanity checks
      net/sched/sch_fq_codel.c
    dp83640: reverse arguments to list_add_tail
    USB: serial: qcserial: Add DW5816e support
  * ANDROID: hid: steam: remove BT controller matching
      drivers/hid/hid-core.c
      drivers/hid/hid-ids.h
  * UPSTREAM: HID: steam: Fix input device disappearing
      drivers/hid/hid-steam.c

Change-Id: I03104a17738ef3d28a296ca370185f58396c9262
Signed-off-by: lucaswei <lucaswei@google.com>
2020-07-10 11:45:18 +08:00
Brendan Shanks
ac28649d60 Input: evdev - call input_flush_device() on release(), not flush()
[ Upstream commit 09264098ff153f60866039d60b31d39b66f55a31 ]

input_flush_device() should only be called once the struct file is being
released and no open descriptors remain, but evdev_flush() was calling
it whenever a file descriptor was closed.

This caused uploaded force-feedback effects to be erased when a process
did a dup()/close() on the event FD, called system(), etc.

Call input_flush_device() from evdev_release() instead.

Reported-by: Mathieu Maret <mathieu.maret@gmail.com>
Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Link: https://lore.kernel.org/r/20200421231003.7935-1-bshanks@codeweavers.com
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-06-03 08:16:38 +02:00
Atif Niyaz
eab62fa280 UPSTREAM: input: allow drivers specify timestamp for input events
Currently, evdev stamps events with timestamps acquired in
evdev_events() However, this timestamping may not be accurate in terms
of measuring when the actual event happened.

Let's allow individual drivers specify timestamp in order to provide a
more accurate sense of time for the event. It is expected that drivers
will set the timestamp in their hard interrupt routine.
(cherry picked from commit 3b51c44bd6936e86a7180abd9aebc4387a479253)
Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/input?id=3b51c44bd6936e86a7180abd9aebc4387a479253

Signed-off-by: Atif Niyaz <atifniyaz@google.com>
Bug: 119840121
Change-Id: I91a5144879f8da498b7eb160da9719cf403a9b0e
2019-09-23 11:17:41 +01:00
Aniroop Mathur
bf5f18d708 Input: evdev - fix bug in checking duplicate clock change request
clk_type and clkid stores different predefined clock identification
values so they cannot be compared for checking duplicate clock change
request. Therefore, lets fix it to avoid unexpected results.

Signed-off-by: Aniroop Mathur <a.mathur@samsung.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2015-10-31 10:35:02 -07:00
David Herrmann
06a16293f7 Input: evdev - add event-mask API
Hardware manufacturers group keys in the weirdest way possible. This may
cause a power-key to be grouped together with normal keyboard keys and
thus be reported on the same kernel interface.

However, user-space is often only interested in specific sets of events.
For instance, daemons dealing with system-reboot (like systemd-logind)
listen for KEY_POWER, but are not interested in any main keyboard keys.
Usually, power keys are reported via separate interfaces, however,
some i8042 boards report it in the AT matrix. To avoid waking up those
system daemons on each key-press, we had two ideas:
 - split off KEY_POWER into a separate interface unconditionally
 - allow filtering a specific set of events on evdev FDs

Splitting of KEY_POWER is a rather weird way to deal with this and may
break backwards-compatibility. It is also specific to KEY_POWER and might
be required for other stuff, too. Moreover, we might end up with a huge
set of input-devices just to have them properly split.

Hence, this patchset implements the second idea: An event-mask to specify
which events you're interested in. Two ioctls allow setting this mask for
each event-type. If not set, all events are reported. The type==0 entry is
used same as in EVIOCGBIT to set the actual EV_* mask of filtered events.
This way, you have a two-level filter.

We are heavily forward-compatible to new event-types and event-codes. So
new user-space will be able to run on an old kernel which doesn't know the
given event-codes or event-types.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2015-10-26 19:06:48 -07:00
Takashi Iwai
eb38f3a4f6 Input: evdev - do not report errors form flush()
We've got bug reports showing the old systemd-logind (at least
system-210) aborting unexpectedly, and this turned out to be because
of an invalid error code from close() call to evdev devices.  close()
is supposed to return only either EINTR or EBADFD, while the device
returned ENODEV.  logind was overreacting to it and decided to kill
itself when an unexpected error code was received.  What a tragedy.

The bad error code comes from flush fops, and actually evdev_flush()
returns ENODEV when device is disconnected or client's access to it is
revoked. But in these cases the fact that flush did not actually happen is
not an error, but rather normal behavior. For non-disconnected devices
result of flush is also not that interesting as there is no potential of
data loss and even if it fails application has no way of handling the
error. Because of that we are better off always returning success from
evdev_flush().

Also returning EINTR from flush()/close() is discouraged (as it is not
clear how application should handle this error), so let's stop taking
evdev->mutex interruptibly.

Bugzilla: http://bugzilla.suse.com/show_bug.cgi?id=939834
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2015-09-03 23:38:23 -07:00
Pekka Enberg
67367fd259 Input: evdev - use kvfree() in evdev_release()
Use kvfree() instead of open-coding it.

Signed-off-by: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2015-05-15 15:58:39 -07:00
Dmitry Torokhov
b881d53770 Input: evdev - do not queue SYN_DROPPED if queue is empty
There is no point in queueing EV_SYN/SYN_DROPPED on clock type change when
there are no events in the client's queue and doing so confuses tests in
libinput package, so let's not do that.

Reported-and-tested-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2015-02-05 19:29:02 -08:00
Dmitry Torokhov
0c49cd295d Merge tag 'v3.19-rc4' into next
Merge with mainline to bring in the latest thermal and other changes.
2015-01-15 09:46:14 -08:00
Anshul Garg
0c3e99437a Input: evdev - flush pending events on clock type change
When client changes the type of clock used for the time stamps in input
events flush pending events from the client's queue (since client would not
know which events have old time stamps and which ones have new ones) and
and queue SYN_DROPPED event.

Signed-off-by: Anshul Garg <anshul.g@samsung.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2015-01-15 09:37:18 -08:00
Linus Torvalds
bac22980b0 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input layer fixes from Dmitry Torokhov:
 "Fixes for v7 protocol for ALPS devices and few other driver fixes.

  Also users can request input events to be stamped with boot time
  timestamps, in addition to real and monotonic timestamps"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
  Input: hil_kbd - fix incorrect use of init_completion
  Input: alps - v7: document the v7 touchpad packet protocol
  Input: alps - v7: fix finger counting for > 2 fingers on clickpads
  Input: alps - v7: sometimes a single touch is reported in mt[1]
  Input: alps - v7: ignore new packets
  Input: evdev - add CLOCK_BOOTTIME support
  Input: psmouse - expose drift duration for IBM trackpoints
  Input: stmpe - bias keypad columns properly
  Input: stmpe - enforce device tree only mode
  mfd: stmpe: add pull up/down register offsets for STMPE
  Input: optimize events_per_packet count calculation
  Input: edt-ft5x06 - fixed a macro coding style issue
  Input: gpio_keys - replace timer and workqueue with delayed workqueue
  Input: gpio_keys - allow separating gpio and irq in device tree
2014-12-30 16:59:59 -08:00
Aniroop Mathur
aac8bcf1ed Input: evdev - add CLOCK_BOOTTIME support
This patch adds support for CLOCK_BOOTTIME for input event timestamp.
CLOCK_BOOTTIME includes suspend time, so it would allow aplications
to get correct time difference between two events even when system
resumes from suspend state.

Signed-off-by: Aniroop Mathur <a.mathur@samsung.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2014-12-17 15:46:59 -08:00
Andrew Morton
92788ac1eb drivers/input/evdev.c: don't kfree() a vmalloc address
If kzalloc() failed and then evdev_open_device() fails, evdev_open()
will pass a vmalloc'ed pointer to kfree.

This might fix https://bugzilla.kernel.org/show_bug.cgi?id=88401, where
there was a crash in kfree().

Reported-by: Christian Casteyde <casteyde.christian@free.fr>
Belatedly-Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Henrik Rydberg <rydberg@euromail.se>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-12-03 09:35:38 -08:00
Dmitry Torokhov
7c4f56070f Input: evdev - fix EVIOCG{type} ioctl
The 'max' size passed into the function is measured in number of bits
(KEY_MAX, LED_MAX, etc) so we need to convert it accordingly before trying
to copy the data out, otherwise we will try copying too much and end up
with up with a page fault.

Reported-by: Pavel Machek <pavel@ucw.cz>
Reviewed-by: Pavel Machek <pavel@ucw.cz>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2014-10-07 09:55:01 -07:00
Thomas Gleixner
5cac2f4d1c input: evdev: Use ktime_mono_to_real()
Convert the monotonic timestamp with ktime_mono_to_real() in
evdev_events().

In evdev_queue_syn_dropped() we can call either ktime_get() or
ktime_get_real() depending on the clkid. No point in having two calls
for CLOCK_REALTIME.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: John Stultz <john.stultz@linaro.org>
2014-07-23 10:18:02 -07:00
Dmitry Torokhov
879f99ef2c Merge tag 'v3.15-rc5' into next
Merge with Linux 3.15-rc5 to sync up Wacom and other changes.
2014-05-14 16:49:19 -07:00
Dmitry Torokhov
d0f0a16014 Input: evdev - get rid of old workaround for EVIOCGBIT
We put this workaround in 2008 and the offending userspace has been fixed
up long time ago; the link in the message is no longer valid either, so it
is time to retire it.

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2014-05-14 16:39:46 -07:00
Elias Vanderstuyft
fc7392aa1b Input: don't modify the id of ioctl-provided ff effect on upload failure
If a new (id == -1) ff effect was uploaded from userspace,
ff-core.c::input_ff_upload() will have assigned a positive number to the
new effect id.  Currently, evdev.c::evdev_do_ioctl() will save this new id
to userspace, regardless of whether the upload succeeded or not.

On upload failure, this can be confusing because the dev->ff->effects[]
array will not contain an element at the index of that new effect id.

This patch fixes this by leaving the id unchanged after upload fails.

Note: Unfortunately applications should still expect changed effect id for
quite some time.

This has been discussed on:
http://www.mail-archive.com/linux-input@vger.kernel.org/msg08513.html
("ff-core effect id handling in case of a failed effect upload")

Suggested-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Elias Vanderstuyft <elias.vds@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2014-03-29 12:13:09 -07:00
Daniel Stone
92eb77d0ff Input: evdev - fall back to vmalloc for client event buffer
evdev always tries to allocate the event buffer for clients using
kzalloc rather than vmalloc, presumably to avoid mapping overhead where
possible.  However, drivers like bcm5974, which claims support for
reporting 16 fingers simultaneously, can have an extraordinarily large
buffer.  The resultant contiguous order-4 allocation attempt fails due
to fragmentation, and the device is thus unusable until reboot.

Try kzalloc if we can to avoid the mapping overhead, but if that fails,
fall back to vzalloc.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2013-10-31 08:45:42 -07:00
David Herrmann
c7dc65737c Input: evdev - add EVIOCREVOKE ioctl
If we have multiple sessions on a system, we normally don't want
background sessions to read input events. Otherwise, it could capture
passwords and more entered by the user on the foreground session. This is
a real world problem as the recent XMir development showed:
  http://mjg59.dreamwidth.org/27327.html

We currently rely on sessions to release input devices when being
deactivated. This relies on trust across sessions. But that's not given on
usual systems. We therefore need a way to control which processes have
access to input devices.

With VTs the kernel simply routed them through the active /dev/ttyX. This
is not possible with evdev devices, though. Moreover, we want to avoid
routing input-devices through some dispatcher-daemon in userspace (which
would add some latency).

This patch introduces EVIOCREVOKE. If called on an evdev fd, this revokes
device-access irrecoverably for that *single* open-file. Hence, once you
call EVIOCREVOKE on any dup()ed fd, all fds for that open-file will be
rather useless now (but still valid compared to close()!). This allows us
to pass fds directly to session-processes from a trusted source. The
source keeps a dup()ed fd and revokes access once the session-process is
no longer active.
Compared to the EVIOCMUTE proposal, we can avoid the CAP_SYS_ADMIN
restriction now as there is no way to revive the fd again. Hence, a user
is free to call EVIOCREVOKE themself to kill the fd.

Additionally, this ioctl allows multi-layer access-control (again compared
to EVIOCMUTE which was limited to one layer via CAP_SYS_ADMIN). A middle
layer can simply request a new open-file from the layer above and pass it
to the layer below. Now each layer can call EVIOCREVOKE on the fds to
revoke access for all layers below, at the expense of one fd per layer.

There's already ongoing experimental user-space work which demonstrates
how it can be used:
  http://lists.freedesktop.org/archives/systemd-devel/2013-August/012897.html

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2013-09-07 12:53:20 -07:00
David Herrmann
483180281f Input: evdev - flush queues during EVIOCGKEY-like ioctls
If userspace requests current KEY-state, they very likely assume that no
such events are pending in the output queue of the evdev device.
Otherwise, they will parse events which they already handled via
EVIOCGKEY(). For XKB applications this can cause irreversible keyboard
states if a modifier is locked multiple times because a CTRL-DOWN event is
handled once via EVIOCGKEY() and once from the queue via read(), even
though it should handle it only once.

Therefore, lets do the only logical thing and flush the evdev queue
atomically during this ioctl. We only flush events that are affected by
the given ioctl.

This only affects boolean events like KEY, SND, SW and LED. ABS, REL and
others are not affected as duplicate events can be handled gracefully by
user-space.

Note: This actually breaks semantics of the evdev ABI. However,
investigations showed that userspace already expects the new semantics and
we end up fixing at least all XKB applications.
All applications that are aware of this race-condition mirror the KEY
state for each open-file and detect/drop duplicate events. Hence, they do
not care whether duplicates are posted or not and work fine with this fix.

Also note that we need proper locking to guarantee atomicity and avoid
dead-locks. event_lock must be locked before queue_lock (see input-core).
However, we can safely release event_lock while flushing the queue. This
allows the input-core to proceed with pending events and only stop if it
needs our queue_lock to post new events.
This should guarantee that we don't block event-dispatching for too long
while flushing a single event queue.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2013-06-09 22:35:05 -07:00
Dmitry Torokhov
4a215aade0 Input: fix use-after-free introduced with dynamic minor changes
Commit 7f8d4cad1e ("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 <davej@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-10-22 08:50:37 +03:00
Dmitry Torokhov
7f8d4cad1e Input: extend the number of event (and other) devices
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 <dh.herrmann@googlemail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2012-10-08 09:37:55 -07:00
Henrik Rydberg
a274ac15ed Input: evdev - Add the events() callback
By sending a full frame of events at the same time, the irqsoff
latency at heavy load is brought down from 200 us to 100 us.

Cc: Daniel Kurtz <djkurtz@chromium.org>
Tested-by: Benjamin Tissoires <benjamin.tissoires@enac.fr>
Tested-by: Ping Cheng <pingc@wacom.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
2012-09-19 19:50:18 +02:00
Henrik Rydberg
8d18fba282 Input: Break out MT data
Move all MT-related things to a separate place. This saves some
bytes for non-mt input devices, and prepares for new MT features.

Reviewed-and-tested-by: Benjamin Tissoires <benjamin.tissoires@enac.fr>
Tested-by: Ping Cheng <pingc@wacom.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
2012-09-19 19:50:17 +02:00
Dmitry Torokhov
2872a9b521 Input: evdev - properly handle read/write with count 0
According to the standard count 0 is special - no IO should happen but we
can check error conditions (device gone away, etc), and return 0 if there
are no errors. We used to return -EINVAL instead and we also could return 0
if an event was "stolen" by another thread.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2012-05-02 00:23:58 -07:00
Dmitry Torokhov
dba4258068 Input: evdev - properly access RCU-protected 'grab' data
We should use rcu_dereference_protected() when checking if given client
is the one that grabbed the device. This fixes warnings produced by
sparse.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2012-05-02 00:23:14 -07:00
Dmitry Torokhov
10ce3cc919 Merge branch 'next' into for-linus 2012-03-19 17:02:01 -07:00
Dmitry Torokhov
05b7b842fa Merge branch 'for-next' of github.com:rydberg/linux into next 2012-03-09 10:56:35 -08:00
Dmitry Torokhov
b675b3667f Merge commit 'v3.3-rc6' into next 2012-03-09 10:55:17 -08:00
Heiko Stübner
02dfc49680 Input: evdev - fix variable initialisation
Commit 509f87c5f5 (evdev - do not block waiting for an event if fd
is nonblock) created a code path were it was possible to use retval
uninitialized.

This could lead to the xorg evdev input driver getting corrupt data
and refusing to work with log messages like
	AUO-Pixcir touchscreen: Read error: Success
	sg060_keys: Read error: Success
	AUO-Pixcir touchscreen: Read error: Success
	sg060_keys: Read error: Success
(for drivers auo-pixcir-ts and gpio-keys).

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Dima Zavin <dima@android.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2012-02-24 00:52:43 -08:00
Henrik Rydberg
1cf0c6e69e Input: Add EVIOC mechanism for MT slots
This patch adds the ability to extract MT slot data via a new ioctl,
EVIOCGMTSLOTS. The function returns an array of slot values for the
specified ABS_MT event type.

Example of user space usage:

struct { unsigned code; int values[64]; } req;
req.code = ABS_MT_POSITION_X;
if (ioctl(fd, EVIOCGMTSLOTS(sizeof(req)), &req) < 0)
	return -1;
for (i = 0; i < 64; i++)
	printf("slot %d: %d\n", i, req.values[i]);

Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
2012-02-09 09:40:57 +01:00
John Stultz
a80b83b7b8 Input: add infrastructure for selecting clockid for event time stamps
As noted by Arve and others, since wall time can jump backwards, it is
difficult to use for input because one cannot determine if one event
occurred before another or for how long a key was pressed.

However, the timestamp field is part of the kernel ABI, and cannot be
changed without possibly breaking existing users.

This patch adds a new IOCTL that allows a clockid to be set in the
evdev_client struct that will specify which time base to use for event
timestamps (ie: CLOCK_MONOTONIC instead of CLOCK_REALTIME).

For now we only support CLOCK_MONOTONIC and CLOCK_REALTIME, but
in the future we could support other clockids if appropriate.

The default remains CLOCK_REALTIME, so we don't change the ABI.

Signed-off-by: John Stultz <john.stultz@linaro.org>
Reviewed-by: Daniel Kurtz <djkurtz@google.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2012-02-03 00:24:58 -08:00
Heiko Stübner
42f578741b Input: evdev - fix variable initialisation
Commit 509f87c5f5 (evdev - do not block waiting for an event if fd
is nonblock) created a code path were it was possible to use retval
uninitialized.

This could lead to the xorg evdev input driver getting corrupt data
and refusing to work with log messages like
	AUO-Pixcir touchscreen: Read error: Success
	sg060_keys: Read error: Success
	AUO-Pixcir touchscreen: Read error: Success
	sg060_keys: Read error: Success
(for drivers auo-pixcir-ts and gpio-keys).

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Dima Zavin <dima@android.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2012-02-01 09:12:54 -08:00
Dima Zavin
509f87c5f5 Input: evdev - do not block waiting for an event if fd is nonblock
If there is a full packet in the buffer, and we overflow that buffer
right after checking for that condition, it would have been possible
for us to block indefinitely (rather, until the next full packet) even if
the file was marked as O_NONBLOCK.

Cc: Jeff Brown <jeffbrown@android.com>
Signed-off-by: Dima Zavin <dima@android.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2011-12-30 15:26:35 -08:00
Dima Zavin
e90f869cae Input: evdev - if no events and non-block, return EAGAIN not 0
Signed-off-by: Dima Zavin <dima@android.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2011-12-30 15:26:35 -08:00
Dima Zavin
566cf5b6e3 Input: evdev - only allow reading events if a full packet is present
Without this, it was possible for the reader to get ahead of packet_head.
If the input device generated a partial packet *right* after the reader
got ahead, then we can get into a situation where the device is marked
readable, but read always returns 0 until the next packet is finished
(i.e a SYN is generated by the input driver).

This situation can also happen if we overflow the buffer while a reader
is trying to read an event out.

Signed-off-by: Dima Zavin <dima@android.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2011-12-30 15:26:34 -08:00
Dmitry Torokhov
da40b0b6b4 Input: evdev - try to wake up readers only if we have full packet
We should only wake waiters on the event device when we actually post
an EV_SYN/SYN_REPORT to the queue. Otherwise we end up making waiting
threads runnable only to go right back to sleep because the device
still isn't readable.

Reported-by: Jeffrey Brown <jeffbrown@android.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2011-06-18 02:54:02 -07:00
Eric Dumazet
7cbbb758d3 Input: remove useless synchronize_rcu() calls
There is no need to call synchronize_rcu() after a list insertion,
or a NULL->ptr assignment.

However, the reverse operations do need this call.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2011-05-12 08:28:57 -07:00
Jeff Brown
cdda911c34 Input: evdev - only signal polls on full packets
This patch modifies evdev so that it only becomes readable when
the buffer contains an EV_SYN/SYN_REPORT event.

On SMP systems, it is possible for an evdev client blocked on poll()
to wake up and read events from the evdev ring buffer at the same
rate as they are enqueued.  This can result in high CPU usage,
particularly for MT devices, because the client ends up reading
events one at a time instead of reading complete packets.

We eliminate this problem by making the device readable only when
the buffer contains at least one complete packet.  This causes
clients to block until the entire packet is available.

Signed-off-by: Jeff Brown <jeffbrown@android.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2011-04-26 22:16:38 -07:00
Jeff Brown
9fb0f14e31 Input: evdev - indicate buffer overrun with SYN_DROPPED
Add a new EV_SYN code, SYN_DROPPED, to inform the client when input
events have been dropped from the evdev input buffer due to a
buffer overrun.  The client should use this event as a hint to
reset its state or ignore all following events until the next
packet begins.

Signed-off-by: Jeff Brown <jeffbrown@android.com>
[dtor@mail.ru: Implement Henrik's suggestion and drop old events in
 case of overflow.]
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2011-04-12 23:35:24 -07:00
Peter Korsgaard
439581ec07 Input: evdev - fix evdev_write return value on partial writes
As was recently brought up on the busybox list
(http://lists.busybox.net/pipermail/busybox/2011-January/074565.html),
evdev_write doesn't properly check the count argument, which will
lead to a return value > count on partial writes if the remaining bytes
are accessible - causing userspace confusion.

Fix it by only handling each full input_event structure and return -EINVAL
if less than 1 struct was written, similar to how it is done in evdev_read.

Reported-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Acked-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2011-02-27 01:52:53 -08:00
Dmitry Torokhov
554738da71 Merge branch 'next' into for-linus
Conflicts:
	include/linux/input.h
2011-01-06 22:34:59 -08:00
Dmitry Torokhov
5c461b913a Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rydberg/input-mt into next 2010-12-27 17:33:20 -08:00
Henrik Rydberg
85b7720039 Input: introduce device properties
Today, userspace sets up an input device based on the data it emits.
This is not always enough; a tablet and a touchscreen may emit exactly
the same data, for instance, but the former should be set up with a
pointer whereas the latter does not need to. Recently, a new type of
touchpad has emerged where the buttons are under the pad, which
changes logic without changing the emitted data. This patch introduces
a new ioctl, EVIOCGPROP, which enables user access to a set of device
properties useful during setup. The properties are given as a bitmap
in the same fashion as the event types, and are also made available
via sysfs, uevent and /proc/bus/input/devices.

Acked-by: Ping Cheng <pingc@wacom.com>
Acked-by: Chase Douglas <chase.douglas@canonical.com>
Acked-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
2010-12-20 09:37:33 +01:00
Dmitry Torokhov
ab4e019219 Input: define separate EVIOCGKEYCODE_V2/EVIOCSKEYCODE_V2
The desire to keep old names for the EVIOCGKEYCODE/EVIOCSKEYCODE while
extending them to support large scancodes was a mistake. While we tried
to keep ABI intact (and we succeeded in doing that, programs compiled
on older kernels will work on newer ones) there is still a problem with
recompiling existing software with newer kernel headers.

New kernel headers will supply updated ioctl numbers and kernel will
expect that userspace will use struct input_keymap_entry to set and
retrieve keymap data. But since the names of ioctls are still the same
userspace will happily compile even if not adjusted to make use of the
new structure and will start miraculously fail in the field.

To avoid this issue let's revert EVIOCGKEYCODE/EVIOCSKEYCODE definitions
and add EVIOCGKEYCODE_V2/EVIOCSKEYCODE_V2 so that userspace can explicitly
select the style of ioctls it wants to employ.

Reviewed-by: Henrik Rydberg <rydberg@euromail.se>
Acked-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2010-12-14 23:55:21 -08:00
Joe Perches
da0c490115 Input: use pr_fmt and pr_<level>
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2010-11-30 23:10:26 -08:00
Linus Torvalds
3a99c63190 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (75 commits)
  Input: wacom - specify Cinitq supported tools
  Input: ab8500-ponkey - fix IRQ freeing in error path
  Input: adp5588-keys - use more obvious i2c_device_id name string
  Input: ad7877 - switch to using threaded IRQ
  Input: ad7877 - use attribute group to control visibility of attributes
  Input: serio - add support for PS2Mult multiplexer protocol
  Input: wacom - properly enable runtime PM
  Input: ad7877 - filter events where pressure is beyond the maximum
  Input: ad7877 - implement EV_KEY:BTN_TOUCH reporting
  Input: ad7877 - implement specified chip select behavior
  Input: hp680_ts_input - use cancel_delayed_work_sync()
  Input: mousedev - correct lockdep annotation
  Input: ads7846 - switch to using threaded IRQ
  Input: serio - support multiple child devices per single parent
  Input: synaptics - simplify pass-through port handling
  Input: add ROHM BU21013 touch panel controller support
  Input: omap4-keypad - wake-up on events & long presses
  Input: omap4-keypad - fix interrupt line configuration
  Input: omap4-keypad - SYSCONFIG register configuration
  Input: omap4-keypad - use platform device helpers
  ...
2010-10-25 07:59:01 -07:00
Dmitry Torokhov
49327ad2bb Merge branch 'next' into for-linus 2010-10-24 22:11:17 -07:00
Linus Torvalds
092e0e7e52 Merge branch 'llseek' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl
* '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
2010-10-22 10:52:56 -07:00