1. 24 Sep, 2016 32 commits
  2. 15 Sep, 2016 8 commits
    • Greg Kroah-Hartman's avatar
      Linux 4.4.21 · 1d074db6
      Greg Kroah-Hartman authored
      1d074db6
    • Nicolai Stange's avatar
      lib/mpi: mpi_write_sgl(): fix skipping of leading zero limbs · 11c27e85
      Nicolai Stange authored
      commit f2d1362f upstream.
      
      Currently, if the number of leading zeros is greater than fits into a
      complete limb, mpi_write_sgl() skips them by iterating over them limb-wise.
      
      However, it fails to adjust its internal leading zeros tracking variable,
      lzeros, accordingly: it does a
      
        p -= sizeof(alimb);
        continue;
      
      which should really have been a
      
        lzeros -= sizeof(alimb);
        continue;
      
      Since lzeros never decreases if its initial value >= sizeof(alimb), nothing
      gets copied by mpi_write_sgl() in that case.
      
      Instead of skipping the high order zero limbs within the loop as shown
      above, fix the issue by adjusting the copying loop's bounds.
      
      Fixes: 2d4d1eea ("lib/mpi: Add mpi sgl helpers")
      Signed-off-by: default avatarNicolai Stange <nicstange@gmail.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      11c27e85
    • Mika Båtsman's avatar
      regulator: anatop: allow regulator to be in bypass mode · 3838b04f
      Mika Båtsman authored
      commit 8a092e68 upstream.
      
      Bypass support was added in commit d38018f2 ("regulator: anatop: Add
      bypass support to digital LDOs"). A check for valid voltage selectors was
      added in commit da0607c8 ("regulator: anatop: Fail on invalid voltage
      selector") but it also discards all regulators that are in bypass mode. Add
      check for the bypass setting. Errors below were seen on a Variscite mx6
      board.
      
      anatop_regulator 20c8000.anatop:regulator-vddcore@140: Failed to read a valid default voltage selector.
      anatop_regulator: probe of 20c8000.anatop:regulator-vddcore@140 failed with error -22
      anatop_regulator 20c8000.anatop:regulator-vddsoc@140: Failed to read a valid default voltage selector.
      anatop_regulator: probe of 20c8000.anatop:regulator-vddsoc@140 failed with error -22
      
      Fixes: da0607c8 ("regulator: anatop: Fail on invalid voltage selector")
      Signed-off-by: default avatarMika Båtsman <mbatsman@mvista.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3838b04f
    • Krzysztof Kozlowski's avatar
      hwrng: exynos - Disable runtime PM on probe failure · 390bddc4
      Krzysztof Kozlowski authored
      commit 48a61e1e upstream.
      
      Add proper error path (for disabling runtime PM) when registering of
      hwrng fails.
      
      Fixes: b329669e ("hwrng: exynos - Add support for Exynos random number generator")
      Signed-off-by: default avatarKrzysztof Kozlowski <k.kozlowski@samsung.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      390bddc4
    • Sai Gurrappadi's avatar
      cpufreq: Fix GOV_LIMITS handling for the userspace governor · aaac8cab
      Sai Gurrappadi authored
      commit e43e94c1 upstream.
      
      Currently, the userspace governor only updates frequency on GOV_LIMITS
      if policy->cur falls outside policy->{min/max}. However, it is also
      necessary to update current frequency on GOV_LIMITS to match the user
      requested value if it can be achieved within the new policy->{max/min}.
      
      This was previously the behaviour in the governor until commit d1922f02
      ("cpufreq: Simplify userspace governor") which incorrectly assumed that
      policy->cur == user requested frequency via scaling_setspeed. This won't
      be true if the user requested frequency falls outside policy->{min/max}.
      Ex: a temporary thermal cap throttled the user requested frequency.
      
      Fix this by storing the user requested frequency in a seperate variable.
      The governor will then try to achieve this request on every GOV_LIMITS
      change.
      
      Fixes: d1922f02 (cpufreq: Simplify userspace governor)
      Signed-off-by: default avatarSai Gurrappadi <sgurrappadi@nvidia.com>
      Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      aaac8cab
    • James Hogan's avatar
      metag: Fix atomic_*_return inline asm constraints · 73e6305c
      James Hogan authored
      commit 096a8b6d upstream.
      
      The argument i of atomic_*_return() operations is given to inline asm
      with the "bd" constraint, which means "An Op2 register where Op1 is a
      data unit register and the instruction supports O2R", however Op1 is
      constrained by "da" which allows an address unit register to be used.
      
      Fix the constraint to use "br", meaning "An Op2 register and the
      instruction supports O2R", i.e. not requiring Op1 to be a data unit
      register.
      
      Fixes: d6dfe250 ("locking,arch,metag: Fold atomic_ops")
      Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: linux-metag@vger.kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      73e6305c
    • Tyrel Datwyler's avatar
      scsi: fix upper bounds check of sense key in scsi_sense_key_string() · 6f0caecd
      Tyrel Datwyler authored
      commit a87eeb90 upstream.
      
      Commit 655ee63c ("scsi constants: command, sense key + additional
      sense string") added a "Completed" sense string with key 0xF to
      snstext[], but failed to updated the upper bounds check of the sense key
      in scsi_sense_key_string().
      
      Fixes: 655ee63c ("[SCSI] scsi constants: command, sense key + additional sense strings")
      Signed-off-by: default avatarTyrel Datwyler <tyreld@linux.vnet.ibm.com>
      Reviewed-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6f0caecd
    • Vegard Nossum's avatar
      ALSA: timer: fix NULL pointer dereference on memory allocation failure · f5b004e4
      Vegard Nossum authored
      commit 8ddc0563 upstream.
      
      I hit this with syzkaller:
      
          kasan: CONFIG_KASAN_INLINE enabled
          kasan: GPF could be caused by NULL-ptr deref or user memory access
          general protection fault: 0000 [#1] PREEMPT SMP KASAN
          CPU: 0 PID: 1327 Comm: a.out Not tainted 4.8.0-rc2+ #190
          Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.9.3-0-ge2fc41e-prebuilt.qemu-project.org 04/01/2014
          task: ffff88011278d600 task.stack: ffff8801120c0000
          RIP: 0010:[<ffffffff82c8ba07>]  [<ffffffff82c8ba07>] snd_hrtimer_start+0x77/0x100
          RSP: 0018:ffff8801120c7a60  EFLAGS: 00010006
          RAX: dffffc0000000000 RBX: 0000000000000000 RCX: 0000000000000007
          RDX: 0000000000000009 RSI: 1ffff10023483091 RDI: 0000000000000048
          RBP: ffff8801120c7a78 R08: ffff88011a5cf768 R09: ffff88011a5ba790
          R10: 0000000000000002 R11: ffffed00234b9ef1 R12: ffff880114843980
          R13: ffffffff84213c00 R14: ffff880114843ab0 R15: 0000000000000286
          FS:  00007f72958f3700(0000) GS:ffff88011aa00000(0000) knlGS:0000000000000000
          CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
          CR2: 0000000000603001 CR3: 00000001126ab000 CR4: 00000000000006f0
          Stack:
           ffff880114843980 ffff880111eb2dc0 ffff880114843a34 ffff8801120c7ad0
           ffffffff82c81ab1 0000000000000000 ffffffff842138e0 0000000100000000
           ffff880111eb2dd0 ffff880111eb2dc0 0000000000000001 ffff880111eb2dc0
          Call Trace:
           [<ffffffff82c81ab1>] snd_timer_start1+0x331/0x670
           [<ffffffff82c85bfd>] snd_timer_start+0x5d/0xa0
           [<ffffffff82c8795e>] snd_timer_user_ioctl+0x88e/0x2830
           [<ffffffff8159f3a0>] ? __follow_pte.isra.49+0x430/0x430
           [<ffffffff82c870d0>] ? snd_timer_pause+0x80/0x80
           [<ffffffff815a26fa>] ? do_wp_page+0x3aa/0x1c90
           [<ffffffff8132762f>] ? put_prev_entity+0x108f/0x21a0
           [<ffffffff82c870d0>] ? snd_timer_pause+0x80/0x80
           [<ffffffff816b0733>] do_vfs_ioctl+0x193/0x1050
           [<ffffffff813510af>] ? cpuacct_account_field+0x12f/0x1a0
           [<ffffffff816b05a0>] ? ioctl_preallocate+0x200/0x200
           [<ffffffff81002f2f>] ? syscall_trace_enter+0x3cf/0xdb0
           [<ffffffff815045ba>] ? __context_tracking_exit.part.4+0x9a/0x1e0
           [<ffffffff81002b60>] ? exit_to_usermode_loop+0x190/0x190
           [<ffffffff82001a97>] ? check_preemption_disabled+0x37/0x1e0
           [<ffffffff81d93889>] ? security_file_ioctl+0x89/0xb0
           [<ffffffff816b167f>] SyS_ioctl+0x8f/0xc0
           [<ffffffff816b15f0>] ? do_vfs_ioctl+0x1050/0x1050
           [<ffffffff81005524>] do_syscall_64+0x1c4/0x4e0
           [<ffffffff83c32b2a>] entry_SYSCALL64_slow_path+0x25/0x25
          Code: c7 c7 c4 b9 c8 82 48 89 d9 4c 89 ee e8 63 88 7f fe e8 7e 46 7b fe 48 8d 7b 48 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <0f> b6 04 02 84 c0 74 04 84 c0 7e 65 80 7b 48 00 74 0e e8 52 46
          RIP  [<ffffffff82c8ba07>] snd_hrtimer_start+0x77/0x100
           RSP <ffff8801120c7a60>
          ---[ end trace 5955b08db7f2b029 ]---
      
      This can happen if snd_hrtimer_open() fails to allocate memory and
      returns an error, which is currently not checked by snd_timer_open():
      
          ioctl(SNDRV_TIMER_IOCTL_SELECT)
           - snd_timer_user_tselect()
      	- snd_timer_close()
      	   - snd_hrtimer_close()
      	      - (struct snd_timer *) t->private_data = NULL
              - snd_timer_open()
                 - snd_hrtimer_open()
                    - kzalloc() fails; t->private_data is still NULL
      
          ioctl(SNDRV_TIMER_IOCTL_START)
           - snd_timer_user_start()
      	- snd_timer_start()
      	   - snd_timer_start1()
      	      - snd_hrtimer_start()
      		- t->private_data == NULL // boom
      Signed-off-by: default avatarVegard Nossum <vegard.nossum@oracle.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f5b004e4