1. 01 Feb, 2016 40 commits
    • Zheng Liu's avatar
      bcache: unregister reboot notifier if bcache fails to unregister device · 322d0128
      Zheng Liu authored
      [ Upstream commit 2ecf0cdb ]
      
      In bcache_init() function it forgot to unregister reboot notifier if
      bcache fails to unregister a block device.  This commit fixes this.
      Signed-off-by: default avatarZheng Liu <wenqing.lz@taobao.com>
      Tested-by: default avatarJoshua Schmid <jschmid@suse.com>
      Tested-by: default avatarEric Wheeler <bcache@linux.ewheeler.net>
      Cc: Kent Overstreet <kmo@daterainc.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      322d0128
    • Al Viro's avatar
      bcache: fix a leak in bch_cached_dev_run() · 888841b4
      Al Viro authored
      [ Upstream commit 4d4d8573 ]
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Tested-by: default avatarJoshua Schmid <jschmid@suse.com>
      Tested-by: default avatarEric Wheeler <bcache@linux.ewheeler.net>
      Cc: Kent Overstreet <kmo@daterainc.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      888841b4
    • Zheng Liu's avatar
      bcache: clear BCACHE_DEV_UNLINK_DONE flag when attaching a backing device · 14dca898
      Zheng Liu authored
      [ Upstream commit fecaee6f ]
      
      This bug can be reproduced by the following script:
      
        #!/bin/bash
      
        bcache_sysfs="/sys/fs/bcache"
      
        function clear_cache()
        {
        	if [ ! -e $bcache_sysfs ]; then
        		echo "no bcache sysfs"
        		exit
        	fi
      
        	cset_uuid=$(ls -l $bcache_sysfs|head -n 2|tail -n 1|awk '{print $9}')
        	sudo sh -c "echo $cset_uuid > /sys/block/sdb/sdb1/bcache/detach"
        	sleep 5
        	sudo sh -c "echo $cset_uuid > /sys/block/sdb/sdb1/bcache/attach"
        }
      
        for ((i=0;i<10;i++)); do
        	clear_cache
        done
      
      The warning messages look like below:
      [  275.948611] ------------[ cut here ]------------
      [  275.963840] WARNING: at fs/sysfs/dir.c:512 sysfs_add_one+0xb8/0xd0() (Tainted: P        W
      ---------------   )
      [  275.979253] Hardware name: Tecal RH2285
      [  275.994106] sysfs: cannot create duplicate filename '/devices/pci0000:00/0000:00:09.0/0000:08:00.0/host4/target4:2:1/4:2:1:0/block/sdb/sdb1/bcache/cache'
      [  276.024105] Modules linked in: bcache tcp_diag inet_diag ipmi_devintf ipmi_si ipmi_msghandler
      bonding 8021q garp stp llc ipv6 ext3 jbd loop sg iomemory_vsl(P) bnx2 microcode serio_raw i2c_i801
      i2c_core iTCO_wdt iTCO_vendor_support i7core_edac edac_core shpchp ext4 jbd2 mbcache megaraid_sas
      pata_acpi ata_generic ata_piix dm_mod [last unloaded: scsi_wait_scan]
      [  276.072643] Pid: 2765, comm: sh Tainted: P        W  ---------------    2.6.32 #1
      [  276.089315] Call Trace:
      [  276.105801]  [<ffffffff81070fe7>] ? warn_slowpath_common+0x87/0xc0
      [  276.122650]  [<ffffffff810710d6>] ? warn_slowpath_fmt+0x46/0x50
      [  276.139361]  [<ffffffff81205c08>] ? sysfs_add_one+0xb8/0xd0
      [  276.156012]  [<ffffffff8120609b>] ? sysfs_do_create_link+0x12b/0x170
      [  276.172682]  [<ffffffff81206113>] ? sysfs_create_link+0x13/0x20
      [  276.189282]  [<ffffffffa03bda21>] ? bcache_device_link+0xc1/0x110 [bcache]
      [  276.205993]  [<ffffffffa03bfa08>] ? bch_cached_dev_attach+0x478/0x4f0 [bcache]
      [  276.222794]  [<ffffffffa03c4a17>] ? bch_cached_dev_store+0x627/0x780 [bcache]
      [  276.239680]  [<ffffffff8116783a>] ? alloc_pages_current+0xaa/0x110
      [  276.256594]  [<ffffffff81203b15>] ? sysfs_write_file+0xe5/0x170
      [  276.273364]  [<ffffffff811887b8>] ? vfs_write+0xb8/0x1a0
      [  276.290133]  [<ffffffff811890b1>] ? sys_write+0x51/0x90
      [  276.306368]  [<ffffffff8100c072>] ? system_call_fastpath+0x16/0x1b
      [  276.322301] ---[ end trace 9f5d4fcdd0c3edfb ]---
      [  276.338241] ------------[ cut here ]------------
      [  276.354109] WARNING: at /home/wenqing.lz/bcache/bcache/super.c:720
      bcache_device_link+0xdf/0x110 [bcache]() (Tainted: P        W  ---------------   )
      [  276.386017] Hardware name: Tecal RH2285
      [  276.401430] Couldn't create device <-> cache set symlinks
      [  276.401759] Modules linked in: bcache tcp_diag inet_diag ipmi_devintf ipmi_si ipmi_msghandler
      bonding 8021q garp stp llc ipv6 ext3 jbd loop sg iomemory_vsl(P) bnx2 microcode serio_raw i2c_i801
      i2c_core iTCO_wdt iTCO_vendor_support i7core_edac edac_core shpchp ext4 jbd2 mbcache megaraid_sas
      pata_acpi ata_generic ata_piix dm_mod [last unloaded: scsi_wait_scan]
      [  276.465477] Pid: 2765, comm: sh Tainted: P        W  ---------------    2.6.32 #1
      [  276.482169] Call Trace:
      [  276.498610]  [<ffffffff81070fe7>] ? warn_slowpath_common+0x87/0xc0
      [  276.515405]  [<ffffffff810710d6>] ? warn_slowpath_fmt+0x46/0x50
      [  276.532059]  [<ffffffffa03bda3f>] ? bcache_device_link+0xdf/0x110 [bcache]
      [  276.548808]  [<ffffffffa03bfa08>] ? bch_cached_dev_attach+0x478/0x4f0 [bcache]
      [  276.565569]  [<ffffffffa03c4a17>] ? bch_cached_dev_store+0x627/0x780 [bcache]
      [  276.582418]  [<ffffffff8116783a>] ? alloc_pages_current+0xaa/0x110
      [  276.599341]  [<ffffffff81203b15>] ? sysfs_write_file+0xe5/0x170
      [  276.616142]  [<ffffffff811887b8>] ? vfs_write+0xb8/0x1a0
      [  276.632607]  [<ffffffff811890b1>] ? sys_write+0x51/0x90
      [  276.648671]  [<ffffffff8100c072>] ? system_call_fastpath+0x16/0x1b
      [  276.664756] ---[ end trace 9f5d4fcdd0c3edfc ]---
      
      We forget to clear BCACHE_DEV_UNLINK_DONE flag in bcache_device_attach()
      function when we attach a backing device first time.  After detaching this
      backing device, this flag will be true and sysfs_remove_link() isn't called in
      bcache_device_unlink().  Then when we attach this backing device again,
      sysfs_create_link() will return EEXIST error in bcache_device_link().
      
      So the fix is trival and we clear this flag in bcache_device_link().
      Signed-off-by: default avatarZheng Liu <wenqing.lz@taobao.com>
      Tested-by: default avatarJoshua Schmid <jschmid@suse.com>
      Tested-by: default avatarEric Wheeler <bcache@linux.ewheeler.net>
      Cc: Kent Overstreet <kmo@daterainc.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      14dca898
    • Kent Overstreet's avatar
      bcache: Add a cond_resched() call to gc · 08656518
      Kent Overstreet authored
      [ Upstream commit c5f1e5ad ]
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Tested-by: default avatarEric Wheeler <bcache@linux.ewheeler.net>
      Cc: Kent Overstreet <kmo@daterainc.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      08656518
    • Zheng Liu's avatar
      bcache: fix a livelock when we cause a huge number of cache misses · c5056389
      Zheng Liu authored
      [ Upstream commit 2ef9ccbf ]
      
      Subject :	[PATCH v2] bcache: fix a livelock in btree lock
      Date :	Wed, 25 Feb 2015 20:32:09 +0800 (02/25/2015 04:32:09 AM)
      
      This commit tries to fix a livelock in bcache.  This livelock might
      happen when we causes a huge number of cache misses simultaneously.
      
      When we get a cache miss, bcache will execute the following path.
      
      ->cached_dev_make_request()
        ->cached_dev_read()
          ->cached_lookup()
            ->bch->btree_map_keys()
              ->btree_root()  <------------------------
                ->bch_btree_map_keys_recurse()        |
                  ->cache_lookup_fn()                 |
                    ->cached_dev_cache_miss()         |
                      ->bch_btree_insert_check_key() -|
                        [If btree->seq is not equal to seq + 1, we should return
                         EINTR and traverse btree again.]
      
      In bch_btree_insert_check_key() function we first need to check upgrade
      flag (op->lock == -1), and when this flag is true we need to release
      read btree->lock and try to take write btree->lock.  During taking and
      releasing this write lock, btree->seq will be monotone increased in
      order to prevent other threads modify this in cache miss (see btree.h:74).
      But if there are some cache misses caused by some requested, we could
      meet a livelock because btree->seq is always changed by others.  Thus no
      one can make progress.
      
      This commit will try to take write btree->lock if it encounters a race
      when we traverse btree.  Although it sacrifice the scalability but we
      can ensure that only one can modify the btree.
      Signed-off-by: default avatarZheng Liu <wenqing.lz@taobao.com>
      Tested-by: default avatarJoshua Schmid <jschmid@suse.com>
      Tested-by: default avatarEric Wheeler <bcache@linux.ewheeler.net>
      Cc: Joshua Schmid <jschmid@suse.com>
      Cc: Zhu Yanhai <zhu.yanhai@gmail.com>
      Cc: Kent Overstreet <kmo@daterainc.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      c5056389
    • Larry Finger's avatar
      rtlwifi: rtl_pci: Fix kernel panic · e96bbdf8
      Larry Finger authored
      [ Upstream commit f99551a2 ]
      
      In commit 38506ece (rtlwifi: rtl_pci: Start modification for new
      drivers), a bug was introduced that causes a NULL pointer dereference.
      As this bug only affects the infrequently used RTL8192EE and only under
      low-memory conditions, it has taken a long time for the bug to show up.
      
      The bug was reported on the linux-wireless mailing list and also at
      https://bugs.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/ as
      bug #1527603 (kernel crashes due to rtl8192ee driver on ubuntu 15.10).
      
      Fixes: 38506ece ("rtlwifi: rtl_pci: Start modification for new drivers")
      Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
      Cc: Stable <stable@vger.kernel.org>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      e96bbdf8
    • Trond Myklebust's avatar
      NFS: Fix attribute cache revalidation · 8572f2fa
      Trond Myklebust authored
      [ Upstream commit ade14a7d ]
      
      If a NFSv4 client uses the cache_consistency_bitmask in order to
      request only information about the change attribute, timestamps and
      size, then it has not revalidated all attributes, and hence the
      attribute timeout timestamp should not be updated.
      Reported-by: default avatarDonald Buczek <buczek@molgen.mpg.de>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      8572f2fa
    • Trond Myklebust's avatar
      NFS: Remove the "NFS_CAP_CHANGE_ATTR" capability · 226864af
      Trond Myklebust authored
      [ Upstream commit cd812599 ]
      
      Setting the change attribute has been mandatory for all NFS versions, since
      commit 3a1556e8 ("NFSv2/v3: Simulate the change attribute"). We should
      therefore not have anything be conditional on it being set/unset.
      Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      226864af
    • Larry Finger's avatar
      rtlwifi: rtl8192cu: Add missing parameter setup · de944618
      Larry Finger authored
      [ Upstream commit b68d0ae7 ]
      
      This driver fails to copy the module parameter for software encryption
      to the locations used by the main code.
      Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
      Cc: Stable <stable@vger.kernel.org>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      de944618
    • Larry Finger's avatar
      rtlwifi: rtl8192ce: Fix handling of module parameters · 0375ae54
      Larry Finger authored
      [ Upstream commit b24f19f1 ]
      
      The module parameter for software encryption was never transferred to
      the location used by the driver.
      Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
      Cc: Stable <stable@vger.kernel.org>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      0375ae54
    • Larry Finger's avatar
      rtlwifi: rtl8192se: Fix module parameter initialization · 214e5cc6
      Larry Finger authored
      [ Upstream commit 7503efbd ]
      
      Two of the module parameter descriptions show incorrect default values.
      In addition the value for software encryption is not transferred to
      the locations used by the driver.
      Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
      Cc: Stable <stable@vger.kernel.org>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      214e5cc6
    • Larry Finger's avatar
      rtlwifi: rtl8192de: Fix incorrect module parameter descriptions · 1a37aece
      Larry Finger authored
      [ Upstream commit d4d60b4c ]
      
      Two of the module parameters are listed with incorrect default values.
      Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
      Cc: Stable <stable@vger.kernel.org>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      1a37aece
    • Larry Finger's avatar
      rtlwifi: rtl8188ee: Fix module parameter initialization · 07493d2c
      Larry Finger authored
      [ Upstream commit 06f34572 ]
      
      In this driver, parameters disable_watchdog and sw_crypto are never
      copied into the locations used in the main code. While modifying the
      parameter handling, the copying of parameter msi_support is moved to
      be with the rest.
      Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
      Cc: Stable <stable@vger.kernel.org>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      07493d2c
    • Richard Cochran's avatar
      posix-clock: Fix return code on the poll method's error path · 35de2936
      Richard Cochran authored
      [ Upstream commit 1b9f2372 ]
      
      The posix_clock_poll function is supposed to return a bit mask of
      POLLxxx values.  However, in case the hardware has disappeared (due to
      hot plugging for example) this code returns -ENODEV in a futile
      attempt to throw an error at the file descriptor level.  The kernel's
      file_operations interface does not accept such error codes from the
      poll method.  Instead, this function aught to return POLLERR.
      
      The value -ENODEV does, in fact, contain the POLLERR bit (and almost
      all the other POLLxxx bits as well), but only by chance.  This patch
      fixes code to return a proper bit mask.
      
      Credit goes to Markus Elfring for pointing out the suspicious
      signed/unsigned mismatch.
      Reported-by: default avatarMarkus Elfring <elfring@users.sourceforge.net>
      igned-off-by: default avatarRichard Cochran <richardcochran@gmail.com>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: Julia Lawall <julia.lawall@lip6.fr>
      Link: http://lkml.kernel.org/r/1450819198-17420-1-git-send-email-richardcochran@gmail.com
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      35de2936
    • Chen Yu's avatar
      Thermal: do thermal zone update after a cooling device registered · bdfc34b6
      Chen Yu authored
      [ Upstream commit 4511f716 ]
      
      When a new cooling device is registered, we need to update the
      thermal zone to set the new registered cooling device to a proper
      state.
      
      This fixes a problem that the system is cool, while the fan devices
      are left running on full speed after boot, if fan device is registered
      after thermal zone device.
      
      Here is the history of why current patch looks like this:
      https://patchwork.kernel.org/patch/7273041/
      
      CC: <stable@vger.kernel.org> #3.18+
      Reference:https://bugzilla.kernel.org/show_bug.cgi?id=92431Tested-by: default avatarManuel Krause <manuelkrause@netscape.net>
      Tested-by: default avatarszegad <szegadlo@poczta.onet.pl>
      Tested-by: default avatarprash <prash.n.rao@gmail.com>
      Tested-by: default avataramish <ammdispose-arch@yahoo.com>
      Reviewed-by: default avatarJavi Merino <javi.merino@arm.com>
      Signed-off-by: default avatarZhang Rui <rui.zhang@intel.com>
      Signed-off-by: default avatarChen Yu <yu.c.chen@intel.com>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      bdfc34b6
    • Zhang Rui's avatar
      Thermal: handle thermal zone device properly during system sleep · ab482769
      Zhang Rui authored
      [ Upstream commit ff140fea ]
      
      Current thermal code does not handle system sleep well because
      1. the cooling device cooling state may be changed during suspend
      2. the previous temperature reading becomes invalid after resumed because
         it is got before system sleep
      3. updating thermal zone device during suspending/resuming
         is wrong because some devices may have already been suspended
         or may have not been resumed.
      
      Thus, the proper way to do this is to cancel all thermal zone
      device update requirements during suspend/resume, and after all
      the devices have been resumed, reset and update every registered
      thermal zone devices.
      
      This also fixes a regression introduced by:
      Commit 19593a1f ("ACPI / fan: convert to platform driver")
      Because, with above commit applied, all the fan devices are attached
      to the acpi_general_pm_domain, and they are turned on by the pm_domain
      automatically after resume, without the awareness of thermal core.
      
      CC: <stable@vger.kernel.org> #3.18+
      Reference: https://bugzilla.kernel.org/show_bug.cgi?id=78201
      Reference: https://bugzilla.kernel.org/show_bug.cgi?id=91411Tested-by: default avatarManuel Krause <manuelkrause@netscape.net>
      Tested-by: default avatarszegad <szegadlo@poczta.onet.pl>
      Tested-by: default avatarprash <prash.n.rao@gmail.com>
      Tested-by: default avataramish <ammdispose-arch@yahoo.com>
      Tested-by: default avatarMatthias <morpheusxyz123@yahoo.de>
      Reviewed-by: default avatarJavi Merino <javi.merino@arm.com>
      Signed-off-by: default avatarZhang Rui <rui.zhang@intel.com>
      Signed-off-by: default avatarChen Yu <yu.c.chen@intel.com>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      ab482769
    • Zhang Rui's avatar
      Thermal: initialize thermal zone device correctly · 247d4030
      Zhang Rui authored
      [ Upstream commit bb431ba2 ]
      
      After thermal zone device registered, as we have not read any
      temperature before, thus tz->temperature should not be 0,
      which actually means 0C, and thermal trend is not available.
      In this case, we need specially handling for the first
      thermal_zone_device_update().
      
      Both thermal core framework and step_wise governor is
      enhanced to handle this. And since the step_wise governor
      is the only one that uses trends, so it's the only thermal
      governor that needs to be updated.
      
      CC: <stable@vger.kernel.org> #3.18+
      Tested-by: default avatarManuel Krause <manuelkrause@netscape.net>
      Tested-by: default avatarszegad <szegadlo@poczta.onet.pl>
      Tested-by: default avatarprash <prash.n.rao@gmail.com>
      Tested-by: default avataramish <ammdispose-arch@yahoo.com>
      Tested-by: default avatarMatthias <morpheusxyz123@yahoo.de>
      Reviewed-by: default avatarJavi Merino <javi.merino@arm.com>
      Signed-off-by: default avatarZhang Rui <rui.zhang@intel.com>
      Signed-off-by: default avatarChen Yu <yu.c.chen@intel.com>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      247d4030
    • Andrew Elble's avatar
      nfs: Fix race in __update_open_stateid() · 40b7566c
      Andrew Elble authored
      [ Upstream commit 361cad3c ]
      
      We've seen this in a packet capture - I've intermixed what I
      think was going on. The fix here is to grab the so_lock sooner.
      
      1964379 -> #1 open (for write) reply seqid=1
      1964393 -> #2 open (for read) reply seqid=2
      
        __nfs4_close(), state->n_wronly--
        nfs4_state_set_mode_locked(), changes state->state = [R]
        state->flags is [RW]
        state->state is [R], state->n_wronly == 0, state->n_rdonly == 1
      
      1964398 -> #3 open (for write) call -> because close is already running
      1964399 -> downgrade (to read) call seqid=2 (close of #1)
      1964402 -> #3 open (for write) reply seqid=3
      
       __update_open_stateid()
         nfs_set_open_stateid_locked(), changes state->flags
         state->flags is [RW]
         state->state is [R], state->n_wronly == 0, state->n_rdonly == 1
         new sequence number is exposed now via nfs4_stateid_copy()
      
         next step would be update_open_stateflags(), pending so_lock
      
      1964403 -> downgrade reply seqid=2, fails with OLD_STATEID (close of #1)
      
         nfs4_close_prepare() gets so_lock and recalcs flags -> send close
      
      1964405 -> downgrade (to read) call seqid=3 (close of #1 retry)
      
         __update_open_stateid() gets so_lock
       * update_open_stateflags() updates state->n_wronly.
         nfs4_state_set_mode_locked() updates state->state
      
         state->flags is [RW]
         state->state is [RW], state->n_wronly == 1, state->n_rdonly == 1
      
       * should have suppressed the preceding nfs4_close_prepare() from
         sending open_downgrade
      
      1964406 -> write call
      1964408 -> downgrade (to read) reply seqid=4 (close of #1 retry)
      
         nfs_clear_open_stateid_locked()
         state->flags is [R]
         state->state is [RW], state->n_wronly == 1, state->n_rdonly == 1
      
      1964409 -> write reply (fails, openmode)
      Signed-off-by: default avatarAndrew Elble <aweits@rit.edu>
      Cc: stable@vger,kernel.org
      Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      40b7566c
    • Chen-Yu Tsai's avatar
      [media] rc: sunxi-cir: Initialize the spinlock properly · 33c7c20d
      Chen-Yu Tsai authored
      [ Upstream commit 768acf46 ]
      
      The driver allocates the spinlock but fails to initialize it correctly.
      The kernel reports a BUG indicating bad spinlock magic when spinlock
      debugging is enabled.
      
      Call spin_lock_init() on it to initialize it correctly.
      
      Fixes: b4e3e59f ("[media] rc: add sunxi-ir driver")
      Signed-off-by: default avatarChen-Yu Tsai <wens@csie.org>
      Acked-by: default avatarHans de Goede <hdegoede@redhat.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      33c7c20d
    • Vegard Nossum's avatar
      udf: limit the maximum number of indirect extents in a row · 4476dc67
      Vegard Nossum authored
      [ Upstream commit b0918d9f ]
      
      udf_next_aext() just follows extent pointers while extents are marked as
      indirect. This can loop forever for corrupted filesystem. Limit number
      the of indirect extents we are willing to follow in a row.
      
      [JK: Updated changelog, limit, style]
      Signed-off-by: default avatarVegard Nossum <vegard.nossum@oracle.com>
      Cc: stable@vger.kernel.org
      Cc: Jan Kara <jack@suse.com>
      Cc: Quentin Casasnovas <quentin.casasnovas@oracle.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      4476dc67
    • Adrian Hunter's avatar
      mmc: sdhci: Fix sdhci_runtime_pm_bus_on/off() · a2da01ce
      Adrian Hunter authored
      [ Upstream commit 5c671c41 ]
      
      sdhci has a legacy facility to prevent runtime suspend if the
      bus power is on.  This is needed in cases where the power to
      the card is dependent on the bus power.  It is controlled by
      a pair of functions: sdhci_runtime_pm_bus_on() and
      sdhci_runtime_pm_bus_off().  These functions use a boolean
      variable 'bus_on' to ensure changes are always paired.
      There is an additional check for 'runtime_suspended' which is
      the problem.  In fact, its use is ill-conceived as the only
      requirement for the logic is that 'on' and 'off' are paired,
      which is actually broken by the check, for example if the bus
      power is turned on during runtime resume.  So remove  the check.
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: stable@vger.kernel.org # v3.11+
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      a2da01ce
    • Adrian Hunter's avatar
      mmc: sdhci: Fix DMA descriptor with zero data length · b0aed82c
      Adrian Hunter authored
      [ Upstream commit 347ea32d ]
      
      SDHCI has built-in DMA called ADMA2.  ADMA2 uses a descriptor
      table to define DMA scatter-gather.  Each desciptor can specify
      a data length up to 65536 bytes, however the length field is
      only 16-bits so zero means 65536.  Consequently, putting zero
      when the size is zero must not be allowed.  This patch fixes
      one case where zero data length could be set inadvertently.
      
      The problem happens because unaligned data gets split and the
      code did not consider that the remaining aligned portion might
      be zero length.  That case really only happens for SDIO because
      SD and eMMC cards transfer blocks that are invariably sector-
      aligned.  For SDIO, access to function registers is done by
      data transfer (CMD53) when the register is bigger than 1 byte.
      Generally registers are 4 bytes but 2-byte registers are possible.
      So DMA of 4 bytes or less can happen.  When 32-bit DMA is used,
      the data alignment must be 4, so 4-byte transfers won't casue a
      problem, but a 2-byte transfer could.  However with the introduction
      of 64-bit DMA, the data alignment for 64-bit DMA was made 8 bytes,
      so all 4-byte transfers not on 8-byte boundaries get "split" into
      a 4-byte chunk and a 0-byte chunk, thereby hitting the bug.
      
      In fact, a closer look at the SDHCI specs indicates that only the
      descriptor table requires 8-byte alignment for 64-bit DMA.  That
      will be dealt with in a separate patch, but the potential for a
      2-byte access remains, so this fix is needed anyway.
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: stable@vger.kernel.org # v3.19+
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      b0aed82c
    • Adrian Hunter's avatar
      mmc: sdio: Fix invalid vdd in voltage switch power cycle · e6cbcb00
      Adrian Hunter authored
      [ Upstream commit d9bfbb95 ]
      
      The 'ocr' parameter passed to mmc_set_signal_voltage()
      defines the power-on voltage used when power cycling
      after a failure to set the voltage.  However, in the
      case of mmc_sdio_init_card(), the value passed has the
      R4_18V_PRESENT flag set which is not valid for power-on
      and results in an invalid vdd.  Fix by passing the card's
      ocr value which does not have the flag.
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: stable@vger.kernel.org # v3.13+
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      e6cbcb00
    • Alex Deucher's avatar
      drm/radeon: clean up fujitsu quirks · 86062e98
      Alex Deucher authored
      [ Upstream commit 0eb1c3d4 ]
      
      Combine the two quirks.
      
      bug:
      https://bugzilla.kernel.org/show_bug.cgi?id=109481Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      86062e98
    • Felix Kuehling's avatar
      drm/radeon: Fix off-by-one errors in radeon_vm_bo_set_addr · 47062c9c
      Felix Kuehling authored
      [ Upstream commit 42ef344c ]
      
      eoffset is sometimes treated as the last address inside the address
      range, and sometimes as the first address outside the range. This
      was resulting in errors when a test filled up the entire address
      space. Make it consistent to always be the last address within the
      range. Also fixed related errors when checking the VA limit and in
      radeon_vm_fence_pts.
      Signed-off-by: default avatarFelix.Kuehling <Felix.Kuehling@amd.com>
      Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      47062c9c
    • Mathieu Poirier's avatar
      coresight: checking for NULL string in coresight_name_match() · dc25a0a0
      Mathieu Poirier authored
      [ Upstream commit fadf3a44 ]
      
      Connection child names associated to ports can sometimes be NULL,
      which is the case when booting a system on QEMU or when the Coresight
      power domain isn't switched on.
      
      This patch is adding a check to make sure a NULL string isn't fed
      to strcmp(), something that avoid crashing the system.
      
      Cc: <stable@vger.kernel.org> # v3.18+
      Reported-by: default avatarTyler Baker <tyler.baker@linaro.org>
      Signed-off-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      dc25a0a0
    • Lorenzo Pieralisi's avatar
      arm64: kernel: enforce pmuserenr_el0 initialization and restore · 5de8e1ee
      Lorenzo Pieralisi authored
      [ Upstream commit d2d39a3b ]
      
      commit 60792ad3 upstream.
      
      The pmuserenr_el0 register value is architecturally UNKNOWN on reset.
      Current kernel code resets that register value iff the core pmu device is
      correctly probed in the kernel. On platforms with missing DT pmu nodes (or
      disabled perf events in the kernel), the pmu is not probed, therefore the
      pmuserenr_el0 register is not reset in the kernel, which means that its
      value retains the reset value that is architecturally UNKNOWN (system
      may run with eg pmuserenr_el0 == 0x1, which means that PMU counters access
      is available at EL0, which must be disallowed).
      
      This patch adds code that resets pmuserenr_el0 on cold boot and restores
      it on core resume from shutdown, so that the pmuserenr_el0 setup is
      always enforced in the kernel.
      
      Cc: Mark Rutland <mark.rutland@arm.com>
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      5de8e1ee
    • Will Deacon's avatar
      arm64: mdscr_el1: avoid exposing DCC to userspace · 1d4c4251
      Will Deacon authored
      [ Upstream commit d8d23fa0 ]
      
      We don't want to expose the DCC to userspace, particularly as there is
      a kernel console driver for it.
      
      This patch resets mdscr_el1 to disable userspace access to the DCC
      registers on the cold boot path.
      Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      1d4c4251
    • Thomas Gleixner's avatar
      futex: Drop refcount if requeue_pi() acquired the rtmutex · e70aade2
      Thomas Gleixner authored
      [ Upstream commit fb75a428 ]
      
      If the proxy lock in the requeue loop acquires the rtmutex for a
      waiter then it acquired also refcount on the pi_state related to the
      futex, but the waiter side does not drop the reference count.
      
      Add the missing free_pi_state() call.
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Darren Hart <darren@dvhart.com>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Bhuvanesh_Surachari@mentor.com
      Cc: Andy Lowe <Andy_Lowe@mentor.com>
      Link: http://lkml.kernel.org/r/20151219200607.178132067@linutronix.deSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      e70aade2
    • Slava Grigorev's avatar
      drm/radeon: Fix "slow" audio over DP on DCE8+ · 51697d5f
      Slava Grigorev authored
      [ Upstream commit ac4a9350 ]
      
      DP audio is derived from the dfs clock.
      Signed-off-by: default avatarSlava Grigorev <slava.grigorev@amd.com>
      Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      51697d5f
    • Nikolay Borisov's avatar
      dm thin: fix race condition when destroying thin pool workqueue · 9e612a00
      Nikolay Borisov authored
      [ Upstream commit 18d03e8c ]
      
      When a thin pool is being destroyed delayed work items are
      cancelled using cancel_delayed_work(), which doesn't guarantee that on
      return the delayed item isn't running.  This can cause the work item to
      requeue itself on an already destroyed workqueue.  Fix this by using
      cancel_delayed_work_sync() which guarantees that on return the work item
      is not running anymore.
      
      Fixes: 905e51b3 ("dm thin: commit outstanding data every second")
      Fixes: 85ad643b ("dm thin: add timeout to stop out-of-data-space mode holding IO forever")
      Signed-off-by: default avatarNikolay Borisov <kernel@kyup.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      9e612a00
    • Will Deacon's avatar
      iommu/io-pgtable-arm: Ensure we free the final level on teardown · bf0a6a9a
      Will Deacon authored
      [ Upstream commit 12c2ab09 ]
      
      When tearing down page tables, we return early for the final level
      since we know that we won't have any table pointers to follow.
      Unfortunately, this also means that we forget to free the final level,
      so we end up leaking memory.
      
      Fix the issue by always freeing the current level, but just don't bother
      to iterate over the ptes if we're at the final level.
      
      Cc: <stable@vger.kernel.org>
      Reported-by: default avatarZhang Bo <zhangbo_a@xiaomi.com>
      Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      bf0a6a9a
    • Borislav Petkov's avatar
      EDAC: Robustify workqueues destruction · 94fde0ab
      Borislav Petkov authored
      [ Upstream commit fcd5c4dd ]
      
      EDAC workqueue destruction is really fragile. We cancel delayed work
      but if it is still running and requeues itself, we still go ahead and
      destroy the workqueue and the queued work explodes when workqueue core
      attempts to run it.
      
      Make the destruction more robust by switching op_state to offline so
      that requeuing stops. Cancel any pending work *synchronously* too.
      
        EDAC i7core: Driver loaded.
        general protection fault: 0000 [#1] SMP
        CPU 12
        Modules linked in:
        Supported: Yes
        Pid: 0, comm: kworker/0:1 Tainted: G          IE   3.0.101-0-default #1 HP ProLiant DL380 G7
        RIP: 0010:[<ffffffff8107dcd7>]  [<ffffffff8107dcd7>] __queue_work+0x17/0x3f0
        < ... regs ...>
        Process kworker/0:1 (pid: 0, threadinfo ffff88019def6000, task ffff88019def4600)
        Stack:
         ...
        Call Trace:
         call_timer_fn
         run_timer_softirq
         __do_softirq
         call_softirq
         do_softirq
         irq_exit
         smp_apic_timer_interrupt
         apic_timer_interrupt
         intel_idle
         cpuidle_idle_call
         cpu_idle
        Code: ...
        RIP  __queue_work
         RSP <...>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      94fde0ab
    • Borislav Petkov's avatar
      EDAC, mc_sysfs: Fix freeing bus' name · eddf977a
      Borislav Petkov authored
      [ Upstream commit 12e26969 ]
      
      I get the splat below when modprobing/rmmoding EDAC drivers. It happens
      because bus->name is invalid after bus_unregister() has run. The Code: section
      below corresponds to:
      
        .loc 1 1108 0
        movq    672(%rbx), %rax # mci_1(D)->bus, mci_1(D)->bus
        .loc 1 1109 0
        popq    %rbx    #
      
        .loc 1 1108 0
        movq    (%rax), %rdi    # _7->name,
        jmp     kfree   #
      
      and %rax has some funky stuff 2030203020312030 which looks a lot like
      something walked over it.
      
      Fix that by saving the name ptr before doing stuff to string it points to.
      
        general protection fault: 0000 [#1] SMP
        Modules linked in: ...
        CPU: 4 PID: 10318 Comm: modprobe Tainted: G          I EN  3.12.51-11-default+ #48
        Hardware name: HP ProLiant DL380 G7, BIOS P67 05/05/2011
        task: ffff880311320280 ti: ffff88030da3e000 task.ti: ffff88030da3e000
        RIP: 0010:[<ffffffffa019da92>]  [<ffffffffa019da92>] edac_unregister_sysfs+0x22/0x30 [edac_core]
        RSP: 0018:ffff88030da3fe28  EFLAGS: 00010292
        RAX: 2030203020312030 RBX: ffff880311b4e000 RCX: 000000000000095c
        RDX: 0000000000000001 RSI: ffff880327bb9600 RDI: 0000000000000286
        RBP: ffff880311b4e750 R08: 0000000000000000 R09: ffffffff81296110
        R10: 0000000000000400 R11: 0000000000000000 R12: ffff88030ba1ac68
        R13: 0000000000000001 R14: 00000000011b02f0 R15: 0000000000000000
        FS:  00007fc9bf8f5700(0000) GS:ffff8801a7c40000(0000) knlGS:0000000000000000
        CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
        CR2: 0000000000403c90 CR3: 000000019ebdf000 CR4: 00000000000007e0
        Stack:
        Call Trace:
          i7core_unregister_mci.isra.9
          i7core_remove
          pci_device_remove
          __device_release_driver
          driver_detach
          bus_remove_driver
          pci_unregister_driver
          i7core_exit
          SyS_delete_module
          system_call_fastpath
          0x7fc9bf426536
        Code: 2e 0f 1f 84 00 00 00 00 00 66 66 66 66 90 53 48 89 fb e8 52 2a 1f e1 48 8b bb a0 02 00 00 e8 46 59 1f e1 48 8b 83 a0 02 00 00 5b <48> 8b 38 e9 26 9a fe e0 66 0f 1f 44 00 00 66 66 66 66 90 48 8b
        RIP  [<ffffffffa019da92>] edac_unregister_sysfs+0x22/0x30 [edac_core]
         RSP <ffff88030da3fe28>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
      Cc: <stable@vger.kernel.org> # v3.6..
      Fixes: 7a623c03 ("edac: rewrite the sysfs code to use struct device")
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      eddf977a
    • Konstantin Khlebnikov's avatar
      ovl: check dentry positiveness in ovl_cleanup_whiteouts() · 1cbc3b77
      Konstantin Khlebnikov authored
      [ Upstream commit 84889d49 ]
      
      This patch fixes kernel crash at removing directory which contains
      whiteouts from lower layers.
      
      Cache of directory content passed as "list" contains entries from all
      layers, including whiteouts from lower layers. So, lookup in upper dir
      (moved into work at this stage) will return negative entry. Plus this
      cache is filled long before and we can race with external removal.
      
      Example:
       mkdir -p lower0/dir lower1/dir upper work overlay
       touch lower0/dir/a lower0/dir/b
       mknod lower1/dir/a c 0 0
       mount -t overlay none overlay -o lowerdir=lower1:lower0,upperdir=upper,workdir=work
       rm -fr overlay/dir
      Signed-off-by: default avatarKonstantin Khlebnikov <khlebnikov@yandex-team.ru>
      Signed-off-by: default avatarMiklos Szeredi <miklos@szeredi.hu>
      Cc: <stable@vger.kernel.org> # 3.18+
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      1cbc3b77
    • Miklos Szeredi's avatar
      ovl: setattr: check permissions before copy-up · c8e1bebf
      Miklos Szeredi authored
      [ Upstream commit cf9a6784 ]
      
      Without this copy-up of a file can be forced, even without actually being
      allowed to do anything on the file.
      
      [Arnd Bergmann] include <linux/pagemap.h> for PAGE_CACHE_SIZE (used by
      MAX_LFS_FILESIZE definition).
      Signed-off-by: default avatarMiklos Szeredi <miklos@szeredi.hu>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      c8e1bebf
    • Uri Mashiach's avatar
      wlcore/wl12xx: spi: fix oops on firmware load · 3d51d36e
      Uri Mashiach authored
      [ Upstream commit 9b2761cb ]
      
      The maximum chunks used by the function is
      (SPI_AGGR_BUFFER_SIZE / WSPI_MAX_CHUNK_SIZE + 1).
      The original commands array had space for
      (SPI_AGGR_BUFFER_SIZE / WSPI_MAX_CHUNK_SIZE) commands.
      When the last chunk is used (len > 4 * WSPI_MAX_CHUNK_SIZE), the last
      command is stored outside the bounds of the commands array.
      
      Oops 5 (page fault) is generated during current wl1271 firmware load
      attempt:
      
      root@debian-armhf:~# ifconfig wlan0 up
      [  294.312399] Unable to handle kernel paging request at virtual address
      00203fc4
      [  294.320173] pgd = de528000
      [  294.323028] [00203fc4] *pgd=00000000
      [  294.326916] Internal error: Oops: 5 [#1] SMP ARM
      [  294.331789] Modules linked in: bnep rfcomm bluetooth ipv6 arc4 wl12xx
      wlcore mac80211 musb_dsps cfg80211 musb_hdrc usbcore usb_common
      wlcore_spi omap_rng rng_core musb_am335x omap_wdt cpufreq_dt thermal_sys
      hwmon
      [  294.351838] CPU: 0 PID: 1827 Comm: ifconfig Not tainted
      4.2.0-00002-g3e9ad27-dirty #78
      [  294.360154] Hardware name: Generic AM33XX (Flattened Device Tree)
      [  294.366557] task: dc9d6d40 ti: de550000 task.ti: de550000
      [  294.372236] PC is at __spi_validate+0xa8/0x2ac
      [  294.376902] LR is at __spi_sync+0x78/0x210
      [  294.381200] pc : [<c049c760>]    lr : [<c049ebe0>]    psr: 60000013
      [  294.381200] sp : de551998  ip : de5519d8  fp : 00200000
      [  294.393242] r10: de551c8c  r9 : de5519d8  r8 : de3a9000
      [  294.398730] r7 : de3a9258  r6 : de3a9400  r5 : de551a48  r4 :
      00203fbc
      [  294.405577] r3 : 00000000  r2 : 00000000  r1 : 00000000  r0 :
      de3a9000
      [  294.412420] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM
      Segment user
      [  294.419918] Control: 10c5387d  Table: 9e528019  DAC: 00000015
      [  294.425954] Process ifconfig (pid: 1827, stack limit = 0xde550218)
      [  294.432437] Stack: (0xde551998 to 0xde552000)
      
      ...
      
      [  294.883613] [<c049c760>] (__spi_validate) from [<c049ebe0>]
      (__spi_sync+0x78/0x210)
      [  294.891670] [<c049ebe0>] (__spi_sync) from [<bf036598>]
      (wl12xx_spi_raw_write+0xfc/0x148 [wlcore_spi])
      [  294.901661] [<bf036598>] (wl12xx_spi_raw_write [wlcore_spi]) from
      [<bf21c694>] (wlcore_boot_upload_firmware+0x1ec/0x458 [wlcore])
      [  294.914038] [<bf21c694>] (wlcore_boot_upload_firmware [wlcore]) from
      [<bf24532c>] (wl12xx_boot+0xc10/0xfac [wl12xx])
      [  294.925161] [<bf24532c>] (wl12xx_boot [wl12xx]) from [<bf20d5cc>]
      (wl1271_op_add_interface+0x5b0/0x910 [wlcore])
      [  294.936364] [<bf20d5cc>] (wl1271_op_add_interface [wlcore]) from
      [<bf15c4ac>] (ieee80211_do_open+0x44c/0xf7c [mac80211])
      [  294.947963] [<bf15c4ac>] (ieee80211_do_open [mac80211]) from
      [<c0537978>] (__dev_open+0xa8/0x110)
      [  294.957307] [<c0537978>] (__dev_open) from [<c0537bf8>]
      (__dev_change_flags+0x88/0x148)
      [  294.965713] [<c0537bf8>] (__dev_change_flags) from [<c0537cd0>]
      (dev_change_flags+0x18/0x48)
      [  294.974576] [<c0537cd0>] (dev_change_flags) from [<c05a55a0>]
      (devinet_ioctl+0x6b4/0x7d0)
      [  294.983191] [<c05a55a0>] (devinet_ioctl) from [<c0517040>]
      (sock_ioctl+0x1e4/0x2bc)
      [  294.991244] [<c0517040>] (sock_ioctl) from [<c017d378>]
      (do_vfs_ioctl+0x420/0x6b0)
      [  294.999208] [<c017d378>] (do_vfs_ioctl) from [<c017d674>]
      (SyS_ioctl+0x6c/0x7c)
      [  295.006880] [<c017d674>] (SyS_ioctl) from [<c000f4c0>]
      (ret_fast_syscall+0x0/0x54)
      [  295.014835] Code: e1550004 e2444034 0a00007d e5953018 (e5942008)
      [  295.021544] ---[ end trace 66ed188198f4e24e ]---
      Signed-off-by: default avatarUri Mashiach <uri.mashiach@compulab.co.il>
      Acked-by: default avatarIgor Grinberg <grinberg@compulab.co.il>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      3d51d36e
    • Peter Wu's avatar
      rtlwifi: fix memory leak for USB device · 76e8046a
      Peter Wu authored
      [ Upstream commit 17bc5586 ]
      
      Free skb for received frames with a wrong checksum. This can happen
      pretty rapidly, exhausting all memory.
      
      This fixes a memleak (detected with kmemleak). Originally found while
      using monitor mode, but it also appears during managed mode (once the
      link is up).
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPeter Wu <peter@lekensteyn.nl>
      ACKed-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      76e8046a
    • Ville Syrjälä's avatar
      drm: Don't overwrite UNVERFIED mode status to OK · 01e6b1f4
      Ville Syrjälä authored
      [ Upstream commit be8719a6 ]
      
      The way the mode probing works is this:
      1. All modes currently on the mode list are marked as UNVERIFIED
      2. New modes are on the probed_modes list (they start with
         status OK)
      3. Modes are moved from the probed_modes list to the actual
         mode list. If a mode already on the mode list is deemed
         to match one of the probed modes, the duplicate is dropped
         and the mode status updated to OK. After this the
         probed_modes list will be empty.
      4. All modes on the mode list are verified to not violate any
         constraints. Any that do are marked as such.
      5. Any mode left with a non-OK status is pruned from the list,
         with an appropriate debug message.
      
      What all this means is that any mode on the original list that
      didn't have a duplicate on the probed_modes list, should be left
      with status UNVERFIED (or previously could have been left with
      some other status, but never OK).
      
      I broke that in
      commit 05acaec3 ("drm: Reorganize probed mode validation")
      by always assigning something to the mode->status during the validation
      step. So any mode from the old list that still passed the validation
      would be left on the list with status OK in the end.
      
      Fix this by not doing the basic mode validation unless the mode
      already has status OK (meaning it came from the probed_modes list,
      or at least a duplicate of it was on that list). This way we will
      correctly prune away any mode from the old mode list that didn't
      appear on the probed_modes list.
      
      Cc: stable@vger.kernel.org
      Cc: Adam Jackson <ajax@redhat.com>
      Fixes: 05acaec3 ("drm: Reorganize probed mode validation")
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/1449177255-9515-2-git-send-email-ville.syrjala@linux.intel.com
      Testcase: igt/kms_force_connector_basic/prune-stale-modes
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93332
      [danvet: Also applying to drm-misc to avoid too much conflict hell -
      there's a big pile of patches from Ville on top of this one.]
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      01e6b1f4
    • Dmitry Tunin's avatar
      Bluetooth: Add support of Toshiba Broadcom based devices · 13879293
      Dmitry Tunin authored
      [ Upstream commit 1623d0bf ]
      
      BugLink: https://bugs.launchpad.net/bugs/1522949
      
          T: Bus=03 Lev=02 Prnt=02 Port=05 Cnt=02 Dev#= 4 Spd=12 MxCh= 0
          D: Ver= 2.00 Cls=ff(vend.) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
          P: Vendor=0930 ProdID=0225 Rev=01.12
          S: Manufacturer=Broadcom Corp
          S: Product=BCM43142A0
          S: SerialNumber=4CBB58034671
          C: #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=0mA
          I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
          I: If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
          I: If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
          I: If#= 3 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=01 Driver=(none)
      Signed-off-by: default avatarDmitry Tunin <hanipouspilot@gmail.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      13879293