1. 24 Jan, 2015 30 commits
    • Tejun Heo's avatar
      writeback: fix a subtle race condition in I_DIRTY clearing · 762516d1
      Tejun Heo authored
      After invoking ->dirty_inode(), __mark_inode_dirty() does smp_mb() and
      tests inode->i_state locklessly to see whether it already has all the
      necessary I_DIRTY bits set.  The comment above the barrier doesn't
      contain any useful information - memory barriers can't ensure "changes
      are seen by all cpus" by itself.
      
      And it sure enough was broken.  Please consider the following
      scenario.
      
       CPU 0					CPU 1
       -------------------------------------------------------------------------------
      
      					enters __writeback_single_inode()
      					grabs inode->i_lock
      					tests PAGECACHE_TAG_DIRTY which is clear
       enters __set_page_dirty()
       grabs mapping->tree_lock
       sets PAGECACHE_TAG_DIRTY
       releases mapping->tree_lock
       leaves __set_page_dirty()
      
       enters __mark_inode_dirty()
       smp_mb()
       sees I_DIRTY_PAGES set
       leaves __mark_inode_dirty()
      					clears I_DIRTY_PAGES
      					releases inode->i_lock
      
      Now @inode has dirty pages w/ I_DIRTY_PAGES clear.  This doesn't seem
      to lead to an immediately critical problem because requeue_inode()
      later checks PAGECACHE_TAG_DIRTY instead of I_DIRTY_PAGES when
      deciding whether the inode needs to be requeued for IO and there are
      enough unintentional memory barriers inbetween, so while the inode
      ends up with inconsistent I_DIRTY_PAGES flag, it doesn't fall off the
      IO list.
      
      The lack of explicit barrier may also theoretically affect the other
      I_DIRTY bits which deal with metadata dirtiness.  There is no
      guarantee that a strong enough barrier exists between
      I_DIRTY_[DATA]SYNC clearing and write_inode() writing out the dirtied
      inode.  Filesystem inode writeout path likely has enough stuff which
      can behave as full barrier but it's theoretically possible that the
      writeout may not see all the updates from ->dirty_inode().
      
      Fix it by adding an explicit smp_mb() after I_DIRTY clearing.  Note
      that I_DIRTY_PAGES needs a special treatment as it always needs to be
      cleared to be interlocked with the lockless test on
      __mark_inode_dirty() side.  It's cleared unconditionally and
      reinstated after smp_mb() if the mapping still has dirty pages.
      
      Also add comments explaining how and why the barriers are paired.
      
      Lightly tested.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Jan Kara <jack@suse.cz>
      Cc: Mikulas Patocka <mpatocka@redhat.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      
      (cherry picked from commit 9c6ac78e)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      762516d1
    • Lars Ellenberg's avatar
      drbd: merge_bvec_fn: properly remap bvm->bi_bdev · 7d9c985e
      Lars Ellenberg authored
      This was not noticed for many years. Affects operation if
      md raid is used a backing device for DRBD.
      
      CC: stable@kernel.org # v3.2+
      Signed-off-by: default avatarPhilipp Reisner <philipp.reisner@linbit.com>
      Signed-off-by: default avatarLars Ellenberg <lars.ellenberg@linbit.com>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      
      (cherry picked from commit 3b9d35d7)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      7d9c985e
    • Jens Axboe's avatar
      genhd: check for int overflow in disk_expand_part_tbl() · 852b016c
      Jens Axboe authored
      We can get here from blkdev_ioctl() -> blkpg_ioctl() -> add_partition()
      with a user passed in partno value. If we pass in 0x7fffffff, the
      new target in disk_expand_part_tbl() overflows the 'int' and we
      access beyond the end of ptbl->part[] and even write to it when we
      do the rcu_assign_pointer() to assign the new partition.
      Reported-by: default avatarDavid Ramos <daramos@stanford.edu>
      Cc: stable@kernel.org
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      
      (cherry picked from commit 5fabcb4c)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      852b016c
    • Kazuya Mizuguchi's avatar
      usb: renesas_usbhs: gadget: fix NULL pointer dereference in ep_disable() · ceef81f2
      Kazuya Mizuguchi authored
      This patch fixes an issue that the NULL pointer dereference happens
      when we uses g_audio driver. Since the g_audio driver will call
      usb_ep_disable() in afunc_set_alt() before it calls usb_ep_enable(),
      the uep->pipe of renesas usbhs driver will be NULL. So, this patch
      adds a condition to avoid the oops.
      Signed-off-by: default avatarKazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
      Signed-off-by: default avatarTakeshi Kihara <takeshi.kihara.df@renesas.com>
      Signed-off-by: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Fixes: 2f98382d (usb: renesas_usbhs: Add Renesas USBHS Gadget)
      Cc: <stable@vger.kernel.org> # v3.0+
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      
      (cherry picked from commit 11432050)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      ceef81f2
    • Greg Kroah-Hartman's avatar
      USB: cdc-acm: check for valid interfaces · 869d03a7
      Greg Kroah-Hartman authored
      We need to check that we have both a valid data and control inteface for both
      types of headers (union and not union.)
      
      References: https://bugzilla.kernel.org/show_bug.cgi?id=83551Reported-by: default avatarSimon Schubert <2+kernel@0x2c.org>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      (cherry picked from commit 403dff4e)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      869d03a7
    • Dan Carpenter's avatar
      ALSA: hda - using uninitialized data · d88b4c6a
      Dan Carpenter authored
      In olden times the snd_hda_param_read() function always set "*start_id"
      but in 2007 we introduced a new return and it causes uninitialized data
      bugs in a couple of the callers: print_codec_info() and
      hdmi_parse_codec().
      
      Fixes: e8a7f136 ('[ALSA] hda-intel - Improve HD-audio codec probing robustness')
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      
      (cherry picked from commit 69eba10e)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      d88b4c6a
    • Jiri Jaburek's avatar
      ALSA: usb-audio: extend KEF X300A FU 10 tweak to Arcam rPAC · 6be5bc0f
      Jiri Jaburek authored
      The Arcam rPAC seems to have the same problem - whenever anything
      (alsamixer, udevd, 3.9+ kernel from 60af3d03, ..) attempts to
      access mixer / control interface of the card, the firmware "locks up"
      the entire device, resulting in
        SNDRV_PCM_IOCTL_HW_PARAMS failed (-5): Input/output error
      from alsa-lib.
      
      Other operating systems can somehow read the mixer (there seems to be
      playback volume/mute), but any manipulation is ignored by the device
      (which has hardware volume controls).
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarJiri Jaburek <jjaburek@redhat.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      
      (cherry picked from commit d70a1b98)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      6be5bc0f
    • Alex Williamson's avatar
      Revert "driver core: Fix unbalanced device reference in drivers_probe" · cbfd8c63
      Alex Williamson authored
      This reverts commit bb34cb6b.
      
      Wrong patch for the wrong branch, sorry for the noise...
      
      Cc: Alex Williamson <alex.williamson@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      driver core: Fix unbalanced device reference in drivers_probe
      
      bus_find_device_by_name() acquires a device reference which is never
      released.  This results in an object leak, which on older kernels
      results in failure to release all resources of PCI devices.  libvirt
      uses drivers_probe to re-attach devices to the host after assignment
      and is therefore a common trigger for this leak.
      
      Example:
      
      # cd /sys/bus/pci/
      # dmesg -C
      # echo 1 > devices/0000\:01\:00.0/sriov_numvfs
      # echo 0 > devices/0000\:01\:00.0/sriov_numvfs
      # dmesg | grep 01:10
       pci 0000:01:10.0: [8086:10ca] type 00 class 0x020000
       kobject: '0000:01:10.0' (ffff8801d79cd0a8): kobject_add_internal: parent: '0000:00:01.0', set: 'devices'
       kobject: '0000:01:10.0' (ffff8801d79cd0a8): kobject_uevent_env
       kobject: '0000:01:10.0' (ffff8801d79cd0a8): fill_kobj_path: path = '/devices/pci0000:00/0000:00:01.0/0000:01:10.0'
       kobject: '0000:01:10.0' (ffff8801d79cd0a8): kobject_uevent_env
       kobject: '0000:01:10.0' (ffff8801d79cd0a8): fill_kobj_path: path = '/devices/pci0000:00/0000:00:01.0/0000:01:10.0'
       kobject: '0000:01:10.0' (ffff8801d79cd0a8): kobject_uevent_env
       kobject: '0000:01:10.0' (ffff8801d79cd0a8): fill_kobj_path: path = '/devices/pci0000:00/0000:00:01.0/0000:01:10.0'
       kobject: '0000:01:10.0' (ffff8801d79cd0a8): kobject_cleanup, parent           (null)
       kobject: '0000:01:10.0' (ffff8801d79cd0a8): calling ktype release
       kobject: '0000:01:10.0': free name
      
      [kobject freed as expected]
      
      # dmesg -C
      # echo 1 > devices/0000\:01\:00.0/sriov_numvfs
      # echo 0000:01:10.0 > drivers_probe
      # echo 0 > devices/0000\:01\:00.0/sriov_numvfs
      # dmesg | grep 01:10
       pci 0000:01:10.0: [8086:10ca] type 00 class 0x020000
       kobject: '0000:01:10.0' (ffff8801d79ce0a8): kobject_add_internal: parent: '0000:00:01.0', set: 'devices'
       kobject: '0000:01:10.0' (ffff8801d79ce0a8): kobject_uevent_env
       kobject: '0000:01:10.0' (ffff8801d79ce0a8): fill_kobj_path: path = '/devices/pci0000:00/0000:00:01.0/0000:01:10.0'
       kobject: '0000:01:10.0' (ffff8801d79ce0a8): kobject_uevent_env
       kobject: '0000:01:10.0' (ffff8801d79ce0a8): fill_kobj_path: path = '/devices/pci0000:00/0000:00:01.0/0000:01:10.0'
       kobject: '0000:01:10.0' (ffff8801d79ce0a8): kobject_uevent_env
       kobject: '0000:01:10.0' (ffff8801d79ce0a8): fill_kobj_path: path = '/devices/pci0000:00/0000:00:01.0/0000:01:10.0'
      
      [no free]
      Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      pcmcia: sa1111: pass sa1111_dev to jornada720 code
      
      All other sa1111 platforms pass sa1111_dev instance to platform-specific
      code. Follow this approach for Jornada720 platform code.
      Signed-off-by: default avatarDmitry Eremin-Solenikov <dbaryshkov@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      pcmcia: sa1111: pass sa1111_dev to badge4-specific code
      
      Pass sa1111_dev to platform-specific init code, as it is done by lubbock
      and neponset. This removes a compilation warnings:
      
      drivers/pcmcia/sa1111_badge4.c: In function 'pcmcia_badge4_init':
      drivers/pcmcia/sa1111_badge4.c:147:5: warning: passing argument 1 of 'sa1111_pcmcia_add' from incompatible pointer type [enabled by default]
      In file included from drivers/pcmcia/sa1111_badge4.c:26:0:
      drivers/pcmcia/sa1111_generic.h:15:5: note: expected 'struct sa1111_dev *' but argument is of type 'struct device *'
      Signed-off-by: default avatarDmitry Eremin-Solenikov <dbaryshkov@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      hangcheck-timer: cleanup casting in hangcheck_init()
      
      The 32 bit addition "(hangcheck_margin + hangcheck_tick)" could
      potentially overflow.  It triggers a static checker warning to have an
      overflowed addition followed by a no-op cast.  I have moved the cast so
      that the addition can't overflow.
      
      Also I removed the unneeded cast on the following line since both
      "hangcheck_tsc_margin" and "TIMER_FREQ" are already 64 bit types.
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      W1: ds2490: Increase timeout when waiting for status
      
      Adjust the bulk message timeout to the other ones (1000ms). Otherwise the
      following dmesg errors can be seen on a Raspberry Pi:
      [   31.492386] Failed to read 1-wire data from 0x81: err=-110.
      [   31.504168] 0x81: count=-110, status:
      [   31.613404] Failed to read 1-wire data from 0x81: err=-110.
      [   31.621915] 0x81: count=-110, status:
      [   43.260968] Failed to read 1-wire data from 0x81: err=-110.
      [   43.270998] 0x81: count=-110, status:
      [   43.379959] Failed to read 1-wire data from 0x81: err=-110.
      [   43.388854] 0x81: count=-110, status:
      Signed-off-by: default avatarAlexander Stein <alexanders83@web.de>
      Acked-by: default avatarEvgeniy Polyakov <zbr@ioremap.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      driver core: Fix unbalanced device reference in drivers_probe
      
      bus_find_device_by_name() acquires a device reference which is never
      released.  This results in an object leak, which on older kernels
      results in failure to release all resources of PCI devices.  libvirt
      uses drivers_probe to re-attach devices to the host after assignment
      and is therefore a common trigger for this leak.
      
      Example:
      
      # cd /sys/bus/pci/
      # dmesg -C
      # echo 1 > devices/0000\:01\:00.0/sriov_numvfs
      # echo 0 > devices/0000\:01\:00.0/sriov_numvfs
      # dmesg | grep 01:10
       pci 0000:01:10.0: [8086:10ca] type 00 class 0x020000
       kobject: '0000:01:10.0' (ffff8801d79cd0a8): kobject_add_internal: parent: '0000:00:01.0', set: 'devices'
       kobject: '0000:01:10.0' (ffff8801d79cd0a8): kobject_uevent_env
       kobject: '0000:01:10.0' (ffff8801d79cd0a8): fill_kobj_path: path = '/devices/pci0000:00/0000:00:01.0/0000:01:10.0'
       kobject: '0000:01:10.0' (ffff8801d79cd0a8): kobject_uevent_env
       kobject: '0000:01:10.0' (ffff8801d79cd0a8): fill_kobj_path: path = '/devices/pci0000:00/0000:00:01.0/0000:01:10.0'
       kobject: '0000:01:10.0' (ffff8801d79cd0a8): kobject_uevent_env
       kobject: '0000:01:10.0' (ffff8801d79cd0a8): fill_kobj_path: path = '/devices/pci0000:00/0000:00:01.0/0000:01:10.0'
       kobject: '0000:01:10.0' (ffff8801d79cd0a8): kobject_cleanup, parent           (null)
       kobject: '0000:01:10.0' (ffff8801d79cd0a8): calling ktype release
       kobject: '0000:01:10.0': free name
      
      [kobject freed as expected]
      
      # dmesg -C
      # echo 1 > devices/0000\:01\:00.0/sriov_numvfs
      # echo 0000:01:10.0 > drivers_probe
      # echo 0 > devices/0000\:01\:00.0/sriov_numvfs
      # dmesg | grep 01:10
       pci 0000:01:10.0: [8086:10ca] type 00 class 0x020000
       kobject: '0000:01:10.0' (ffff8801d79ce0a8): kobject_add_internal: parent: '0000:00:01.0', set: 'devices'
       kobject: '0000:01:10.0' (ffff8801d79ce0a8): kobject_uevent_env
       kobject: '0000:01:10.0' (ffff8801d79ce0a8): fill_kobj_path: path = '/devices/pci0000:00/0000:00:01.0/0000:01:10.0'
       kobject: '0000:01:10.0' (ffff8801d79ce0a8): kobject_uevent_env
       kobject: '0000:01:10.0' (ffff8801d79ce0a8): fill_kobj_path: path = '/devices/pci0000:00/0000:00:01.0/0000:01:10.0'
       kobject: '0000:01:10.0' (ffff8801d79ce0a8): kobject_uevent_env
       kobject: '0000:01:10.0' (ffff8801d79ce0a8): fill_kobj_path: path = '/devices/pci0000:00/0000:00:01.0/0000:01:10.0'
      
      [no free]
      Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      pch_phub: Build context save/restore only for PM
      
      The pch_phub_save_reg_conf() and pch_phub_restore_reg_conf() functions
      are only used for suspend/resume support (i.e. when PM is enabled). If
      PM is disabled they don't need to be built.
      Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      misc: genwqe: check for error from get_user_pages_fast()
      
      `genwqe_user_vmap()` calls `get_user_pages_fast()` and if the return
      value is less than the number of pages requested, it frees the pages and
      returns an error (`-EFAULT`).  However, it fails to consider a negative
      error return value from `get_user_pages_fast()`.  In that case, the test
      `if (rc < m->nr_pages)` will be false (due to promotion of `rc` to a
      large `unsigned int`) and the code will continue on to call
      `genwqe_map_pages()` with an invalid list of page pointers.  Fix it by
      bailing out if `get_user_pages_fast()` returns a negative error value.
      Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
      Cc: <stable@vger.kernel.org> # 3.14.x # 3.15.x # 3.16.x # 3.17.x
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      char: misc: document behaviour of open()
      
      an open syscall now assignes file->private_data to a pointer to the
      miscdevice structure. This reminds driver developers not to duplicate
      code if they need this.
      Signed-off-by: default avatarMartin Kepplinger <martink@posteo.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      fbdev: pxa3xx-gcu: remove redundant implementation of open()
      
      the miscdevice core now does the work in any case.
      Signed-off-by: default avatarMartin Kepplinger <martink@posteo.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      misc: always assign miscdevice to file->private_data in open()
      
      As of now, a miscdevice driver has to provide an implementation of
      the open() file operation if it wants to have misc_open() assign a
      pointer to struct miscdevice to file->private_data for other file
      operations to use (given the user calls open()).
      
      This leads to situations where a miscdevice driver that doesn't need
      internal operations during open() has to implement open() that only
      returns immediately, in order to use the data in private_data in other
      fops.
      
      This provides consistent behaviour for miscdevice developers and will
      always provide the pointer in private_data. A driver's open() fop would,
      of course, just overwrite it, when using private_data itself.
      Signed-off-by: default avatarMartin Kepplinger <martink@posteo.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      Drivers: hv: vmbus: Fix a race condition when unregistering a device
      
      When build with Debug the following crash is sometimes observed:
      Call Trace:
       [<ffffffff812b9600>] string+0x40/0x100
       [<ffffffff812bb038>] vsnprintf+0x218/0x5e0
       [<ffffffff810baf7d>] ? trace_hardirqs_off+0xd/0x10
       [<ffffffff812bb4c1>] vscnprintf+0x11/0x30
       [<ffffffff8107a2f0>] vprintk+0xd0/0x5c0
       [<ffffffffa0051ea0>] ? vmbus_process_rescind_offer+0x0/0x110 [hv_vmbus]
       [<ffffffff8155c71c>] printk+0x41/0x45
       [<ffffffffa004ebac>] vmbus_device_unregister+0x2c/0x40 [hv_vmbus]
       [<ffffffffa0051ecb>] vmbus_process_rescind_offer+0x2b/0x110 [hv_vmbus]
      ...
      
      This happens due to the following race: between 'if (channel->device_obj)' check
      in vmbus_process_rescind_offer() and pr_debug() in vmbus_device_unregister() the
      device can disappear. Fix the issue by taking an additional reference to the
      device before proceeding to vmbus_device_unregister().
      Signed-off-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
      Signed-off-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      Drivers: hv: util: make struct hv_do_fcopy match Hyper-V host messages
      
      An attempt to fix fcopy on i586 (bc5a5b02 Drivers: hv: util: Properly pack the data
      for file copy functionality) led to a regression on x86_64 (and actually didn't fix
      i586 breakage). Fcopy messages from Hyper-V host come in the following format:
      
      struct do_fcopy_hdr   |   36 bytes
      0000                  |    4 bytes
      offset                |    8 bytes
      size                  |    4 bytes
      data                  | 6144 bytes
      
      On x86_64 struct hv_do_fcopy matched this format without ' __attribute__((packed))'
      and on i586 adding ' __attribute__((packed))' to it doesn't change anything. Keep
      the structure packed and add padding to match re reality. Tested both i586 and x86_64
      on Hyper-V Server 2012 R2.
      Signed-off-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
      Signed-off-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      tools: hv: introduce -n/--no-daemon option
      
      All tools/hv daemons do mandatory daemon() on startup. However, no pidfile
      is created, this make it difficult for an init system to track such daemons.
      Modern linux distros use systemd as their init system. It can handle the
      daemonizing by itself, however, it requires a daemon to stay in foreground
      for that. Some distros already carry distro-specific patch for hv tools
      which switches off daemon().
      
      Introduce -n/--no-daemon option for all 3 daemons in hv/tools. Parse options
      with getopt() to make this part easily expandable.
      Signed-off-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
      Signed-off-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      Tools: hv: vssdaemon: ignore the EBUSY on multiple freezing the same partition
      
      If a partition appears mounted more than once in /proc/mounts, vss_do_freeze()
      succeeds only for the first time and gets EBUSY (on freeze) or EINVAL (on
      thaw) for the second time. The patch ignores these to make the backup feature
      work.
      
      Also improved the error handling in case a freeze operation fails.
      Signed-off-by: default avatarDexuan Cui <decui@microsoft.com>
      Reviewed-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      uio: support memory sizes larger than 32 bits
      
      This is a completion to 27a90700
      The size field is also increased to allow values larger than 32 bits
      on platforms that have more than 32 bit physical addresses.
      Signed-off-by: default avatarCristian Stoica <cristian.stoica@freescale.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      devres: support sizes greater than an unsigned long
      
      As in 4f452e8a, use resource_size_t
      to accomodate sizes greater than the size of an unsigned long int on
      platforms that have more than 32 bit physical addresses.
      Signed-off-by: default avatarCristian Stoica <cristian.stoica@freescale.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      mei: fix hbm MEI_HBM_STARTED ambiguity
      
      We have MEI_HBM_STARTED in two contexts one
      after start message was received and second
      after enumeration was completed.
      Because after start message reception we move
      immediately to the enumeration state, we need
      only the later meaning.
      Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      mei: nfc: clean nfc internal struct on host exit
      
      NFC internal structure cleaning was dropped by commit
      
      commit 48705693
      Author: Tomas Winkler <tomas.winkler@intel.com>
      Date:   Mon Feb 17 15:13:19 2014 +0200
      
          mei: Remove all bus devices from the mei_dev list when stopping the MEI
      
          When stopping the MEI, we should remove and potentially unregister
          all bus devices queued on the mei_dev linked list.
      
      We allocate nfc_dev and free it across the reset
      so we do not keep it in dirty state
      Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
      Signed-off-by: default avatarAlexander Usyskin <alexander.usyskin@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      i8k: Add MODULE_DEVICE_TABLE macro
      
      This patch adds MODULE_DEVICE_TABLE macro so i8k.ko module can be automatically
      loaded based on dmi system alias.
      Signed-off-by: default avatarPali Rohár <pali.rohar@gmail.com>
      Acked-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      i8k: Add support for Dell Latitude E6440
      
      Dell Latitude E6440 needs same settings as E6540.
      Signed-off-by: default avatarPali Rohár <pali.rohar@gmail.com>
      Acked-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      checkkconfigsymbols.sh: reimplementation in python
      
      The scripts/checkkconfigsymbols.sh script searches Kconfig features
      in the source code that are not defined in Kconfig. Such identifiers
      always evaluate to false and are the source of various kinds of bugs.
      However, the shell script is slow and it does not detect such broken
      references in Kbuild and Kconfig files (e.g., ``depends on UNDEFINED´´).
      Furthermore, it generates false positives. The script is also hard to
      read and understand, and is thereby difficult to maintain.
      
      This patch replaces the shell script with an implementation in Python,
      which:
          (a) detects the same bugs, but does not report previous false positives
          (b) additionally detects broken references in Kconfig and all
              non-Kconfig files, such as Kbuild, .[cSh], .txt, .sh, defconfig, etc.
          (c) is up to 75 times faster than the shell script
          (d) only checks files under version control
      
      The new script reduces the runtime on my machine (i7-2620M, 8GB RAM, SSD)
      from 3m47s to 0m3s, and reports 938 broken references in Linux v3.17-rc1;
      419 additional reports of which 16 are located in Kconfig files,
      287 in defconfigs, 63 in ./Documentation, 1 in Kbuild.
      
      Moreover, we intentionally include references in comments, which have been
      ignored until now. Such comments may be leftovers of features that have
      been removed or renamed in Kconfig (e.g., ``#endif /* CONFIG_MPC52xx */´´).
      These references can be misleading and should be removed or replaced.
      
      Note that the output format changed from (file list <tab> feature) to
      (feature <tab> file list) as it simplifies the detection of the Kconfig
      feature for long file lists.
      Signed-off-by: default avatarValentin Rothberg <valentinrothberg@gmail.com>
      Signed-off-by: default avatarStefan Hengelein <stefan.hengelein@fau.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      misc: atmel-ssc: prepare clock only when request
      
      Prepare SSC clock only when request SSC channel, the clock will be
      enabled when initialize the SSC.
      Signed-off-by: default avatarBo Shen <voice.shen@atmel.com>
      Acked-by: default avatarNicolas Ferre <nicolas.ferre@atmel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      mei: hbm: use client specific print functions
      
      We have host client in connect/disconnect response processors,
      so use client print functions to simplify and unify code.
      Signed-off-by: default avatarAlexander Usyskin <alexander.usyskin@intel.com>
      Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      mei: debugfs: display also connectionless clients
      
      <debugfs>meiX/meclients: display also fixed/connectionless clients
      
      Use better name for fixed client field:
      fixed_address is boolean and indicates whether a client
      is fixed or dynamic.
      Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      mei: use local cl variables in wd and amthif
      
      Use local cl variable instead of dev->iamthif_cl and dev->wd_cl
      as the first step to use dynamic allocation of these clients
      as their are not supported on all platforms
      Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      mei: drop unneeded client NULL check in cb structure
      
      The pointer to client in the callback structure (cb->cl)
      can't be NULL with current locking.
      We can drop check and warnings as in some cases this just
      uselessly complicates the code flow.
      Signed-off-by: default avatarAlexander Usyskin <alexander.usyskin@intel.com>
      Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      (cherry picked from commit f4c9485f
      bb34cb6b
      0372ffb3)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      cbfd8c63
    • Andy Lutomirski's avatar
      x86, vdso: Use asm volatile in __getcpu · 056da253
      Andy Lutomirski authored
      In Linux 3.18 and below, GCC hoists the lsl instructions in the
      pvclock code all the way to the beginning of __vdso_clock_gettime,
      slowing the non-paravirt case significantly.  For unknown reasons,
      presumably related to the removal of a branch, the performance issue
      is gone as of
      
      e76b027e x86,vdso: Use LSL unconditionally for vgetcpu
      
      but I don't trust GCC enough to expect the problem to stay fixed.
      
      There should be no correctness issue, because the __getcpu calls in
      __vdso_vlock_gettime were never necessary in the first place.
      
      Note to stable maintainers: In 3.18 and below, depending on
      configuration, gcc 4.9.2 generates code like this:
      
           9c3:       44 0f 03 e8             lsl    %ax,%r13d
           9c7:       45 89 eb                mov    %r13d,%r11d
           9ca:       0f 03 d8                lsl    %ax,%ebx
      
      This patch won't apply as is to any released kernel, but I'll send a
      trivial backported version if needed.
      
      Fixes: 51c19b4f x86: vdso: pvclock gettime support
      Cc: stable@vger.kernel.org # 3.8+
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Acked-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarAndy Lutomirski <luto@amacapital.net>
      
      (cherry picked from commit 1ddf0b1b)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      056da253
    • Giedrius Statkevičius's avatar
      HID: Add a new id 0x501a for Genius MousePen i608X · 2afd8fea
      Giedrius Statkevičius authored
      New Genius MousePen i608X devices have a new id 0x501a instead of the
      old 0x5011 so add a new #define with "_2" appended and change required
      places.
      
      The remaining two checkpatch warnings about line length
      being over 80 characters are present in the original files too and this
      patch was made in the same style (no line break).
      
      Just adding a new id and changing the required places should make the
      new device work without any issues according to the bug report in the
      following url.
      
      This patch was made according to and fixes:
      https://bugzilla.kernel.org/show_bug.cgi?id=67111Signed-off-by: default avatarGiedrius Statkevičius <giedrius.statkevicius@gmail.com>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      
      (cherry picked from commit 2bacedad)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      2afd8fea
    • Karl Relton's avatar
      HID: add battery quirk for USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO keyboard · 709c7eea
      Karl Relton authored
      Apple bluetooth wireless keyboard (sold in UK) has always reported zero
      for battery strength no matter what condition the batteries are actually
      in. With this patch applied (applying same quirk as other Apple
      keyboards), the battery strength is now correctly reported.
      Signed-off-by: default avatarKarl Relton <karllinuxtest.relton@ntlworld.com>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      
      (cherry picked from commit da940db4)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      709c7eea
    • Mika Westerberg's avatar
      HID: i2c-hid: Do not free buffers in i2c_hid_stop() · d027e2c5
      Mika Westerberg authored
      When a hid driver that uses i2c-hid as transport is unloaded, the hid core
      will call i2c_hid_stop() which releases all the buffers associated with the
      device. This includes also the command buffer.
      
      Now, when the i2c-hid driver itself is unloaded it tries to power down the
      device by sending it PWR_SLEEP command. Since the command buffer is already
      released we get following crash:
      
       [   79.691459] BUG: unable to handle kernel NULL pointer dereference at           (null)
       [   79.691532] IP: [<ffffffffa05bc049>] __i2c_hid_command+0x49/0x310 [i2c_hid]
       ...
       [   79.693467] Call Trace:
       [   79.693494]  [<ffffffff810424e1>] ? __unmask_ioapic+0x21/0x30
       [   79.693537]  [<ffffffff81042855>] ? unmask_ioapic+0x25/0x40
       [   79.693581]  [<ffffffffa05bc35b>] ? i2c_hid_set_power+0x4b/0xa0 [i2c_hid]
       [   79.693632]  [<ffffffffa05bc3cf>] ? i2c_hid_runtime_resume+0x1f/0x30 [i2c_hid]
       [   79.693689]  [<ffffffff814c08fb>] ? __rpm_callback+0x2b/0x70
       [   79.693733]  [<ffffffff814c0961>] ? rpm_callback+0x21/0x90
       [   79.693776]  [<ffffffff814c0dec>] ? rpm_resume+0x41c/0x600
       [   79.693820]  [<ffffffff814c1e1c>] ? __pm_runtime_resume+0x4c/0x80
       [   79.693868]  [<ffffffff814b8588>] ? __device_release_driver+0x28/0x100
       [   79.693917]  [<ffffffff814b8d90>] ? driver_detach+0xa0/0xb0
       [   79.693959]  [<ffffffff814b82cc>] ? bus_remove_driver+0x4c/0xb0
       [   79.694006]  [<ffffffff810d1cfd>] ? SyS_delete_module+0x11d/0x1d0
       [   79.694054]  [<ffffffff8165f107>] ? int_signal+0x12/0x17
       [   79.694095]  [<ffffffff8165ee69>] ? system_call_fastpath+0x12/0x17
      
      Fix this so that we only free buffers when the i2c-hid driver itself is
      removed.
      
      Fixes: 34f439e4 ("HID: i2c-hid: add runtime PM support")
      Reported-by: default avatarGabriele Mazzotta <gabriele.mzt@gmail.com>
      Signed-off-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Reviewed-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      
      (cherry picked from commit 5b44c53a)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      d027e2c5
    • Dan Carpenter's avatar
      HID: roccat: potential out of bounds in pyra_sysfs_write_settings() · b2727d54
      Dan Carpenter authored
      This is a static checker fix.  We write some binary settings to the
      sysfs file.  One of the settings is the "->startup_profile".  There
      isn't any checking to make sure it fits into the
      pyra->profile_settings[] array in the profile_activated() function.
      
      I added a check to pyra_sysfs_write_settings() in both places because
      I wasn't positive that the other callers were correct.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      
      (cherry picked from commit 606185b2)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      b2727d54
    • Gwendal Grignou's avatar
      HID: i2c-hid: prevent buffer overflow in early IRQ · a17fa5cb
      Gwendal Grignou authored
      Before ->start() is called, bufsize size is set to HID_MIN_BUFFER_SIZE,
      64 bytes. While processing the IRQ, we were asking to receive up to
      wMaxInputLength bytes, which can be bigger than 64 bytes.
      
      Later, when ->start is run, a proper bufsize will be calculated.
      
      Given wMaxInputLength is said to be unreliable in other part of the
      code, set to receive only what we can even if it results in truncated
      reports.
      Signed-off-by: default avatarGwendal Grignou <gwendal@chromium.org>
      Reviewed-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      
      (cherry picked from commit d1c7e29e)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      a17fa5cb
    • Jean-Baptiste Maneyrol's avatar
      HID: i2c-hid: fix race condition reading reports · 4af3332b
      Jean-Baptiste Maneyrol authored
      Current driver uses a common buffer for reading reports either
      synchronously in i2c_hid_get_raw_report() and asynchronously in
      the interrupt handler.
      There is race condition if an interrupt arrives immediately after
      the report is received in i2c_hid_get_raw_report(); the common
      buffer is modified by the interrupt handler with the new report
      and then i2c_hid_get_raw_report() proceed using wrong data.
      
      Fix it by using a separate buffers for synchronous reports.
      Signed-off-by: default avatarJean-Baptiste Maneyrol <jmaneyrol@invensense.com>
      [Antonio Borneo: cleanup, rebase to v3.17, submit mainline]
      Signed-off-by: default avatarAntonio Borneo <borneo.antonio@gmail.com>
      Reviewed-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      
      (cherry picked from commit 6296f4a8)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      4af3332b
    • Joerg Roedel's avatar
      iommu/vt-d: Fix dmar_domain leak in iommu_attach_device · a26e1f58
      Joerg Roedel authored
      Since commit 1196c2fb a domain is only destroyed in the
      notifier path if it is hot-unplugged. This caused a
      domain leakage in iommu_attach_device when a driver was
      unbound from the device and bound to VFIO. In this case the
      device is attached to a new domain and unlinked from the old
      domain. At this point nothing points to the old domain
      anymore and its memory is leaked.
      Fix this by explicitly freeing the old domain in
      iommu_attach_domain.
      
      Fixes: 1196c2fb (iommu/vt-d: Fix dmar_domain leak in iommu_attach_device)
      Cc: stable@vger.kernel.org # v3.18
      Tested-by: default avatarJerry Hoemann <jerry.hoemann@hp.com>
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      
      (cherry picked from commit 62c22167)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      a26e1f58
    • Richard Weinberger's avatar
      UBI: Fix double free after do_sync_erase() · 605ec17d
      Richard Weinberger authored
      If the erase worker is unable to erase a PEB it will
      free the ubi_wl_entry itself.
      The failing ubi_wl_entry must not free()'d again after
      do_sync_erase() returns.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      
      (cherry picked from commit aa5ad3b6)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      605ec17d
    • Richard Weinberger's avatar
      UBI: Fix invalid vfree() · 1a139e0e
      Richard Weinberger authored
      The logic of vfree()'ing vol->upd_buf is tied to vol->updating.
      In ubi_start_update() vol->updating is set long before vmalloc()'ing
      vol->upd_buf. If we encounter a write failure in ubi_start_update()
      before vmalloc() the UBI device release function will try to vfree()
      vol->upd_buf because vol->updating is set.
      Fix this by allocating vol->upd_buf directly after setting vol->updating.
      
      Fixes:
      [   31.559338] UBI warning: vol_cdev_release: update of volume 2 not finished, volume is damaged
      [   31.559340] ------------[ cut here ]------------
      [   31.559343] WARNING: CPU: 1 PID: 2747 at mm/vmalloc.c:1446 __vunmap+0xe3/0x110()
      [   31.559344] Trying to vfree() nonexistent vm area (ffffc90001f2b000)
      [   31.559345] Modules linked in:
      [   31.565620]  0000000000000bba ffff88002a0cbdb0 ffffffff818f0497 ffff88003b9ba148
      [   31.566347]  ffff88002a0cbde0 ffffffff8156f515 ffff88003b9ba148 0000000000000bba
      [   31.567073]  0000000000000000 0000000000000000 ffff88002a0cbe88 ffffffff8156c10a
      [   31.567793] Call Trace:
      [   31.568034]  [<ffffffff818f0497>] dump_stack+0x4e/0x7a
      [   31.568510]  [<ffffffff8156f515>] ubi_io_write_vid_hdr+0x155/0x160
      [   31.569084]  [<ffffffff8156c10a>] ubi_eba_write_leb+0x23a/0x870
      [   31.569628]  [<ffffffff81569b36>] vol_cdev_write+0x226/0x380
      [   31.570155]  [<ffffffff81179265>] vfs_write+0xb5/0x1f0
      [   31.570627]  [<ffffffff81179f8a>] SyS_pwrite64+0x6a/0xa0
      [   31.571123]  [<ffffffff818fde12>] system_call_fastpath+0x16/0x1b
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      
      (cherry picked from commit f38aed97)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      1a139e0e
    • Myron Stowe's avatar
      PCI: Restore detection of read-only BARs · d089df9e
      Myron Stowe authored
      Commit 6ac665c6 ("PCI: rewrite PCI BAR reading code") masked off
      low-order bits from 'l', but not from 'sz'.  Both are passed to pci_size(),
      which compares 'base == maxbase' to check for read-only BARs.  The masking
      of 'l' means that comparison will never be 'true', so the check for
      read-only BARs no longer works.
      
      Resolve this by also masking off the low-order bits of 'sz' before passing
      it into pci_size() as 'maxbase'.  With this change, pci_size() will once
      again catch the problems that have been encountered to date:
      
        - AGP aperture BAR of AMD-7xx host bridges: if the AGP window is
          disabled, this BAR is read-only and read as 0x00000008 [1]
      
        - BARs 0-4 of ALi IDE controllers can be non-zero and read-only [1]
      
        - Intel Sandy Bridge - Thermal Management Controller [8086:0103];
          BAR 0 returning 0xfed98004 [2]
      
        - Intel Xeon E5 v3/Core i7 Power Control Unit [8086:2fc0];
          Bar 0 returning 0x00001a [3]
      
      Link: [1] https://git.kernel.org/cgit/linux/kernel/git/tglx/history.git/commit/drivers/pci/probe.c?id=1307ef6621991f1c4bc3cec1b5a4ebd6fd3d66b9 ("PCI: probing read-only BARs" (pre-git))
      Link: [2] https://bugzilla.kernel.org/show_bug.cgi?id=43331
      Link: [3] https://bugzilla.kernel.org/show_bug.cgi?id=85991Reported-by: default avatarWilliam Unruh <unruh@physics.ubc.ca>
      Reported-by: default avatarMartin Lucina <martin@lucina.net>
      Signed-off-by: default avatarMyron Stowe <myron.stowe@redhat.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      CC: Matthew Wilcox <willy@linux.intel.com>
      CC: stable@vger.kernel.org	# v2.6.27+
      
      (cherry picked from commit 36e81648)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      d089df9e
    • Dmitry Tunin's avatar
      Bluetooth: ath3k: Add support of MCI 13d3:3408 bt device · 75b7515b
      Dmitry Tunin authored
      Add support for Bluetooth MCI WB335 (AR9565) Wi-Fi+bt module. This
      Bluetooth module requires loading patch and sysconfig by ath3k driver.
      
      T:  Bus=01 Lev=02 Prnt=03 Port=00 Cnt=01 Dev#= 20 Spd=12   MxCh= 0
      D:  Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=13d3 ProdID=3408 Rev= 0.02
      C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
      A:  FirstIf#= 0 IfCount= 2 Cls=e0(wlcon) Sub=01 Prot=01
      I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=1ms
      E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
      E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
      I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
      E:  Ad=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
      I:  If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=83(I) Atr=01(Isoc) MxPS=   9 Ivl=1ms
      E:  Ad=03(O) Atr=01(Isoc) MxPS=   9 Ivl=1ms
      I:  If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=83(I) Atr=01(Isoc) MxPS=  17 Ivl=1ms
      E:  Ad=03(O) Atr=01(Isoc) MxPS=  17 Ivl=1ms
      I:  If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=83(I) Atr=01(Isoc) MxPS=  25 Ivl=1ms
      E:  Ad=03(O) Atr=01(Isoc) MxPS=  25 Ivl=1ms
      I:  If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=83(I) Atr=01(Isoc) MxPS=  33 Ivl=1ms
      E:  Ad=03(O) Atr=01(Isoc) MxPS=  33 Ivl=1ms
      I:  If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=83(I) Atr=01(Isoc) MxPS=  49 Ivl=1ms
      E:  Ad=03(O) Atr=01(Isoc) MxPS=  49 Ivl=1ms
      Signed-off-by: default avatarDmitry Tunin <hanipouspilot@gmail.com>
      Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
      Cc: stable@vger.kernel.org
      
      (cherry picked from commit 3bb30a7c)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      75b7515b
    • Steven Rostedt (Red Hat)'s avatar
      ktest: Fix make_min_config to handle new assign_configs call · 22dfce24
      Steven Rostedt (Red Hat) authored
      Commit 6071c22e "ktest: Rewrite the config-bisect to actually work"
      fixed the config-bisect to work nicely but in doing so it broke
      make_min_config by changing the way assign_configs works.
      
      The assign_configs function now adds the config to the hash even if
      it is disabled, but changes the hash value to be that of the
      line "# CONFIG_FOO is not set". Unfortunately, the make_min_config
      test only checks to see if the config is removed. It now needs to
      check if the config is in the hash and not set to be disabled.
      
      Cc: stable@vger.kernel.org # 3.17+
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      
      (cherry picked from commit 9972fc0b)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      22dfce24
    • Andrew Jackson's avatar
      ASoC: dwc: Ensure FIFOs are flushed to prevent channel swap · 0033a6d3
      Andrew Jackson authored
      Flush the FIFOs when the stream is prepared for use.  This avoids
      an inadvertent swapping of the left/right channels if the FIFOs are
      not empty at startup.
      Signed-off-by: default avatarAndrew Jackson <Andrew.Jackson@arm.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Cc: stable@vger.kernel.org
      
      (cherry picked from commit 3475c3d0)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      0033a6d3
    • Lars-Peter Clausen's avatar
      ASoC: sigmadsp: Refuse to load firmware files with a non-supported version · f7970d7f
      Lars-Peter Clausen authored
      Make sure to check the version field of the firmware header to make sure to
      not accidentally try to parse a firmware file with a different layout.
      Trying to do so can result in loading invalid firmware code to the device.
      Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Cc: stable@vger.kernel.org
      
      (cherry picked from commit 50c0f21b)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      f7970d7f
    • Felix Fietkau's avatar
      ath5k: fix hardware queue index assignment · 2e563893
      Felix Fietkau authored
      Like with ath9k, ath5k queues also need to be ordered by priority.
      queue_info->tqi_subtype already contains the correct index, so use it
      instead of relying on the order of ath5k_hw_setup_tx_queue calls.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarFelix Fietkau <nbd@openwrt.org>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      
      (cherry picked from commit 9e4982f6)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      2e563893
    • Stefano Stabellini's avatar
      Revert "swiotlb-xen: pass dev_addr to swiotlb_tbl_unmap_single" · 263328fd
      Stefano Stabellini authored
      This reverts commit 2c3fc8d2.
      
      This commit broke on x86 PV because entries in the generic SWIOTLB are
      indexed using (pseudo-)physical address not DMA address and these are
      not the same in a x86 PV guest.
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      Reviewed-by: default avatarStefano Stabellini <stefano.stabellini@eu.citrix.com>
      
      Revert "swiotlb-xen: pass dev_addr to swiotlb_tbl_unmap_single"
      
      This reverts commit 2c3fc8d2.
      
      This commit broke on x86 PV because entries in the generic SWIOTLB are
      indexed using (pseudo-)physical address not DMA address and these are
      not the same in a x86 PV guest.
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      Reviewed-by: default avatarStefano Stabellini <stefano.stabellini@eu.citrix.com>
      
      xen: annotate xen_set_identity_and_remap_chunk() with __init
      
      Commit 5b8e7d80 removed the __init
      annotation from xen_set_identity_and_remap_chunk(). Add it again.
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      
      xen: introduce helper functions to do safe read and write accesses
      
      Introduce two helper functions to safely read and write unsigned long
      values from or to memory when the access may fault because the mapping
      is non-present or read-only.
      
      These helpers can be used instead of open coded uses of __get_user()
      and __put_user() avoiding the need to do casts to fix sparse warnings.
      
      Use the helpers in page.h and p2m.c. This will fix the sparse
      warnings when doing "make C=1".
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      
      xen: Speed up set_phys_to_machine() by using read-only mappings
      
      Instead of checking at each call of set_phys_to_machine() whether a
      new p2m page has to be allocated due to writing an entry in a large
      invalid or identity area, just map those areas read only and react
      to a page fault on write by allocating the new page.
      
      This change will make the common path with no allocation much
      faster as it only requires a single write of the new mfn instead
      of walking the address translation tables and checking for the
      special cases.
      Suggested-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Reviewed-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      Reviewed-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      
      xen: switch to linear virtual mapped sparse p2m list
      
      At start of the day the Xen hypervisor presents a contiguous mfn list
      to a pv-domain. In order to support sparse memory this mfn list is
      accessed via a three level p2m tree built early in the boot process.
      Whenever the system needs the mfn associated with a pfn this tree is
      used to find the mfn.
      
      Instead of using a software walked tree for accessing a specific mfn
      list entry this patch is creating a virtual address area for the
      entire possible mfn list including memory holes. The holes are
      covered by mapping a pre-defined  page consisting only of "invalid
      mfn" entries. Access to a mfn entry is possible by just using the
      virtual base address of the mfn list and the pfn as index into that
      list. This speeds up the (hot) path of determining the mfn of a
      pfn.
      
      Kernel build on a Dell Latitude E6440 (2 cores, HT) in 64 bit Dom0
      showed following improvements:
      
      Elapsed time: 32:50 ->  32:35
      System:       18:07 ->  17:47
      User:        104:00 -> 103:30
      
      Tested with following configurations:
      - 64 bit dom0, 8GB RAM
      - 64 bit dom0, 128 GB RAM, PCI-area above 4 GB
      - 32 bit domU, 512 MB, 8 GB, 43 GB (more wouldn't work even without
                                          the patch)
      - 32 bit domU, ballooning up and down
      - 32 bit domU, save and restore
      - 32 bit domU with PCI passthrough
      - 64 bit domU, 8 GB, 2049 MB, 5000 MB
      - 64 bit domU, ballooning up and down
      - 64 bit domU, save and restore
      - 64 bit domU with PCI passthrough
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      
      xen: Hide get_phys_to_machine() to be able to tune common path
      
      Today get_phys_to_machine() is always called when the mfn for a pfn
      is to be obtained. Add a wrapper __pfn_to_mfn() as inline function
      to be able to avoid calling get_phys_to_machine() when possible as
      soon as the switch to a linear mapped p2m list has been done.
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Reviewed-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      
      x86: Introduce function to get pmd entry pointer
      
      Introduces lookup_pmd_address() to get the address of the pmd entry
      related to a virtual address in the current address space. This
      function is needed for support of a virtual mapped sparse p2m list
      in xen pv domains, as we need the address of the pmd entry, not the
      one of the pte in that case.
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      
      xen: Delay invalidating extra memory
      
      When the physical memory configuration is initialized the p2m entries
      for not pouplated memory pages are set to "invalid". As those pages
      are beyond the hypervisor built p2m list the p2m tree has to be
      extended.
      
      This patch delays processing the extra memory related p2m entries
      during the boot process until some more basic memory management
      functions are callable. This removes the need to create new p2m
      entries until virtual memory management is available.
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Reviewed-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      
      xen: Delay m2p_override initialization
      
      The m2p overrides are used to be able to find the local pfn for a
      foreign mfn mapped into the domain. They are used by driver backends
      having to access frontend data.
      
      As this functionality isn't used in early boot it makes no sense to
      initialize the m2p override functions very early. It can be done
      later without doing any harm, removing the need for allocating memory
      via extend_brk().
      
      While at it make some m2p override functions static as they are only
      used internally.
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Reviewed-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      Reviewed-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      
      xen: Delay remapping memory of pv-domain
      
      Early in the boot process the memory layout of a pv-domain is changed
      to match the E820 map (either the host one for Dom0 or the Xen one)
      regarding placement of RAM and PCI holes. This requires removing memory
      pages initially located at positions not suitable for RAM and adding
      them later at higher addresses where no restrictions apply.
      
      To be able to operate on the hypervisor supported p2m list until a
      virtual mapped linear p2m list can be constructed, remapping must
      be delayed until virtual memory management is initialized, as the
      initial p2m list can't be extended unlimited at physical memory
      initialization time due to it's fixed structure.
      
      A further advantage is the reduction in complexity and code volume as
      we don't have to be careful regarding memory restrictions during p2m
      updates.
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Reviewed-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      
      xen: use common page allocation function in p2m.c
      
      In arch/x86/xen/p2m.c three different allocation functions for
      obtaining a memory page are used: extend_brk(), alloc_bootmem_align()
      or __get_free_page().  Which of those functions is used depends on the
      progress of the boot process of the system.
      
      Introduce a common allocation routine selecting the to be called
      allocation routine dynamically based on the boot progress. This allows
      moving initialization steps without having to care about changing
      allocation calls.
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      
      xen: Make functions static
      
      Some functions in arch/x86/xen/p2m.c are used locally only. Make them
      static. Rearrange the functions in p2m.c to avoid forward declarations.
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      
      xen: fix some style issues in p2m.c
      
      The source arch/x86/xen/p2m.c has some coding style issues. Fix them.
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      
      xen/pci: Use APIC directly when APIC virtualization hardware is available
      
      When hardware supports APIC/x2APIC virtualization we don't need to use
      pirqs for MSI handling and instead use APIC since most APIC accesses
      (MMIO or MSR) will now be processed without VMEXITs.
      
      As an example, netperf on the original code produces this profile
      (collected wih 'xentrace -e 0x0008ffff -T 5'):
      
          342 cpu_change
          260 CPUID
        34638 HLT
        64067 INJ_VIRQ
        28374 INTR
        82733 INTR_WINDOW
           10 NPF
        24337 TRAP
       370610 vlapic_accept_pic_intr
       307528 VMENTRY
       307527 VMEXIT
       140998 VMMCALL
          127 wrap_buffer
      
      After applying this patch the same test shows
      
          230 cpu_change
          260 CPUID
        36542 HLT
          174 INJ_VIRQ
        27250 INTR
          222 INTR_WINDOW
           20 NPF
        24999 TRAP
       381812 vlapic_accept_pic_intr
       166480 VMENTRY
       166479 VMEXIT
        77208 VMMCALL
           81 wrap_buffer
      
      ApacheBench results (ab -n 10000 -c 200) improve by about 10%
      Signed-off-by: default avatarBoris Ostrovsky <boris.ostrovsky@oracle.com>
      Reviewed-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Reviewed-by: default avatarAndrew Cooper <andrew.cooper3@citrix.com>
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      
      xen/pci: Defer initialization of MSI ops on HVM guests
      
      If the hardware supports APIC virtualization we may decide not to use
      pirqs and instead use APIC/x2APIC directly, meaning that we don't want
      to set x86_msi.setup_msi_irqs and x86_msi.teardown_msi_irq to
      Xen-specific routines.  However, x2APIC is not set up by the time
      pci_xen_hvm_init() is called so we need to postpone setting these ops
      until later, when we know which APIC mode is used.
      
      (Note that currently x2APIC is never initialized on HVM guests. This
      may change in the future)
      Signed-off-by: default avatarBoris Ostrovsky <boris.ostrovsky@oracle.com>
      Acked-by: default avatarStefano Stabellini <stefano.stabellini@eu.citrix.com>
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      
      xen-pciback: drop SR-IOV VFs when PF driver unloads
      
      When a PF driver unloads, it may find it necessary to leave the VFs
      around simply because of pciback having marked them as assigned to a
      guest. Utilize a suitable notification to let go of the VFs, thus
      allowing the PF to go back into the state it was before its driver
      loaded (which in particular allows the driver to be loaded again with
      it being able to create the VFs anew, but which also allows to then
      pass through the PF instead of the VFs).
      
      Don't do this however for any VFs currently in active use by a guest.
      Signed-off-by: default avatarJan Beulich <jbeulich@suse.com>
      [v2: Removed the switch statement, moved it about]
      [v3: Redid it a bit differently]
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      
      xen/pciback: Restore configuration space when detaching from a guest.
      
      The commit "xen/pciback: Don't deadlock when unbinding." was using
      the version of pci_reset_function which would lock the device lock.
      That is no good as we can dead-lock. As such we swapped to using
      the lock-less version and requiring that the callers
      of 'pcistub_put_pci_dev' take the device lock. And as such
      this bug got exposed.
      
      Using the lock-less version is  OK, except that we tried to
      use 'pci_restore_state' after the lock-less version of
      __pci_reset_function_locked - which won't work as 'state_saved'
      is set to false. Said 'state_saved' is a toggle boolean that
      is to be used by the sequence of a) pci_save_state/pci_restore_state
      or b) pci_load_and_free_saved_state/pci_restore_state. We don't
      want to use a) as the guest might have messed up the PCI
      configuration space and we want it to revert to the state
      when the PCI device was binded to us. Therefore we pick
      b) to restore the configuration space.
      
      We restore from our 'golden' version of PCI configuration space, when an:
       - Device is unbinded from pciback
       - Device is detached from a guest.
      Reported-by: default avatarSander Eikelenboom <linux@eikelenboom.it>
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      
      PCI: Expose pci_load_saved_state for public consumption.
      
      We have the pci_load_and_free_saved_state, and pci_store_saved_state
      but are missing the functionality to just load the state
      multiple times in the PCI device without having to free/save
      the state.
      
      This patch makes it possible to use this function.
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Acked-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      
      xen/pciback: Remove tons of dereferences
      
      A little cleanup. No functional difference.
      Reviewed-by: default avatarBoris Ostrovsky <boris.ostrovsky@oracle.com>
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      
      xen/pciback: Print out the domain owning the device.
      
      We had been printing it only if the device was built with
      debug enabled. But this information is useful in the field
      to troubleshoot.
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Reviewed-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      
      xen/pciback: Include the domain id if removing the device whilst still in use
      
      Cleanup the function a bit - also include the id of the
      domain that is using the device.
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Reviewed-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      
      driver core: Provide an wrapper around the mutex to do lockdep warnings
      
      Instead of open-coding it in drivers that want to double check
      that their functions are indeed holding the device lock.
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Suggested-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      
      xen/pciback: Don't deadlock when unbinding.
      
      As commit 0a9fd015
      'xen/pciback: Document the entry points for 'pcistub_put_pci_dev''
      explained there are four entry points in this function.
      Two of them are when the user fiddles in the SysFS to
      unbind a device which might be in use by a guest or not.
      
      Both 'unbind' states will cause a deadlock as the the PCI lock has
      already been taken, which then pci_device_reset tries to take.
      
      We can simplify this by requiring that all callers of
      pcistub_put_pci_dev MUST hold the device lock. And then
      we can just call the lockless version of pci_device_reset.
      
      To make it even simpler we will modify xen_pcibk_release_pci_dev
      to quality whether it should take a lock or not - as it ends
      up calling xen_pcibk_release_pci_dev and needs to hold the lock.
      Reviewed-by: default avatarBoris Ostrovsky <boris.ostrovsky@oracle.com>
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      
      swiotlb-xen: pass dev_addr to swiotlb_tbl_unmap_single
      
      Need to pass the pointer within the swiotlb internal buffer to the
      swiotlb library, that in the case of xen_unmap_single is dev_addr, not
      paddr.
      Signed-off-by: default avatarStefano Stabellini <stefano.stabellini@eu.citrix.com>
      Acked-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      CC: stable@vger.kernel.org
      
      (cherry picked from commit dbdd7476
      4ef8e3f3
      2c3fc8d2)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      263328fd
    • Stephane Grosjean's avatar
      can: peak_usb: fix memset() usage · 39d78677
      Stephane Grosjean authored
      This patchs fixes a misplaced call to memset() that fills the request
      buffer with 0. The problem was with sending PCAN_USBPRO_REQ_FCT
      requests, the content set by the caller was thus lost.
      
      With this patch, the memory area is zeroed only when requesting info
      from the device.
      Signed-off-by: default avatarStephane Grosjean <s.grosjean@peak-system.com>
      Cc: linux-stable <stable@vger.kernel.org>
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      
      (cherry picked from commit dc50ddcd)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      39d78677
    • Stephane Grosjean's avatar
      can: peak_usb: fix cleanup sequence order in case of error during init · 3ac3698a
      Stephane Grosjean authored
      This patch sets the correct reverse sequence order to the instructions
      set to run, when any failure occurs during the initialization steps.
      It also adds the missing unregistration call of the can device if the
      failure appears after having been registered.
      Signed-off-by: default avatarStephane Grosjean <s.grosjean@peak-system.com>
      Cc: linux-stable <stable@vger.kernel.org>
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      
      (cherry picked from commit af35d0f1)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      3ac3698a
    • Felix Fietkau's avatar
      ath9k: fix BE/BK queue order · 8ce86052
      Felix Fietkau authored
      Hardware queues are ordered by priority. Use queue index 0 for BK, which
      has lower priority than BE.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarFelix Fietkau <nbd@openwrt.org>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      
      (cherry picked from commit 78063d81)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      8ce86052
    • Felix Fietkau's avatar
      ath9k_hw: fix hardware queue allocation · 5bf04623
      Felix Fietkau authored
      The driver passes the desired hardware queue index for a WMM data queue
      in qinfo->tqi_subtype. This was ignored in ath9k_hw_setuptxqueue, which
      instead relied on the order in which the function is called.
      
      Cc: stable@vger.kernel.org
      Reported-by: default avatarHubert Feurstein <h.feurstein@gmail.com>
      Signed-off-by: default avatarFelix Fietkau <nbd@openwrt.org>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      
      (cherry picked from commit ad8fdccf)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      5bf04623
    • Junxiao Bi's avatar
      ocfs2: fix journal commit deadlock · c112ede6
      Junxiao Bi authored
      For buffer write, page lock will be got in write_begin and released in
      write_end, in ocfs2_write_end_nolock(), before it unlock the page in
      ocfs2_free_write_ctxt(), it calls ocfs2_run_deallocs(), this will ask
      for the read lock of journal->j_trans_barrier.  Holding page lock and
      ask for journal->j_trans_barrier breaks the locking order.
      
      This will cause a deadlock with journal commit threads, ocfs2cmt will
      get write lock of journal->j_trans_barrier first, then it wakes up
      kjournald2 to do the commit work, at last it waits until done.  To
      commit journal, kjournald2 needs flushing data first, it needs get the
      cache page lock.
      
      Since some ocfs2 cluster locks are holding by write process, this
      deadlock may hung the whole cluster.
      
      unlock pages before ocfs2_run_deallocs() can fix the locking order, also
      put unlock before ocfs2_commit_trans() to make page lock is unlocked
      before j_trans_barrier to preserve unlocking order.
      Signed-off-by: default avatarJunxiao Bi <junxiao.bi@oracle.com>
      Reviewed-by: default avatarWengang Wang <wen.gang.wang@oracle.com>
      Cc: <stable@vger.kernel.org>
      Reviewed-by: default avatarMark Fasheh <mfasheh@suse.de>
      Cc: Joel Becker <jlbec@evilplan.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      
      (cherry picked from commit 136f49b9)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      c112ede6
  2. 10 Jan, 2015 10 commits