1. 11 Aug, 2017 11 commits
    • Arend Van Spriel's avatar
      brcmfmac: fix memleak due to calling brcmf_sdiod_sgtable_alloc() twice · f0609ce4
      Arend Van Spriel authored
      commit 5f5d0314 upstream.
      
      Due to a bugfix in wireless tree and the commit mentioned below a merge
      was needed which went haywire. So the submitted change resulted in the
      function brcmf_sdiod_sgtable_alloc() being called twice during the probe
      thus leaking the memory of the first call.
      
      Fixes: 4d792895 ("brcmfmac: switch to new platform data")
      Reported-by: default avatarStefan Wahren <stefan.wahren@i2se.com>
      Tested-by: default avatarStefan Wahren <stefan.wahren@i2se.com>
      Reviewed-by: default avatarHante Meuleman <hante.meuleman@broadcom.com>
      Signed-off-by: default avatarArend van Spriel <arend.vanspriel@broadcom.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f0609ce4
    • Emmanuel Grumbach's avatar
      iwlwifi: dvm: prevent an out of bounds access · a36e7441
      Emmanuel Grumbach authored
      commit 0b0f934e upstream.
      
      iwlagn_check_ratid_empty takes the tid as a parameter, but
      it doesn't check that it is not IWL_TID_NON_QOS.
      Since IWL_TID_NON_QOS = 8 and iwl_priv::tid_data is an array
      with 8 entries, accessing iwl_priv::tid_data[IWL_TID_NON_QOS]
      is a bad idea.
      This happened in iwlagn_rx_reply_tx. Since
      iwlagn_check_ratid_empty is relevant only to check whether
      we can open A-MPDU, this flow is irrelevant if tid is
      IWL_TID_NON_QOS. Call iwlagn_check_ratid_empty only inside
      the
      	if (tid != IWL_TID_NON_QOS)
      
      a few lines earlier in the function.
      Reported-by: default avatarSeraphime Kirkovski <kirkseraph@gmail.com>
      Tested-by: default avatarSeraphime Kirkovski <kirkseraph@gmail.com>
      Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
      Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a36e7441
    • Tejun Heo's avatar
      workqueue: restore WQ_UNBOUND/max_active==1 to be ordered · 387b9187
      Tejun Heo authored
      commit 5c0338c6 upstream.
      
      The combination of WQ_UNBOUND and max_active == 1 used to imply
      ordered execution.  After NUMA affinity 4c16bd32 ("workqueue:
      implement NUMA affinity for unbound workqueues"), this is no longer
      true due to per-node worker pools.
      
      While the right way to create an ordered workqueue is
      alloc_ordered_workqueue(), the documentation has been misleading for a
      long time and people do use WQ_UNBOUND and max_active == 1 for ordered
      workqueues which can lead to subtle bugs which are very difficult to
      trigger.
      
      It's unlikely that we'd see noticeable performance impact by enforcing
      ordering on WQ_UNBOUND / max_active == 1 workqueues.  Let's
      automatically set __WQ_ORDERED for those workqueues.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Reported-by: default avatarChristoph Hellwig <hch@infradead.org>
      Reported-by: default avatarAlexei Potashnik <alexei@purestorage.com>
      Fixes: 4c16bd32 ("workqueue: implement NUMA affinity for unbound workqueues")
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      387b9187
    • Dan Carpenter's avatar
      libata: array underflow in ata_find_dev() · b1f866f1
      Dan Carpenter authored
      commit 59a5e266 upstream.
      
      My static checker complains that "devno" can be negative, meaning that
      we read before the start of the loop.  I've looked at the code, and I
      think the warning is right.  This come from /proc so it's root only or
      it would be quite a quite a serious bug.  The call tree looks like this:
      
      proc_scsi_write() <- gets id and channel from simple_strtoul()
      -> scsi_add_single_device() <- calls shost->transportt->user_scan()
         -> ata_scsi_user_scan()
            -> ata_find_dev()
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b1f866f1
    • Tejun Heo's avatar
      cgroup: fix error return value from cgroup_subtree_control() · d4f19715
      Tejun Heo authored
      commit 3c745417 upstream.
      
      While refactoring, f7b2814b ("cgroup: factor out
      cgroup_{apply|finalize}_control() from
      cgroup_subtree_control_write()") broke error return value from the
      function.  The return value from the last operation is always
      overridden to zero.  Fix it.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d4f19715
    • Tejun Heo's avatar
      cgroup: create dfl_root files on subsys registration · 7d453afc
      Tejun Heo authored
      commit 7af608e4 upstream.
      
      On subsystem registration, css_populate_dir() is not called on the new
      root css, so the interface files for the subsystem on cgrp_dfl_root
      aren't created on registration.  This is a residue from the days when
      cgrp_dfl_root was used only as the parking spot for unused subsystems,
      which no longer is true as it's used as the root for cgroup2.
      
      This is often fine as later operations tend to create them as a part
      of mount (cgroup1) or subtree_control operations (cgroup2); however,
      it's not difficult to mount cgroup2 with the controller interface
      files missing as Waiman found out.
      
      Fix it by invoking css_populate_dir() on the root css on subsys
      registration.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Reported-and-tested-by: default avatarWaiman Long <longman@redhat.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7d453afc
    • Tejun Heo's avatar
      cgroup: don't call migration methods if there are no tasks to migrate · 01563d03
      Tejun Heo authored
      commit 61046727 upstream.
      
      Subsystem migration methods shouldn't be called for empty migrations.
      cgroup_migrate_execute() implements this guarantee by bailing early if
      there are no source css_sets.  This used to be correct before
      a79a908f ("cgroup: introduce cgroup namespaces"), but no longer
      since the commit because css_sets can stay pinned without tasks in
      them.
      
      This caused cgroup_migrate_execute() call into cpuset migration
      methods with an empty cgroup_taskset.  cpuset migration methods
      correctly assume that cgroup_taskset_first() never returns NULL;
      however, due to the bug, it can, leading to the following oops.
      
        Unable to handle kernel paging request for data at address 0x00000960
        Faulting instruction address: 0xc0000000001d6868
        Oops: Kernel access of bad area, sig: 11 [#1]
        ...
        CPU: 14 PID: 16947 Comm: kworker/14:0 Tainted: G        W
        4.12.0-rc4-next-20170609 #2
        Workqueue: events cpuset_hotplug_workfn
        task: c00000000ca60580 task.stack: c00000000c728000
        NIP: c0000000001d6868 LR: c0000000001d6858 CTR: c0000000001d6810
        REGS: c00000000c72b720 TRAP: 0300   Tainted: GW (4.12.0-rc4-next-20170609)
        MSR: 8000000000009033 <SF,EE,ME,IR,DR,RI,LE>  CR: 44722422  XER: 20000000
        CFAR: c000000000008710 DAR: 0000000000000960 DSISR: 40000000 SOFTE: 1
        GPR00: c0000000001d6858 c00000000c72b9a0 c000000001536e00 0000000000000000
        GPR04: c00000000c72b9c0 0000000000000000 c00000000c72bad0 c000000766367678
        GPR08: c000000766366d10 c00000000c72b958 c000000001736e00 0000000000000000
        GPR12: c0000000001d6810 c00000000e749300 c000000000123ef8 c000000775af4180
        GPR16: 0000000000000000 0000000000000000 c00000075480e9c0 c00000075480e9e0
        GPR20: c00000075480e8c0 0000000000000001 0000000000000000 c00000000c72ba20
        GPR24: c00000000c72baa0 c00000000c72bac0 c000000001407248 c00000000c72ba20
        GPR28: c00000000141fc80 c00000000c72bac0 c00000000c6bc790 0000000000000000
        NIP [c0000000001d6868] cpuset_can_attach+0x58/0x1b0
        LR [c0000000001d6858] cpuset_can_attach+0x48/0x1b0
        Call Trace:
        [c00000000c72b9a0] [c0000000001d6858] cpuset_can_attach+0x48/0x1b0 (unreliable)
        [c00000000c72ba00] [c0000000001cbe80] cgroup_migrate_execute+0xb0/0x450
        [c00000000c72ba80] [c0000000001d3754] cgroup_transfer_tasks+0x1c4/0x360
        [c00000000c72bba0] [c0000000001d923c] cpuset_hotplug_workfn+0x86c/0xa20
        [c00000000c72bca0] [c00000000011aa44] process_one_work+0x1e4/0x580
        [c00000000c72bd30] [c00000000011ae78] worker_thread+0x98/0x5c0
        [c00000000c72bdc0] [c000000000124058] kthread+0x168/0x1b0
        [c00000000c72be30] [c00000000000b2e8] ret_from_kernel_thread+0x5c/0x74
        Instruction dump:
        f821ffa1 7c7d1b78 60000000 60000000 38810020 7fa3eb78 3f42ffed 4bff4c25
        60000000 3b5a0448 3d420020 eb610020 <e9230960> 7f43d378 e9290000 f92af200
        ---[ end trace dcaaf98fb36d9e64 ]---
      
      This patch fixes the bug by adding an explicit nr_tasks counter to
      cgroup_taskset and skipping calling the migration methods if the
      counter is zero.  While at it, remove the now spurious check on no
      source css_sets.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Reported-and-tested-by: default avatarAbdul Haleem <abdhalee@linux.vnet.ibm.com>
      Cc: Roman Gushchin <guro@fb.com>
      Fixes: a79a908f ("cgroup: introduce cgroup namespaces")
      Link: http://lkml.kernel.org/r/1497266622.15415.39.camel@abdul.in.ibm.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      01563d03
    • Hans de Goede's avatar
      ACPI / LPSS: Only call pwm_add_table() for the first PWM controller · e54f1632
      Hans de Goede authored
      commit dd242a08 upstream.
      
      At least on the UP board SBC both PWMs are enabled leading to us
      trying to add the same pwm_lookup twice, which leads to the following:
      
      [    0.902224] list_add double add: new=ffffffffb8efd400,
                     prev=ffffffffb8efd400, next=ffffffffb8eeede0.
      [    0.912466] ------------[ cut here ]------------
      [    0.917624] kernel BUG at lib/list_debug.c:31!
      [    0.922588] invalid opcode: 0000 [#1] SMP
      ...
      [    1.027450] Call Trace:
      [    1.030185]  pwm_add_table+0x4c/0x90
      [    1.034181]  bsw_pwm_setup+0x1a/0x20
      [    1.038175]  acpi_lpss_create_device+0xfe/0x420
      ...
      
      This commit fixes this by only calling pwm_add_table() for the first
      PWM controller (which is the one used for the backlight).
      
      Link: https://bugzilla.redhat.com/show_bug.cgi?id=1458599
      Fixes: bf7696a1 (acpi: lpss: call pwm_add_table() for BSW...)
      Fixes: 04434ab5 (ACPI / LPSS: Call pwm_add_table() for Bay Trail...)
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Acked-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e54f1632
    • Arnd Bergmann's avatar
      scsi: lpfc: fix linking against modular NVMe support · 49f4ca2f
      Arnd Bergmann authored
      commit cd069bb9 upstream.
      
      When LPFC is built-in but NVMe is a loadable module, we fail to link the
      kernel:
      
      drivers/scsi/built-in.o: In function `lpfc_nvme_create_localport':
      (.text+0x156a82): undefined reference to `nvme_fc_register_localport'
      drivers/scsi/built-in.o: In function `lpfc_nvme_destroy_localport':
      (.text+0x156eaa): undefined reference to `nvme_fc_unregister_remoteport'
      
      We can avoid this either by forcing lpfc to be a module, or by disabling
      NVMe support in this case. This implements the former.
      
      Fixes: 7d708033 ("scsi: lpfc: Finalize Kconfig options for nvme")
      Link: https://patchwork.kernel.org/patch/9636569/Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      49f4ca2f
    • John David Anglin's avatar
      parisc: Handle vma's whose context is not current in flush_cache_range · e7ed1b9d
      John David Anglin authored
      commit 13d57093 upstream.
      
      In testing James' patch to drivers/parisc/pdc_stable.c, I hit the BUG
      statement in flush_cache_range() during a system shutdown:
      
      kernel BUG at arch/parisc/kernel/cache.c:595!
      CPU: 2 PID: 6532 Comm: kworker/2:0 Not tainted 4.13.0-rc2+ #1
      Workqueue: events free_ioctx
      
       IAOQ[0]: flush_cache_range+0x144/0x148
       IAOQ[1]: flush_cache_page+0x0/0x1a8
       RP(r2): flush_cache_range+0xec/0x148
      Backtrace:
       [<00000000402910ac>] unmap_page_range+0x84/0x880
       [<00000000402918f4>] unmap_single_vma+0x4c/0x60
       [<0000000040291a18>] zap_page_range_single+0x110/0x160
       [<0000000040291c34>] unmap_mapping_range+0x174/0x1a8
       [<000000004026ccd8>] truncate_pagecache+0x50/0xa8
       [<000000004026cd84>] truncate_setsize+0x54/0x70
       [<000000004033d534>] put_aio_ring_file+0x44/0xb0
       [<000000004033d5d8>] aio_free_ring+0x38/0x140
       [<000000004033d714>] free_ioctx+0x34/0xa8
       [<00000000401b0028>] process_one_work+0x1b8/0x4d0
       [<00000000401b04f4>] worker_thread+0x1b4/0x648
       [<00000000401b9128>] kthread+0x1b0/0x208
       [<0000000040150020>] end_fault_vector+0x20/0x28
       [<0000000040639518>] nf_ip_reroute+0x50/0xa8
       [<0000000040638ed0>] nf_ip_route+0x10/0x78
       [<0000000040638c90>] xfrm4_mode_tunnel_input+0x180/0x1f8
      
      CPU: 2 PID: 6532 Comm: kworker/2:0 Not tainted 4.13.0-rc2+ #1
      Workqueue: events free_ioctx
      Backtrace:
       [<0000000040163bf0>] show_stack+0x20/0x38
       [<0000000040688480>] dump_stack+0xa8/0x120
       [<0000000040163dc4>] die_if_kernel+0x19c/0x2b0
       [<0000000040164d0c>] handle_interruption+0xa24/0xa48
      
      This patch modifies flush_cache_range() to handle non current contexts.
      In as much as this occurs infrequently, the simplest approach is to
      flush the entire cache when this happens.
      Signed-off-by: default avatarJohn David Anglin <dave.anglin@bell.net>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e7ed1b9d
    • Helge Deller's avatar
      parisc: Increase thread and stack size to 32kb · fea9ea4f
      Helge Deller authored
      commit 8f8201df upstream.
      
      Since kernel 4.11 the thread and irq stacks on parisc randomly overflow
      the default size of 16k. The reason why stack usage suddenly grew is yet
      unknown.
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fea9ea4f
  2. 06 Aug, 2017 29 commits