1. 11 Jun, 2014 11 commits
  2. 10 Jun, 2014 29 commits
    • Johan Hedberg's avatar
      Bluetooth: Fix triggering BR/EDR L2CAP Connect too early · b7dac9c0
      Johan Hedberg authored
      commit 9eb1fbfa upstream.
      
      Commit 1c2e0041 introduced an event handler for the encryption key
      refresh complete event with the intent of fixing some LE/SMP cases.
      However, this event is shared with BR/EDR and there we actually want to
      act only on the auth_complete event (which comes after the key refresh).
      
      If we do not do this we may trigger an L2CAP Connect Request too early
      and cause the remote side to return a security block error.
      Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      b7dac9c0
    • Sheng-Liang Song's avatar
      Input: atkbd - fix keyboard not working on some LG laptops · 20571e38
      Sheng-Liang Song authored
      commit 3d725caa upstream.
      
      After issuing ATKBD_CMD_RESET_DIS, keyboard on some LG laptops stops
      working. The workaround is to stop issuing ATKBD_CMD_RESET_DIS commands.
      
      In order to keep changes in atkbd driver to the minimum we check DMI
      signature and only skip ATKBD_CMD_RESET_DIS if we are running on LG
      LW25-B7HV or P1-J273B.
      Signed-off-by: default avatarSheng-Liang Song <ssl@chromium.org>
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      20571e38
    • Hans de Goede's avatar
    • Colin Ian King's avatar
      rtlwifi: rtl8188ee: initialize packet_beacon · 5661977a
      Colin Ian King authored
      commit 328e203f upstream.
      
      static code analysis from cppcheck reports:
      
      [drivers/net/wireless/rtlwifi/rtl8188ee/trx.c:322]:
        (error) Uninitialized variable: packet_beacon
      
      packet_beacon is not initialized and hence packet_beacon
      contains garbage from the stack, so set it to false.
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Acked-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      5661977a
    • Stanislaw Gruszka's avatar
      rt2x00: fix beaconing on USB · aeaf0d4b
      Stanislaw Gruszka authored
      commit 8834d360 upstream.
      
      When disable beaconing we clear register with beacon and newer set it
      back, what make we stop send beacons infinitely.
      Signed-off-by: default avatarStanislaw Gruszka <sgruszka@redhat.com>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      aeaf0d4b
    • Andrew Lutomirski's avatar
      net: Fix ns_capable check in sock_diag_put_filterinfo · c28a7d22
      Andrew Lutomirski authored
      commit 78541c1d upstream.
      
      The caller needs capabilities on the namespace being queried, not on
      their own namespace.  This is a security bug, although it likely has
      only a minor impact.
      Signed-off-by: default avatarAndy Lutomirski <luto@amacapital.net>
      Acked-by: default avatarNicolas Dichtel <nicolas.dichtel@6wind.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      c28a7d22
    • Al Viro's avatar
      fix races between __d_instantiate() and checks of dentry flags · f718c537
      Al Viro authored
      commit 22213318 upstream.
      
      in non-lazy walk we need to be careful about dentry switching from
      negative to positive - both ->d_flags and ->d_inode are updated,
      and in some places we might see only one store.  The cases where
      dentry has been obtained by dcache lookup with ->i_mutex held on
      parent are safe - ->d_lock and ->i_mutex provide all the barriers
      we need.  However, there are several places where we run into
      trouble:
      	* do_last() fetches ->d_inode, then checks ->d_flags and
      assumes that inode won't be NULL unless d_is_negative() is true.
      Race with e.g. creat() - we might have fetched the old value of
      ->d_inode (still NULL) and new value of ->d_flags (already not
      DCACHE_MISS_TYPE).  Lin Ming has observed and reported the resulting
      oops.
      	* a bunch of places checks ->d_inode for being non-NULL,
      then checks ->d_flags for "is it a symlink".  Race with symlink(2)
      in case if our CPU sees ->d_inode update first - we see non-NULL
      there, but ->d_flags still contains DCACHE_MISS_TYPE instead of
      DCACHE_SYMLINK_TYPE.  Result: false negative on "should we follow
      link here?", with subsequent unpleasantness.
      Reported-and-tested-by: default avatarLin Ming <minggr@gmail.com>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      f718c537
    • Mike Snitzer's avatar
      dm cache: fix writethrough mode quiescing in cache_map · cecc1070
      Mike Snitzer authored
      commit 131cd131 upstream.
      
      Commit 2ee57d58 ("dm cache: add passthrough mode") inadvertently
      removed the deferred set reference that was taken in cache_map()'s
      writethrough mode support.  Restore taking this reference.
      
      This issue was found with code inspection.
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      Acked-by: default avatarJoe Thornber <ejt@redhat.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      cecc1070
    • Leon Yu's avatar
      aio: fix potential leak in aio_run_iocb(). · c5e8d7d0
      Leon Yu authored
      commit 754320d6 upstream.
      
      iovec should be reclaimed whenever caller of rw_copy_check_uvector() returns,
      but it doesn't hold when failure happens right after aio_setup_vectored_rw().
      
      Fix that in a such way to avoid hairy goto.
      Signed-off-by: default avatarLeon Yu <chianglungyu@gmail.com>
      Signed-off-by: default avatarBenjamin LaHaise <bcrl@kvack.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      c5e8d7d0
    • Vineet Gupta's avatar
      ARC: !PREEMPT: Ensure Return to kernel mode is IRQ safe · 7072773c
      Vineet Gupta authored
      commit 8aa9e85a upstream.
      
      There was a very small race window where resume to kernel mode from a
      Exception Path (or pure kernel mode which is true for most of ARC
      exceptions anyways), was not disabling interrupts in restore_regs,
      clobbering the exception regs
      
      Anton found the culprit call flow (after many sleepless nights)
      
      | 1. we got a Trap from user land
      | 2. started to service it.
      | 3. While doing some stuff on user-land memory (I think it is padzero()),
      |     we got a DataTlbMiss
      | 4. On return from it we are taking "resume_kernel_mode" path
      | 5. NEED_RESHED is not set, so we go to "return from exception" path in
      |     restore regs.
      | 6. there seems to be IRQ happening
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      Cc: Anton Kolesov <Anton.Kolesov@synopsys.com>
      Cc: Francois Bedard <Francois.Bedard@synopsys.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      7072773c
    • Jiri Bohac's avatar
      timer: Prevent overflow in apply_slack · e3565e1a
      Jiri Bohac authored
      commit 98a01e77 upstream.
      
      On architectures with sizeof(int) < sizeof (long), the
      computation of mask inside apply_slack() can be undefined if the
      computed bit is > 32.
      
      E.g. with: expires = 0xffffe6f5 and slack = 25, we get:
      
      expires_limit = 0x20000000e
      bit = 33
      mask = (1 << 33) - 1  /* undefined */
      
      On x86, mask becomes 1 and and the slack is not applied properly.
      On s390, mask is -1, expires is set to 0 and the timer fires immediately.
      
      Use 1UL << bit to solve that issue.
      Suggested-by: default avatarDeborah Townsend <dstownse@us.ibm.com>
      Signed-off-by: default avatarJiri Bohac <jbohac@suse.cz>
      Link: http://lkml.kernel.org/r/20140418152310.GA13654@midget.suse.czSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      e3565e1a
    • Leon Ma's avatar
      hrtimer: Prevent remote enqueue of leftmost timers · 716b4369
      Leon Ma authored
      commit 012a45e3 upstream.
      
      If a cpu is idle and starts an hrtimer which is not pinned on that
      same cpu, the nohz code might target the timer to a different cpu.
      
      In the case that we switch the cpu base of the timer we already have a
      sanity check in place, which determines whether the timer is earlier
      than the current leftmost timer on the target cpu. In that case we
      enqueue the timer on the current cpu because we cannot reprogram the
      clock event device on the target.
      
      If the timers base is already the target CPU we do not have this
      sanity check in place so we enqueue the timer as the leftmost timer in
      the target cpus rb tree, but we cannot reprogram the clock event
      device on the target cpu. So the timer expires late and subsequently
      prevents the reprogramming of the target cpu clock event device until
      the previously programmed event fires or a timer with an earlier
      expiry time gets enqueued on the target cpu itself.
      
      Add the same target check as we have for the switch base case and
      start the timer on the current cpu if it would become the leftmost
      timer on the target.
      
      [ tglx: Rewrote subject and changelog ]
      Signed-off-by: default avatarLeon Ma <xindong.ma@intel.com>
      Link: http://lkml.kernel.org/r/1398847391-5994-1-git-send-email-xindong.ma@intel.comSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      716b4369
    • Stuart Hayes's avatar
      hrtimer: Prevent all reprogramming if hang detected · 694c6cae
      Stuart Hayes authored
      commit 6c6c0d5a upstream.
      
      If the last hrtimer interrupt detected a hang it sets hang_detected=1
      and programs the clock event device with a delay to let the system
      make progress.
      
      If hang_detected == 1, we prevent reprogramming of the clock event
      device in hrtimer_reprogram() but not in hrtimer_force_reprogram().
      
      This can lead to the following situation:
      
      hrtimer_interrupt()
         hang_detected = 1;
         program ce device to Xms from now (hang delay)
      
      We have two timers pending:
         T1 expires 50ms from now
         T2 expires 5s from now
      
      Now T1 gets canceled, which causes hrtimer_force_reprogram() to be
      invoked, which in turn programs the clock event device to T2 (5
      seconds from now).
      
      Any hrtimer_start after that will not reprogram the hardware due to
      hang_detected still being set. So we effectivly block all timers until
      the T2 event fires and cleans up the hang situation.
      
      Add a check for hang_detected to hrtimer_force_reprogram() which
      prevents the reprogramming of the hang delay in the hardware
      timer. The subsequent hrtimer_interrupt will resolve all outstanding
      issues.
      
      [ tglx: Rewrote subject and changelog and fixed up the comment in
        	hrtimer_force_reprogram() ]
      Signed-off-by: default avatarStuart Hayes <stuart.w.hayes@gmail.com>
      Link: http://lkml.kernel.org/r/53602DC6.2060101@gmail.comSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      694c6cae
    • Grant Likely's avatar
      drivercore: deferral race condition fix · e2ac7590
      Grant Likely authored
      commit 58b116bc upstream.
      
      When the kernel is built with CONFIG_PREEMPT it is possible to reach a state
      when all modules loaded but some driver still stuck in the deferred list
      and there is a need for external event to kick the deferred queue to probe
      these drivers.
      
      The issue has been observed on embedded systems with CONFIG_PREEMPT enabled,
      audio support built as modules and using nfsroot for root filesystem.
      
      The following log fragment shows such sequence when all audio modules
      were loaded but the sound card is not present since the machine driver has
      failed to probe due to missing dependency during it's probe.
      The board is am335x-evmsk (McASP<->tlv320aic3106 codec) with davinci-evm
      machine driver:
      
      ...
      [   12.615118] davinci-mcasp 4803c000.mcasp: davinci_mcasp_probe: ENTER
      [   12.719969] davinci_evm sound.3: davinci_evm_probe: ENTER
      [   12.725753] davinci_evm sound.3: davinci_evm_probe: snd_soc_register_card
      [   12.753846] davinci-mcasp 4803c000.mcasp: davinci_mcasp_probe: snd_soc_register_component
      [   12.922051] davinci-mcasp 4803c000.mcasp: davinci_mcasp_probe: snd_soc_register_component DONE
      [   12.950839] davinci_evm sound.3: ASoC: platform (null) not registered
      [   12.957898] davinci_evm sound.3: davinci_evm_probe: snd_soc_register_card DONE (-517)
      [   13.099026] davinci-mcasp 4803c000.mcasp: Kicking the deferred list
      [   13.177838] davinci-mcasp 4803c000.mcasp: really_probe: probe_count = 2
      [   13.194130] davinci_evm sound.3: snd_soc_register_card failed (-517)
      [   13.346755] davinci_mcasp_driver_init: LEAVE
      [   13.377446] platform sound.3: Driver davinci_evm requests probe deferral
      [   13.592527] platform sound.3: really_probe: probe_count = 0
      
      In the log the machine driver enters it's probe at 12.719969 (this point it
      has been removed from the deferred lists). McASP driver already executing
      it's probing (since 12.615118).
      The machine driver tries to construct the sound card (12.950839) but did
      not found one of the components so it fails. After this McASP driver
      registers all the ASoC components (the machine driver still in it's probe
      function after it failed to construct the card) and the deferred work is
      prepared at 13.099026 (note that this time the machine driver is not in the
      lists so it is not going to be handled when the work is executing).
      Lastly the machine driver exit from it's probe and the core places it to
      the deferred list but there will be no other driver going to load and the
      deferred queue is not going to be kicked again - till we have external event
      like connecting USB stick, etc.
      
      The proposed solution is to try the deferred queue once more when the last
      driver is asking for deferring and we had drivers loaded while this last
      driver was probing.
      
      This way we can avoid drivers stuck in the deferred queue.
      Signed-off-by: default avatarGrant Likely <grant.likely@linaro.org>
      Reviewed-by: default avatarPeter Ujfalusi <peter.ujfalusi@ti.com>
      Tested-by: default avatarPeter Ujfalusi <peter.ujfalusi@ti.com>
      Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Mark Brown <broonie@kernel.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      e2ac7590
    • Fam Zheng's avatar
      [SCSI] virtio-scsi: Skip setting affinity on uninitialized vq · 02131716
      Fam Zheng authored
      commit 0c8482ac upstream.
      
      virtscsi_init calls virtscsi_remove_vqs on err, even before initializing
      the vqs. The latter calls virtscsi_set_affinity, so let's check the
      pointer there before setting affinity on it.
      
      This fixes a panic when setting device's num_queues=2 on RHEL 6.5:
      
      qemu-system-x86_64 ... \
      -device virtio-scsi-pci,id=scsi0,addr=0x13,...,num_queues=2 \
      -drive file=/stor/vm/dummy.raw,id=drive-scsi-disk,... \
      -device scsi-hd,drive=drive-scsi-disk,...
      
      [    0.354734] scsi0 : Virtio SCSI HBA
      [    0.379504] BUG: unable to handle kernel NULL pointer dereference at 0000000000000020
      [    0.380141] IP: [<ffffffff814741ef>] __virtscsi_set_affinity+0x4f/0x120
      [    0.380141] PGD 0
      [    0.380141] Oops: 0000 [#1] SMP
      [    0.380141] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.14.0+ #5
      [    0.380141] Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2007
      [    0.380141] task: ffff88003c9f0000 ti: ffff88003c9f8000 task.ti: ffff88003c9f8000
      [    0.380141] RIP: 0010:[<ffffffff814741ef>]  [<ffffffff814741ef>] __virtscsi_set_affinity+0x4f/0x120
      [    0.380141] RSP: 0000:ffff88003c9f9c08  EFLAGS: 00010256
      [    0.380141] RAX: 0000000000000000 RBX: ffff88003c3a9d40 RCX: 0000000000001070
      [    0.380141] RDX: 0000000000000002 RSI: 0000000000000000 RDI: 0000000000000000
      [    0.380141] RBP: ffff88003c9f9c28 R08: 00000000000136c0 R09: ffff88003c801c00
      [    0.380141] R10: ffffffff81475229 R11: 0000000000000008 R12: 0000000000000000
      [    0.380141] R13: ffffffff81cc7ca8 R14: ffff88003cac3d40 R15: ffff88003cac37a0
      [    0.380141] FS:  0000000000000000(0000) GS:ffff88003e400000(0000) knlGS:0000000000000000
      [    0.380141] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
      [    0.380141] CR2: 0000000000000020 CR3: 0000000001c0e000 CR4: 00000000000006f0
      [    0.380141] Stack:
      [    0.380141]  ffff88003c3a9d40 0000000000000000 ffff88003cac3d80 ffff88003cac3d40
      [    0.380141]  ffff88003c9f9c48 ffffffff814742e8 ffff88003c26d000 ffff88003c26d000
      [    0.380141]  ffff88003c9f9c68 ffffffff81474321 ffff88003c26d000 ffff88003c3a9d40
      [    0.380141] Call Trace:
      [    0.380141]  [<ffffffff814742e8>] virtscsi_set_affinity+0x28/0x40
      [    0.380141]  [<ffffffff81474321>] virtscsi_remove_vqs+0x21/0x50
      [    0.380141]  [<ffffffff81475231>] virtscsi_init+0x91/0x240
      [    0.380141]  [<ffffffff81365290>] ? vp_get+0x50/0x70
      [    0.380141]  [<ffffffff81475544>] virtscsi_probe+0xf4/0x280
      [    0.380141]  [<ffffffff81363ea5>] virtio_dev_probe+0xe5/0x140
      [    0.380141]  [<ffffffff8144c669>] driver_probe_device+0x89/0x230
      [    0.380141]  [<ffffffff8144c8ab>] __driver_attach+0x9b/0xa0
      [    0.380141]  [<ffffffff8144c810>] ? driver_probe_device+0x230/0x230
      [    0.380141]  [<ffffffff8144c810>] ? driver_probe_device+0x230/0x230
      [    0.380141]  [<ffffffff8144ac1c>] bus_for_each_dev+0x8c/0xb0
      [    0.380141]  [<ffffffff8144c499>] driver_attach+0x19/0x20
      [    0.380141]  [<ffffffff8144bf28>] bus_add_driver+0x198/0x220
      [    0.380141]  [<ffffffff8144ce9f>] driver_register+0x5f/0xf0
      [    0.380141]  [<ffffffff81d27c91>] ? spi_transport_init+0x79/0x79
      [    0.380141]  [<ffffffff8136403b>] register_virtio_driver+0x1b/0x30
      [    0.380141]  [<ffffffff81d27d19>] init+0x88/0xd6
      [    0.380141]  [<ffffffff81d27c18>] ? scsi_init_procfs+0x5b/0x5b
      [    0.380141]  [<ffffffff81ce88a7>] do_one_initcall+0x7f/0x10a
      [    0.380141]  [<ffffffff81ce8aa7>] kernel_init_freeable+0x14a/0x1de
      [    0.380141]  [<ffffffff81ce8b3b>] ? kernel_init_freeable+0x1de/0x1de
      [    0.380141]  [<ffffffff817dec20>] ? rest_init+0x80/0x80
      [    0.380141]  [<ffffffff817dec29>] kernel_init+0x9/0xf0
      [    0.380141]  [<ffffffff817e68fc>] ret_from_fork+0x7c/0xb0
      [    0.380141]  [<ffffffff817dec20>] ? rest_init+0x80/0x80
      [    0.380141] RIP  [<ffffffff814741ef>] __virtscsi_set_affinity+0x4f/0x120
      [    0.380141]  RSP <ffff88003c9f9c08>
      [    0.380141] CR2: 0000000000000020
      [    0.380141] ---[ end trace 8074b70c3d5e1d73 ]---
      [    0.475018] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000009
      [    0.475018]
      [    0.475068] Kernel Offset: 0x0 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffff9fffffff)
      [    0.475068] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000009
      
      [jejb: checkpatch fixes]
      Signed-off-by: default avatarFam Zheng <famz@redhat.com>
      Acked-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      02131716
    • Tyler Stachecki's avatar
      [SCSI] mpt2sas: Don't disable device twice at suspend. · 303a82a4
      Tyler Stachecki authored
      commit af61e27c upstream.
      
      On suspend, _scsih_suspend calls mpt2sas_base_free_resources, which
      in turn calls pci_disable_device if the device is enabled prior to
      suspending. However, _scsih_suspend also calls pci_disable_device
      itself.
      
      Thus, in the event that the device is enabled prior to suspending,
      pci_disable_device will be called twice. This patch removes the
      duplicate call to pci_disable_device in _scsi_suspend as it is both
      unnecessary and results in a kernel oops.
      Signed-off-by: default avatarTyler Stachecki <tstache1@binghamton.edu>
      Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      303a82a4
    • Steven Rostedt (Red Hat)'s avatar
      ftrace/module: Hardcode ftrace_module_init() call into load_module() · d23e6c3a
      Steven Rostedt (Red Hat) authored
      commit a949ae56 upstream.
      
      A race exists between module loading and enabling of function tracer.
      
      	CPU 1				CPU 2
      	-----				-----
        load_module()
         module->state = MODULE_STATE_COMING
      
      				register_ftrace_function()
      				 mutex_lock(&ftrace_lock);
      				 ftrace_startup()
      				  update_ftrace_function();
      				   ftrace_arch_code_modify_prepare()
      				    set_all_module_text_rw();
      				   <enables-ftrace>
      				    ftrace_arch_code_modify_post_process()
      				     set_all_module_text_ro();
      
      				[ here all module text is set to RO,
      				  including the module that is
      				  loading!! ]
      
         blocking_notifier_call_chain(MODULE_STATE_COMING);
          ftrace_init_module()
      
           [ tries to modify code, but it's RO, and fails!
             ftrace_bug() is called]
      
      When this race happens, ftrace_bug() will produces a nasty warning and
      all of the function tracing features will be disabled until reboot.
      
      The simple solution is to treate module load the same way the core
      kernel is treated at boot. To hardcode the ftrace function modification
      of converting calls to mcount into nops. This is done in init/main.c
      there's no reason it could not be done in load_module(). This gives
      a better control of the changes and doesn't tie the state of the
      module to its notifiers as much. Ftrace is special, it needs to be
      treated as such.
      
      The reason this would work, is that the ftrace_module_init() would be
      called while the module is in MODULE_STATE_UNFORMED, which is ignored
      by the set_all_module_text_ro() call.
      
      Link: http://lkml.kernel.org/r/1395637826-3312-1-git-send-email-indou.takao@jp.fujitsu.comReported-by: default avatarTakao Indoh <indou.takao@jp.fujitsu.com>
      Acked-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      d23e6c3a
    • Oleg Nesterov's avatar
      KVM: async_pf: mm->mm_users can not pin apf->mm · 0eaea59a
      Oleg Nesterov authored
      commit 41c22f62 upstream.
      
      get_user_pages(mm) is simply wrong if mm->mm_users == 0 and exit_mmap/etc
      was already called (or is in progress), mm->mm_count can only pin mm->pgd
      and mm_struct itself.
      
      Change kvm_setup_async_pf/async_pf_execute to inc/dec mm->mm_users.
      
      kvm_create_vm/kvm_destroy_vm play with ->mm_count too but this case looks
      fine at first glance, it seems that this ->mm is only used to verify that
      current->mm == kvm->mm.
      Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      0eaea59a
    • Haibin Wang's avatar
      KVM: ARM: vgic: Fix sgi dispatch problem · fb54c0fa
      Haibin Wang authored
      commit 91021a6c upstream.
      
      When dispatch SGI(mode == 0), that is the vcpu of VM should send
      sgi to the cpu which the target_cpus list.
      So, there must add the "break" to branch of case 0.
      Signed-off-by: default avatarHaibin Wang <wanghaibin.wang@huawei.com>
      Acked-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: default avatarChristoffer Dall <christoffer.dall@linaro.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      fb54c0fa
    • Mark Salter's avatar
      arm: KVM: fix possible misalignment of PGDs and bounce page · 7ec7f848
      Mark Salter authored
      commit 5d4e08c4 upstream.
      
      The kvm/mmu code shared by arm and arm64 uses kalloc() to allocate
      a bounce page (if hypervisor init code crosses page boundary) and
      hypervisor PGDs. The problem is that kalloc() does not guarantee
      the proper alignment. In the case of the bounce page, the page sized
      buffer allocated may also cross a page boundary negating the purpose
      and leading to a hang during kvm initialization. Likewise the PGDs
      allocated may not meet the minimum alignment requirements of the
      underlying MMU. This patch uses __get_free_page() to guarantee the
      worst case alignment needs of the bounce page and PGDs on both arm
      and arm64.
      Signed-off-by: default avatarMark Salter <msalter@redhat.com>
      Acked-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: default avatarChristoffer Dall <christoffer.dall@linaro.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      7ec7f848
    • Hui Wang's avatar
      ALSA: hda - add headset mic detect quirk for a Dell laptop · 882aa882
      Hui Wang authored
      commit e32dfbed upstream.
      
      When we plug a 3-ring headset on the Dell machine (VID: 0x10ec0255,
      SID: 0x10280674), the headset mic can't be detected, after apply this
      patch, the headset mic can work well.
      
      BugLink: https://bugs.launchpad.net/bugs/1297581
      Cc: David Henningsson <david.henningsson@canonical.com>
      Signed-off-by: default avatarHui Wang <hui.wang@canonical.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      882aa882
    • Rusty Russell's avatar
      module: remove warning about waiting module removal. · 9cdc1114
      Rusty Russell authored
      commit 79465d2f upstream.
      
      We remove the waiting module removal in commit 3f2b9c9c (September
      2013), but it turns out that modprobe in kmod (< version 16) was
      asking for waiting module removal.  No one noticed since modprobe would
      check for 0 usage immediately before trying to remove the module, and
      the race is unlikely.
      
      However, it means that anyone running old (but not ancient) kmod
      versions is hitting the printk designed to see if anyone was running
      "rmmod -w".  All reports so far have been false positives, so remove
      the warning.
      
      Fixes: 3f2b9c9cReported-by: default avatarValerio Vanni <valerio.vanni@inwind.it>
      Cc: Elliott, Robert (Server Storage) <Elliott@hp.com>
      Acked-by: default avatarLucas De Marchi <lucas.de.marchi@gmail.com>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      [ kamal: backport to 3.13: context ]
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      9cdc1114
    • Daniel Vetter's avatar
      drm/i915: Don't WARN nor handle unexpected hpd interrupts on gmch platforms · fbdafbab
      Daniel Vetter authored
      commit 3ff04a16 upstream.
      
      The status bits are unconditionally set, the control bits only enable
      the actual interrupt generation. Which means if we get some random
      other interrupts we'll bogusly complain about them.
      
      So restrict the WARN to platforms with a sane hotplug interrupt
      handling scheme. And even more important also don't attempt to process
      the hpd bit since we've detected a storm already. Instead just clear
      the bit silently.
      
      This WARN has been introduced in
      
      commit b8f102e8
      Author: Egbert Eich <eich@suse.de>
      Date:   Fri Jul 26 14:14:24 2013 +0200
      
          drm/i915: Add messages useful for HPD storm detection debugging (v2)
      
      before that we silently handled the hpd event and so partially
      defeated the storm detection.
      
      v2: Pimp commit message (Jani)
      
      Cc: Jani Nikula <jani.nikula@linux.intel.com>
      Cc: Egbert Eich <eich@suse.de>
      Cc: bitlord <bitlord0xff@gmail.com>
      Reported-by: default avatarbitlord <bitlord0xff@gmail.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      [ kamal: backport to 3.13-stable: context ]
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      fbdafbab
    • Martin Schwidefsky's avatar
      s390/bpf,jit: initialize A register if 1st insn is BPF_S_LDX_B_MSH · 68b7766f
      Martin Schwidefsky authored
      commit 6e0de817 upstream.
      
      The A register needs to be initialized to zero in the prolog if the
      first instruction of the BPF program is BPF_S_LDX_B_MSH to prevent
      leaking the content of %r5 to user space.
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      68b7766f
    • Rob Herring's avatar
      of/irq: do irq resolution in platform_get_irq · c05c9ff1
      Rob Herring authored
      commit 9ec36caf upstream.
      
      Currently we get the following kind of errors if we try to use interrupt
      phandles to irqchips that have not yet initialized:
      
      irq: no irq domain found for /ocp/pinmux@48002030 !
      ------------[ cut here ]------------
      WARNING: CPU: 0 PID: 1 at drivers/of/platform.c:171 of_device_alloc+0x144/0x184()
      Modules linked in:
      CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.12.0-00038-g42a9708 #1012
      (show_stack+0x14/0x1c)
      (dump_stack+0x6c/0xa0)
      (warn_slowpath_common+0x64/0x84)
      (warn_slowpath_null+0x1c/0x24)
      (of_device_alloc+0x144/0x184)
      (of_platform_device_create_pdata+0x44/0x9c)
      (of_platform_bus_create+0xd0/0x170)
      (of_platform_bus_create+0x12c/0x170)
      (of_platform_populate+0x60/0x98)
      
      This is because we're wrongly trying to populate resources that are not
      yet available. It's perfectly valid to create irqchips dynamically, so
      let's fix up the issue by resolving the interrupt resources when
      platform_get_irq is called.
      
      And then we also need to accept the fact that some irqdomains do not
      exist that early on, and only get initialized later on. So we can
      make the current WARN_ON into just into a pr_debug().
      
      We still attempt to populate irq resources when we create the devices.
      This allows current drivers which don't use platform_get_irq to continue
      to function. Once all drivers are fixed, this code can be removed.
      Suggested-by: default avatarRussell King <linux@arm.linux.org.uk>
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
      Tested-by: default avatarTony Lindgren <tony@atomide.com>
      Signed-off-by: default avatarGrant Likely <grant.likely@linaro.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      c05c9ff1
    • Thomas Hellstrom's avatar
      drm/vmwgfx: Make sure user-space can't DMA across buffer object boundaries v2 · 507e08e3
      Thomas Hellstrom authored
      commit cbd75e97 upstream.
      
      We already check that the buffer object we're accessing is registered with
      the file. Now also make sure that we can't DMA across buffer object boundaries.
      
      v2: Code commenting update.
      Signed-off-by: default avatarThomas Hellstrom <thellstrom@vmware.com>
      Reviewed-by: default avatarJakob Bornecrantz <jakob@vmware.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      507e08e3
    • Daniel Vetter's avatar
      drm/i915: Don't check gmch state on inherited configs · b646986f
      Daniel Vetter authored
      commit 9953599b upstream.
      
      ... our current modeset code isn't good enough yet to handle this. The
      scenario is:
      
      1. BIOS sets up a cloned config with lvds+external screen on the same
      pipe, e.g. pipe B.
      
      2. We read out that state for pipe B and assign the gmch_pfit state to
      it.
      
      3. The initial modeset switches the lvds to pipe A but due to lack of
      atomic modeset we don't recompute the config of pipe B.
      
      -> both pipes now claim (in the sw pipe config structure) to use the
      gmch_pfit, which just won't work.
      
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74081Tested-by: default avatarmax <manikulin@gmail.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      b646986f
    • Jarkko Nikula's avatar
      ASoC: dapm: Fix widget double free with auto-disable DAPM kcontrol · d05bebeb
      Jarkko Nikula authored
      commit 2697e4fb upstream.
      
      Commit 9e1fda4ae158 ("ASoC: dapm: Implement mixer input auto-disable")
      is trying to free the widget it allocated by snd_soc_dapm_new_control()
      call in dapm_kcontrol_data_alloc() by adding kfree(data->widget) to
      dapm_kcontrol_free().
      
      This is causing a widget double free with auto-disabled DAPM kcontrols
      in sound card unregistration because widgets are already freed before
      dapm_kcontrol_free() is called.
      
      Reason for that is all widgets are added into dapm->card->widgets list
      in snd_soc_dapm_new_control() and freed in dapm_free_widgets() during
      execution of snd_soc_dapm_free().
      
      Now snd_soc_dapm_free() calls for different DAPM contexts happens before
      snd_card_free() call from where the call chain to dapm_kcontrol_free()
      begins:
      
      soc_cleanup_card_resources()
        soc_remove_dai_links()
          soc_remove_link_dais()
            snd_soc_dapm_free(&cpu_dai->dapm)
          soc_remove_link_components()
            soc_remove_platform()
              snd_soc_dapm_free(&platform->dapm)
            soc_remove_codec()
              snd_soc_dapm_free(&codec->dapm)
        snd_soc_dapm_free(&card->dapm)
        snd_card_free()
          snd_card_do_free()
            snd_device_free_all()
              snd_device_free()
                snd_ctl_dev_free()
                  snd_ctl_remove()
                    snd_ctl_free_one()
                      dapm_kcontrol_free()
      
      This wasn't making harm with ordinary DAPM kcontrols since data->widget is NULL for
      them.
      
      Fixes: 9e1fda4ae158 (ASoC: dapm: Implement mixer input auto-disable)
      Signed-off-by: default avatarJarkko Nikula <jarkko.nikula@linux.intel.com>
      Acked-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: default avatarMark Brown <broonie@linaro.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      d05bebeb
    • Neil Greatorex's avatar
      irqchip: armada-370-xp: Fix releasing of MSIs · 51e7bfd2
      Neil Greatorex authored
      commit ff3c6645 upstream.
      
      Store the value of d->hwirq in a local variable as the real value is wiped out
      by calling irq_dispose_mapping. Without this patch, the armada_370_xp_free_msi
      function would always free MSI#0, no matter what was passed to it.
      
      Fixes: 31f614ed ('irqchip: armada-370-xp: implement MSI support')
      Signed-off-by: default avatarNeil Greatorex <neil@fatboyfat.co.uk>
      Link: https://lkml.kernel.org/r/1397823593-1932-4-git-send-email-thomas.petazzoni@free-electrons.comSigned-off-by: default avatarThomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Link: https://lkml.kernel.org/r/1397823593-1932-4-git-send-email-thomas.petazzoni@free-electrons.comSigned-off-by: default avatarJason Cooper <jason@lakedaemon.net>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      51e7bfd2