1. 15 Jul, 2014 4 commits
  2. 14 Jul, 2014 5 commits
    • Oleg Nesterov's avatar
      introduce for_each_thread() to replace the buggy while_each_thread() · e1790aea
      Oleg Nesterov authored
      commit 0c740d0a upstream.
      
      while_each_thread() and next_thread() should die, almost every lockless
      usage is wrong.
      
      1. Unless g == current, the lockless while_each_thread() is not safe.
      
         while_each_thread(g, t) can loop forever if g exits, next_thread()
         can't reach the unhashed thread in this case. Note that this can
         happen even if g is the group leader, it can exec.
      
      2. Even if while_each_thread() itself was correct, people often use
         it wrongly.
      
         It was never safe to just take rcu_read_lock() and loop unless
         you verify that pid_alive(g) == T, even the first next_thread()
         can point to the already freed/reused memory.
      
      This patch adds signal_struct->thread_head and task->thread_node to
      create the normal rcu-safe list with the stable head.  The new
      for_each_thread(g, t) helper is always safe under rcu_read_lock() as
      long as this task_struct can't go away.
      
      Note: of course it is ugly to have both task_struct->thread_node and the
      old task_struct->thread_group, we will kill it later, after we change
      the users of while_each_thread() to use for_each_thread().
      
      Perhaps we can kill it even before we convert all users, we can
      reimplement next_thread(t) using the new thread_head/thread_node.  But
      we can't do this right now because this will lead to subtle behavioural
      changes.  For example, do/while_each_thread() always sees at least one
      task, while for_each_thread() can do nothing if the whole thread group
      has died.  Or thread_group_empty(), currently its semantics is not clear
      unless thread_group_leader(p) and we need to audit the callers before we
      can change it.
      
      So this patch adds the new interface which has to coexist with the old
      one for some time, hopefully the next changes will be more or less
      straightforward and the old one will go away soon.
      Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
      Reviewed-by: default avatarSergey Dyasly <dserrg@gmail.com>
      Tested-by: default avatarSergey Dyasly <dserrg@gmail.com>
      Reviewed-by: default avatarSameer Nanda <snanda@chromium.org>
      Acked-by: default avatarDavid Rientjes <rientjes@google.com>
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Mandeep Singh Baines <msb@chromium.org>
      Cc: "Ma, Xindong" <xindong.ma@intel.com>
      Cc: Michal Hocko <mhocko@suse.cz>
      Cc: "Tu, Xiaobing" <xiaobing.tu@intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      [ kamal: 3.13-stable for backport convenience ]
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      e1790aea
    • Florian Westphal's avatar
      netfilter: nf_nat: fix oops on netns removal · d17b4c8f
      Florian Westphal authored
      commit 945b2b2d upstream.
      
      Quoting Samu Kallio:
      
       Basically what's happening is, during netns cleanup,
       nf_nat_net_exit gets called before ipv4_net_exit. As I understand
       it, nf_nat_net_exit is supposed to kill any conntrack entries which
       have NAT context (through nf_ct_iterate_cleanup), but for some
       reason this doesn't happen (perhaps something else is still holding
       refs to those entries?).
      
       When ipv4_net_exit is called, conntrack entries (including those
       with NAT context) are cleaned up, but the
       nat_bysource hashtable is long gone - freed in nf_nat_net_exit. The
       bug happens when attempting to free a conntrack entry whose NAT hash
       'prev' field points to a slot in the freed hash table (head for that
       bin).
      
      We ignore conntracks with null nat bindings.  But this is wrong,
      as these are in bysource hash table as well.
      
      Restore nat-cleaning for the netns-is-being-removed case.
      
      bug:
      https://bugzilla.kernel.org/show_bug.cgi?id=65191
      
      Fixes: c2d421e1 ('netfilter: nf_nat: fix race when unloading protocol modules')
      Reported-by: default avatarSamu Kallio <samu.kallio@aberdeencloud.com>
      Debugged-by: default avatarSamu Kallio <samu.kallio@aberdeencloud.com>
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Tested-by: default avatarSamu Kallio <samu.kallio@aberdeencloud.com>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Cc: Chris J Arges <chris.j.arges@canonical.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      d17b4c8f
    • Todd Fujinaka's avatar
      igb: fix stats for i210 rx_fifo_errors · e857a038
      Todd Fujinaka authored
      commit e66c083a upstream.
      
      RQDPC on i210/i211 is R/W not ReadClear. Clear after reading.
      Signed-off-by: default avatarTodd Fujinaka <todd.fujinaka@intel.com>
      Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      Cc: Tim Gardner <tim.gardner@canonical.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      e857a038
    • Johan Hedberg's avatar
      Bluetooth: Fix check for connection encryption · 44daeeb6
      Johan Hedberg authored
      commit e694788d upstream.
      
      The conn->link_key variable tracks the type of link key in use. It is
      set whenever we respond to a link key request as well as when we get a
      link key notification event.
      
      These two events do not however always guarantee that encryption is
      enabled: getting a link key request and responding to it may only mean
      that the remote side has requested authentication but not encryption. On
      the other hand, the encrypt change event is a certain guarantee that
      encryption is enabled. The real encryption state is already tracked in
      the conn->link_mode variable through the HCI_LM_ENCRYPT bit.
      
      This patch fixes a check for encryption in the hci_conn_auth function to
      use the proper conn->link_mode value and thereby eliminates the chance
      of a false positive result.
      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>
      44daeeb6
    • Johan Hedberg's avatar
      Bluetooth: Fix redundant encryption request for reauthentication · b41dde19
      Johan Hedberg authored
      commit 09da1f34 upstream.
      
      When we're performing reauthentication (in order to elevate the
      security level from an unauthenticated key to an authenticated one) we
      do not need to issue any encryption command once authentication
      completes. Since the trigger for the encryption HCI command is the
      ENCRYPT_PEND flag this flag should not be set in this scenario.
      Instead, the REAUTH_PEND flag takes care of all necessary steps for
      reauthentication.
      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>
      b41dde19
  3. 23 Jun, 2014 1 commit
  4. 20 Jun, 2014 3 commits
  5. 18 Jun, 2014 1 commit
  6. 17 Jun, 2014 26 commits
    • Naoya Horiguchi's avatar
      mm: add !pte_present() check on existing hugetlb_entry callbacks · 28f3b5f1
      Naoya Horiguchi authored
      commit d4c54919 upstream.
      
      The age table walker doesn't check non-present hugetlb entry in common
      path, so hugetlb_entry() callbacks must check it.  The reason for this
      behavior is that some callers want to handle it in its own way.
      
      [ I think that reason is bogus, btw - it should just do what the regular
        code does, which is to call the "pte_hole()" function for such hugetlb
        entries  - Linus]
      
      However, some callers don't check it now, which causes unpredictable
      result, for example when we have a race between migrating hugepage and
      reading /proc/pid/numa_maps.  This patch fixes it by adding !pte_present
      checks on buggy callbacks.
      
      This bug exists for years and got visible by introducing hugepage
      migration.
      
      ChangeLog v2:
      - fix if condition (check !pte_present() instead of pte_present())
      Reported-by: default avatarSasha Levin <sasha.levin@oracle.com>
      Signed-off-by: default avatarNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Cc: Rik van Riel <riel@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      [ Backported to 3.15.  Signed-off-by: Josh Boyer <jwboyer@fedoraproject.org> ]
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      28f3b5f1
    • Andrey Ryabinin's avatar
      mm: rmap: fix use-after-free in __put_anon_vma · 55cf8656
      Andrey Ryabinin authored
      commit 624483f3 upstream.
      
      While working address sanitizer for kernel I've discovered
      use-after-free bug in __put_anon_vma.
      
      For the last anon_vma, anon_vma->root freed before child anon_vma.
      Later in anon_vma_free(anon_vma) we are referencing to already freed
      anon_vma->root to check rwsem.
      
      This fixes it by freeing the child anon_vma before freeing
      anon_vma->root.
      Signed-off-by: default avatarAndrey Ryabinin <a.ryabinin@samsung.com>
      Acked-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      55cf8656
    • Nicholas Bellinger's avatar
      target: Fix alua_access_state attribute OOPs for un-configured devices · 3d679c3b
      Nicholas Bellinger authored
      commit f1453773 upstream.
      
      This patch fixes a OOPs where an attempt to write to the per-device
      alua_access_state configfs attribute at:
      
        /sys/kernel/config/target/core/$HBA/$DEV/alua/$TG_PT_GP/alua_access_state
      
      results in an NULL pointer dereference when the backend device has not
      yet been configured.
      
      This patch adds an explicit check for DF_CONFIGURED, and fails with
      -ENODEV to avoid this case.
      Reported-by: default avatarChris Boot <crb@tiger-computing.co.uk>
      Reported-by: default avatarPhilip Gaw <pgaw@darktech.org.uk>
      Cc: Chris Boot <crb@tiger-computing.co.uk>
      Cc: Philip Gaw <pgaw@darktech.org.uk>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      3d679c3b
    • Thomas Gleixner's avatar
      futex: Make lookup_pi_state more robust · 11b18bcc
      Thomas Gleixner authored
      commit 54a21788 upstream.
      
      The current implementation of lookup_pi_state has ambigous handling of
      the TID value 0 in the user space futex.  We can get into the kernel
      even if the TID value is 0, because either there is a stale waiters bit
      or the owner died bit is set or we are called from the requeue_pi path
      or from user space just for fun.
      
      The current code avoids an explicit sanity check for pid = 0 in case
      that kernel internal state (waiters) are found for the user space
      address.  This can lead to state leakage and worse under some
      circumstances.
      
      Handle the cases explicit:
      
             Waiter | pi_state | pi->owner | uTID      | uODIED | ?
      
        [1]  NULL   | ---      | ---       | 0         | 0/1    | Valid
        [2]  NULL   | ---      | ---       | >0        | 0/1    | Valid
      
        [3]  Found  | NULL     | --        | Any       | 0/1    | Invalid
      
        [4]  Found  | Found    | NULL      | 0         | 1      | Valid
        [5]  Found  | Found    | NULL      | >0        | 1      | Invalid
      
        [6]  Found  | Found    | task      | 0         | 1      | Valid
      
        [7]  Found  | Found    | NULL      | Any       | 0      | Invalid
      
        [8]  Found  | Found    | task      | ==taskTID | 0/1    | Valid
        [9]  Found  | Found    | task      | 0         | 0      | Invalid
        [10] Found  | Found    | task      | !=taskTID | 0/1    | Invalid
      
       [1] Indicates that the kernel can acquire the futex atomically. We
           came came here due to a stale FUTEX_WAITERS/FUTEX_OWNER_DIED bit.
      
       [2] Valid, if TID does not belong to a kernel thread. If no matching
           thread is found then it indicates that the owner TID has died.
      
       [3] Invalid. The waiter is queued on a non PI futex
      
       [4] Valid state after exit_robust_list(), which sets the user space
           value to FUTEX_WAITERS | FUTEX_OWNER_DIED.
      
       [5] The user space value got manipulated between exit_robust_list()
           and exit_pi_state_list()
      
       [6] Valid state after exit_pi_state_list() which sets the new owner in
           the pi_state but cannot access the user space value.
      
       [7] pi_state->owner can only be NULL when the OWNER_DIED bit is set.
      
       [8] Owner and user space value match
      
       [9] There is no transient state which sets the user space TID to 0
           except exit_robust_list(), but this is indicated by the
           FUTEX_OWNER_DIED bit. See [4]
      
      [10] There is no transient state which leaves owner and user space
           TID out of sync.
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Will Drewry <wad@chromium.org>
      Cc: Darren Hart <dvhart@linux.intel.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      11b18bcc
    • Thomas Gleixner's avatar
      futex: Always cleanup owner tid in unlock_pi · 68ef685c
      Thomas Gleixner authored
      commit 13fbca4c upstream.
      
      If the owner died bit is set at futex_unlock_pi, we currently do not
      cleanup the user space futex.  So the owner TID of the current owner
      (the unlocker) persists.  That's observable inconsistant state,
      especially when the ownership of the pi state got transferred.
      
      Clean it up unconditionally.
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Will Drewry <wad@chromium.org>
      Cc: Darren Hart <dvhart@linux.intel.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      68ef685c
    • Thomas Gleixner's avatar
      futex: Validate atomic acquisition in futex_lock_pi_atomic() · 42f2b1ac
      Thomas Gleixner authored
      commit b3eaa9fc upstream.
      
      We need to protect the atomic acquisition in the kernel against rogue
      user space which sets the user space futex to 0, so the kernel side
      acquisition succeeds while there is existing state in the kernel
      associated to the real owner.
      
      Verify whether the futex has waiters associated with kernel state.  If
      it has, return -EINVAL.  The state is corrupted already, so no point in
      cleaning it up.  Subsequent calls will fail as well.  Not our problem.
      
      [ tglx: Use futex_top_waiter() and explain why we do not need to try
        	restoring the already corrupted user space state. ]
      Signed-off-by: default avatarDarren Hart <dvhart@linux.intel.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Will Drewry <wad@chromium.org>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      42f2b1ac
    • Thomas Gleixner's avatar
      futex-prevent-requeue-pi-on-same-futex.patch futex: Forbid uaddr == uaddr2 in... · 55fabc28
      Thomas Gleixner authored
      futex-prevent-requeue-pi-on-same-futex.patch futex: Forbid uaddr == uaddr2 in futex_requeue(..., requeue_pi=1)
      
      commit e9c243a5 upstream.
      
      If uaddr == uaddr2, then we have broken the rule of only requeueing from
      a non-pi futex to a pi futex with this call.  If we attempt this, then
      dangling pointers may be left for rt_waiter resulting in an exploitable
      condition.
      
      This change brings futex_requeue() in line with futex_wait_requeue_pi()
      which performs the same check as per commit 6f7b0a2a ("futex: Forbid
      uaddr == uaddr2 in futex_wait_requeue_pi()")
      
      [ tglx: Compare the resulting keys as well, as uaddrs might be
        	different depending on the mapping ]
      
      Fixes CVE-2014-3153.
      
      Reported-by: Pinkie Pie
      Signed-off-by: default avatarWill Drewry <wad@chromium.org>
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: default avatarDarren Hart <dvhart@linux.intel.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      55fabc28
    • Sebastian Ott's avatar
      percpu-refcount: fix usage of this_cpu_ops · d103b9d5
      Sebastian Ott authored
      commit 0c36b390 upstream.
      
      The percpu-refcount infrastructure uses the underscore variants of
      this_cpu_ops in order to modify percpu reference counters.
      (e.g. __this_cpu_inc()).
      
      However the underscore variants do not atomically update the percpu
      variable, instead they may be implemented using read-modify-write
      semantics (more than one instruction).  Therefore it is only safe to
      use the underscore variant if the context is always the same (process,
      softirq, or hardirq). Otherwise it is possible to lose updates.
      
      This problem is something that Sebastian has seen within the aio
      subsystem which uses percpu refcounters both in process and softirq
      context leading to reference counts that never dropped to zeroes; even
      though the number of "get" and "put" calls matched.
      
      Fix this by using the non-underscore this_cpu_ops variant which
      provides correct per cpu atomic semantics and fixes the corrupted
      reference counts.
      
      Cc: Kent Overstreet <kmo@daterainc.com>
      Reported-by: default avatarSebastian Ott <sebott@linux.vnet.ibm.com>
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      References: http://lkml.kernel.org/g/alpine.LFD.2.11.1406041540520.21183@denkbrettSigned-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      d103b9d5
    • Roland Dreier's avatar
      iscsi-target: Fix wrong buffer / buffer overrun in iscsi_change_param_value() · caea43f2
      Roland Dreier authored
      commit 79d59d08 upstream.
      
      In non-leading connection login, iscsi_login_non_zero_tsih_s1() calls
      iscsi_change_param_value() with the buffer it uses to hold the login
      PDU, not a temporary buffer.  This leads to the login header getting
      corrupted and login failing for non-leading connections in MC/S.
      
      Fix this by adding a wrapper iscsi_change_param_sprintf() that handles
      the temporary buffer itself to avoid confusion.  Also handle sending a
      reject in case of failure in the wrapper, which lets the calling code
      get quite a bit smaller and easier to read.
      
      Finally, bump the size of the temporary buffer from 32 to 64 bytes to be
      safe, since "MaxRecvDataSegmentLength=" by itself is 25 bytes; with a
      trailing NUL, a value >= 1M will lead to a buffer overrun.  (This isn't
      the default but we don't need to run right at the ragged edge here)
      Reported-by: default avatarSantosh Kulkarni <santosh.kulkarni@calsoftinc.com>
      Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      [ kamal: backport to 3.13-stable: omit inapplicable bit from
        iscsi_login_zero_tsih_s2 ]
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      caea43f2
    • Nicholas Bellinger's avatar
      iser-target: Add missing target_put_sess_cmd for ImmedateData failure · e4696650
      Nicholas Bellinger authored
      commit 6cc44a6f upstream.
      
      This patch addresses a bug where an early exception for SCSI WRITE
      with ImmediateData=Yes was missing the target_put_sess_cmd() call
      to drop the extra se_cmd->cmd_kref reference obtained during the
      normal iscsit_setup_scsi_cmd() codepath execution.
      
      This bug was manifesting itself during session shutdown within
      isert_cq_rx_comp_err() where target_wait_for_sess_cmds() would
      end up waiting indefinately for the last se_cmd->cmd_kref put to
      occur for the failed SCSI WRITE + ImmediateData descriptors.
      
      This fix follows what traditional iscsi-target code already does
      for the same failure case within iscsit_get_immediate_data().
      Reported-by: default avatarSagi Grimberg <sagig@dev.mellanox.co.il>
      Cc: Sagi Grimberg <sagig@dev.mellanox.co.il>
      Cc: Or Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      e4696650
    • Takashi Iwai's avatar
      ALSA: hda/realtek - Fix COEF widget NID for ALC260 replacer fixup · a395fc12
      Takashi Iwai authored
      commit 192a98e2 upstream.
      
      The conversion to a fixup table for Replacer model with ALC260 in
      commit 20f7d928 took the wrong widget NID for COEF setups.  Namely,
      NID 0x1a should have been used instead of NID 0x20, which is the
      common node for all Realtek codecs but ALC260.
      
      Fixes: 20f7d928 ('ALSA: hda/realtek - Replace ALC260 model=replacer with the auto-parser')
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      a395fc12
    • Ronan Marquet's avatar
      ALSA: hda/realtek - Correction of fixup codes for PB V7900 laptop · dd11e808
      Ronan Marquet authored
      commit e30cf2d2 upstream.
      
      Correcion of wrong fixup entries add in commit ca8f0424 to replace
      static model quirk for PB V7900 laptop (will model).
      
      [note: the removal of ALC260_FIXUP_HP_PIN_0F chain is also needed as a
       part of the fix; otherwise the pin is set up wrongly as a headphone,
       and user-space (PulseAudio) may be wrongly trying to detect the jack
       state -- tiwai]
      
      Fixes: ca8f0424 ('ALSA: hda/realtek - Add the fixup codes for ALC260 model=will')
      Signed-off-by: default avatarRonan Marquet <ronan.marquet@orange.fr>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      dd11e808
    • Christian König's avatar
      drm/radeon: use the CP DMA on CIK · 60d9c087
      Christian König authored
      commit 91b0275c upstream.
      
      The SDMA sometimes doesn't seem to work reliable.
      Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      60d9c087
    • Alex Deucher's avatar
      drm/radeon/dpm: resume fixes for some systems · 8a4f8b94
      Alex Deucher authored
      commit 3640da2f upstream.
      
      Setting the power state prior to restoring the display
      hardware leads to blank screens on some systems.  Drop
      the power state set from dpm resume.  The power state
      will get set as part of the mode set sequence.  Also
      add an explicit power state set after mode set resume
      to cover PX and headless systems.
      
      bug:
      https://bugzilla.kernel.org/show_bug.cgi?id=76761Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      [ kamal: backport to 3.13-stable: context ]
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      8a4f8b94
    • Takashi Iwai's avatar
      ALSA: hda/analog - Fix silent output on ASUS A8JN · 7d942a78
      Takashi Iwai authored
      commit 598e3061 upstream.
      
      ASUS A8JN with AD1986A codec seems following the normal EAPD in the
      normal order (0 = off, 1 = on) unlike other machines with AD1986A.
      Apply the workaround used for Toshiba laptop that showed the same
      problem.
      
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=75041Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      7d942a78
    • NeilBrown's avatar
      md: always set MD_RECOVERY_INTR when interrupting a reshape thread. · 516b5bba
      NeilBrown authored
      commit 2ac295a5 upstream.
      
      Commit 8313b8e5
         md: fix problem when adding device to read-only array with bitmap.
      
      added a called to md_reap_sync_thread() which cause a reshape thread
      to be interrupted (in particular, it could cause md_thread() to never even
      call md_do_sync()).
      However it didn't set MD_RECOVERY_INTR so ->finish_reshape() would not
      know that the reshape didn't complete.
      
      This only happens when mddev->ro is set and normally reshape threads
      don't run in that situation.  But raid5 and raid10 can start a reshape
      thread during "run" is the array is in the middle of a reshape.
      They do this even if ->ro is set.
      
      So it is best to set MD_RECOVERY_INTR before abortingg the
      sync thread, just in case.
      
      Though it rare for this to trigger a problem it can cause data corruption
      because the reshape isn't finished properly.
      So it is suitable for any stable which the offending commit was applied to.
      (3.2 or later)
      
      Fixes: 8313b8e5Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      516b5bba
    • Mathias Nyman's avatar
      xhci: delete endpoints from bandwidth list before freeing whole device · 1e207c7d
      Mathias Nyman authored
      commit 5dc2808c upstream.
      
      Lists of endpoints are stored for bandwidth calculation for roothub ports.
      Make sure we remove all endpoints from the list before the whole device,
      containing its endpoints list_head stuctures, is freed.
      
      This used to be done in the wrong order in xhci_mem_cleanup(),
      and triggered an oops in resume from S4 (hibernate).
      Tested-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      1e207c7d
    • NeilBrown's avatar
      md: always set MD_RECOVERY_INTR when aborting a reshape or other "resync". · 1a388f0a
      NeilBrown authored
      commit 3991b31e upstream.
      
      If mddev->ro is set, md_to_sync will (correctly) abort.
      However in that case MD_RECOVERY_INTR isn't set.
      
      If a RESHAPE had been requested, then ->finish_reshape() will be
      called and it will think the reshape was successful even though
      nothing happened.
      
      Normally a resync will not be requested if ->ro is set, but if an
      array is stopped while a reshape is on-going, then when the array is
      started, the reshape will be restarted.  If the array is also set
      read-only at this point, the reshape will instantly appear to success,
      resulting in data corruption.
      
      Consequently, this patch is suitable for any -stable kernel.
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      1a388f0a
    • Greg Kroah-Hartman's avatar
      USB: cdc-wdm: properly include types.h · aa5d8c69
      Greg Kroah-Hartman authored
      commit 7ac3764f upstream.
      
      The file include/uapi/linux/usb/cdc-wdm.h uses a __u16 so it needs to
      include types.h as well to make the build system happy.
      
      Fixes: 3edce1cf ("USB: cdc-wdm: implement IOCTL_WDM_MAX_COMMAND")
      Cc: Bjørn Mork <bjorn@mork.no>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      aa5d8c69
    • Alexej Starschenko's avatar
      USB: serial: option: add support for Novatel E371 PCIe card · d3c895b7
      Alexej Starschenko authored
      commit 8a61ba3a upstream.
      
      Adds product ID for the Novatel E371 PCI Express Mini Card.
      
      $ lsusb
      Bus 001 Device 024: ID 1410:9011 Novatel Wireless
      
      $ usb-devices
      T:  Bus=01 Lev=01 Prnt=01 Port=03 Cnt=01 Dev#= 24 Spd=480 MxCh= 0
      D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=1410 ProdID=9011 Rev=00.03
      S:  Manufacturer=Novatel Wireless, Inc.
      S:  Product=Novatel Wireless HSPA
      S:  SerialNumber=012773002115811
      C:  #Ifs= 6 Cfg#= 1 Atr=e0 MxPwr=500mA
      I:  If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
      I:  If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
      I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
      I:  If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
      I:  If#= 6 Alt= 0 #EPs= 1 Cls=02(commc) Sub=06 Prot=00 Driver=cdc_ether
      I:  If#= 7 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
      
      Tested with kernel 3.2.0.
      Signed-off-by: default avatarAlexej Starschenko <starschenko@gmail.com>
      Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      d3c895b7
    • George McCollister's avatar
      USB: ftdi_sio: add NovaTech OrionLXm product ID · bf3729d7
      George McCollister authored
      commit d0839d75 upstream.
      
      The NovaTech OrionLXm uses an onboard FTDI serial converter for JTAG and
      console access.
      
      Here is the lsusb output:
      Bus 004 Device 123: ID 0403:7c90 Future Technology Devices
      International, Ltd
      Signed-off-by: default avatarGeorge McCollister <george.mccollister@gmail.com>
      Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      bf3729d7
    • Johan Hovold's avatar
      USB: io_ti: fix firmware download on big-endian machines (part 2) · 311b9920
      Johan Hovold authored
      commit c03890ff upstream.
      
      A recent patch that purported to fix firmware download on big-endian
      machines failed to add the corresponding sparse annotation to the
      i2c-header. This was reported by the kbuild test robot.
      
      Adding the appropriate annotation revealed another endianess bug related
      to the i2c-header Size-field in a code path that is exercised when the
      firmware is actually being downloaded (and not just verified and left
      untouched unless older than the firmware at hand).
      
      This patch adds the required sparse annotation to the i2c-header and
      makes sure that the Size-field is sent in little-endian byte order
      during firmware download also on big-endian machines.
      
      Note that this patch is only compile-tested, but that there is no
      functional change for little-endian systems.
      Reported-by: default avatarkbuild test robot <fengguang.wu@intel.com>
      Cc: Ludovic Drolez <ldrolez@debian.org>
      Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      311b9920
    • Oliver Hartkopp's avatar
      can: only rename enabled led triggers when changing the netdev name · d1ed8e48
      Oliver Hartkopp authored
      commit 45fb4f8d upstream.
      
      Commit a1ef7bd9 ("can: rename LED trigger name on netdev renames") renames
      the led trigger names according to the changed netdevice name.
      
      As not every CAN driver supports and initializes the led triggers, checking for
      the CAN private datastructure with safe_candev_priv() in the notifier chain is
      not enough.
      
      This patch adds a check when CONFIG_CAN_LEDS is enabled and the driver does not
      support led triggers.
      
      For stable 3.9+
      
      Cc: Fabio Baltieri <fabio.baltieri@gmail.com>
      Signed-off-by: default avatarOliver Hartkopp <socketcan@hartkopp.net>
      Acked-by: default avatarKurt Van Dijck <dev.kurt@vandijck-laurijssen.be>
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      d1ed8e48
    • Alan Stern's avatar
      USB: Avoid runtime suspend loops for HCDs that can't handle suspend/resume · f4addd70
      Alan Stern authored
      commit 8ef42ddd upstream.
      
      Not all host controller drivers have bus-suspend and bus-resume
      methods.  When one doesn't, it will cause problems if runtime PM is
      enabled in the kernel.  The PM core will attempt to suspend the
      controller's root hub, the suspend will fail because there is no
      bus-suspend routine, and a -EBUSY error code will be returned to the
      PM core.  This will cause the suspend attempt to be repeated shortly
      thereafter, in a never-ending loop.
      
      Part of the problem is that the original error code -ENOENT gets
      changed to -EBUSY in usb_runtime_suspend(), on the grounds that the PM
      core will interpret -ENOENT as meaning that the root hub has gotten
      into a runtime-PM error state.  While this change is appropriate for
      real USB devices, it's not such a good idea for a root hub.  In fact,
      considering the root hub to be in a runtime-PM error state would not
      be far from the truth.  Therefore this patch updates
      usb_runtime_suspend() so that it adjusts error codes only for
      non-root-hub devices.
      
      Furthermore, the patch attempts to prevent the problem from occurring
      in the first place by not enabling runtime PM by default for root hubs
      whose host controller driver doesn't have bus_suspend and bus_resume
      methods.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Reported-by: default avatarWill Deacon <will.deacon@arm.com>
      Tested-by: default avatarWill Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      f4addd70
    • Ben Hutchings's avatar
      Staging: speakup: Move pasting into a work item · 39740c6f
      Ben Hutchings authored
      commit d7500135 upstream.
      
      Input is handled in softirq context, but when pasting we may
      need to sleep.  speakup_paste_selection() currently tries to
      bodge this by busy-waiting if in_atomic(), but that doesn't
      help because the ldisc may also sleep.
      
      For bonus breakage, speakup_paste_selection() changes the
      state of current, even though it's not running in process
      context.
      
      Move it into a work item and make sure to cancel it on exit.
      
      References: https://bugs.debian.org/735202
      References: https://bugs.debian.org/744015Reported-by: default avatarPaul Gevers <elbrus@debian.org>
      Reported-and-tested-by: default avatarJarek Czekalski <jarekczek@poczta.onet.pl>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      39740c6f
    • Emmanuel Grumbach's avatar
      iwlwifi: mvm: fix setting channel in monitor mode · 1413ca2b
      Emmanuel Grumbach authored
      commit 1c4abec0 upstream.
      
      There was a deadlock in monitor mode when we were setting the
      channel if the channel was not 1.
      
      ======================================================
      [ INFO: possible circular locking dependency detected ]
      3.14.3 #4 Not tainted
      -------------------------------------------------------
      iw/3323 is trying to acquire lock:
       (&local->chanctx_mtx){+.+.+.}, at: [<ffffffffa062e2f2>] ieee80211_vif_release_channel+0x42/0xb0 [mac80211]
      
      but task is already holding lock:
       (&local->iflist_mtx){+.+...}, at: [<ffffffffa0609e0a>] ieee80211_set_monitor_channel+0x5a/0x1b0 [mac80211]
      
      which lock already depends on the new lock.
      
      the existing dependency chain (in reverse order) is:
      
      -> #2 (&local->iflist_mtx){+.+...}:
             [<ffffffff810d95bb>] __lock_acquire+0xb3b/0x13b0
             [<ffffffff810d9ee0>] lock_acquire+0xb0/0x1f0
             [<ffffffff817eb9c8>] mutex_lock_nested+0x78/0x4f0
             [<ffffffffa06225cf>] ieee80211_iterate_active_interfaces+0x2f/0x60 [mac80211]
             [<ffffffffa0518189>] iwl_mvm_recalc_multicast+0x49/0xa0 [iwlmvm]
             [<ffffffffa051822e>] iwl_mvm_configure_filter+0x4e/0x70 [iwlmvm]
             [<ffffffffa05e6d43>] ieee80211_configure_filter+0x153/0x5f0 [mac80211]
             [<ffffffffa05e71f5>] ieee80211_reconfig_filter+0x15/0x20 [mac80211]
             [snip]
      
      -> #1 (&mvm->mutex){+.+.+.}:
             [<ffffffff810d95bb>] __lock_acquire+0xb3b/0x13b0
             [<ffffffff810d9ee0>] lock_acquire+0xb0/0x1f0
             [<ffffffff817eb9c8>] mutex_lock_nested+0x78/0x4f0
             [<ffffffffa0517246>] iwl_mvm_add_chanctx+0x56/0xe0 [iwlmvm]
             [<ffffffffa062ca1e>] ieee80211_new_chanctx+0x13e/0x410 [mac80211]
             [<ffffffffa062d953>] ieee80211_vif_use_channel+0x1c3/0x5a0 [mac80211]
             [<ffffffffa06035ab>] ieee80211_add_virtual_monitor+0x1ab/0x6b0 [mac80211]
             [<ffffffffa06052ea>] ieee80211_do_open+0xe6a/0x15a0 [mac80211]
             [<ffffffffa0605a79>] ieee80211_open+0x59/0x60 [mac80211]
             [snip]
      
      -> #0 (&local->chanctx_mtx){+.+.+.}:
             [<ffffffff810d6cb7>] check_prevs_add+0x977/0x980
             [<ffffffff810d95bb>] __lock_acquire+0xb3b/0x13b0
             [<ffffffff810d9ee0>] lock_acquire+0xb0/0x1f0
             [<ffffffff817eb9c8>] mutex_lock_nested+0x78/0x4f0
             [<ffffffffa062e2f2>] ieee80211_vif_release_channel+0x42/0xb0 [mac80211]
             [<ffffffffa0609ec3>] ieee80211_set_monitor_channel+0x113/0x1b0 [mac80211]
             [<ffffffffa058fb37>] cfg80211_set_monitor_channel+0x77/0x2b0 [cfg80211]
             [<ffffffffa056e0b2>] __nl80211_set_channel+0x122/0x140 [cfg80211]
             [<ffffffffa0581374>] nl80211_set_wiphy+0x284/0xaf0 [cfg80211]
             [snip]
      
      other info that might help us debug this:
      
      Chain exists of:
        &local->chanctx_mtx --> &mvm->mutex --> &local->iflist_mtx
      
       Possible unsafe locking scenario:
      
             CPU0                    CPU1
             ----                    ----
        lock(&local->iflist_mtx);
                                     lock(&mvm->mutex);
                                     lock(&local->iflist_mtx);
        lock(&local->chanctx_mtx);
      
       *** DEADLOCK ***
      
      This deadlock actually occurs:
      INFO: task iw:3323 blocked for more than 120 seconds.
            Not tainted 3.14.3 #4
      "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
      iw              D ffff8800c8afcd80  4192  3323   3322 0x00000000
       ffff880078fdb7e0 0000000000000046 ffff8800c8afcd80 ffff880078fdbfd8
       00000000001d5540 00000000001d5540 ffff8801141b0000 ffff8800c8afcd80
       ffff880078ff9e38 ffff880078ff9e38 ffff880078ff9e40 0000000000000246
      Call Trace:
       [<ffffffff817ea841>] schedule_preempt_disabled+0x31/0x80
       [<ffffffff817ebaed>] mutex_lock_nested+0x19d/0x4f0
       [<ffffffffa06225cf>] ? ieee80211_iterate_active_interfaces+0x2f/0x60 [mac80211]
       [<ffffffffa06225cf>] ? ieee80211_iterate_active_interfaces+0x2f/0x60 [mac80211]
       [<ffffffffa052a680>] ? iwl_mvm_power_mac_update_mode+0xc0/0xc0 [iwlmvm]
       [<ffffffffa06225cf>] ieee80211_iterate_active_interfaces+0x2f/0x60 [mac80211]
       [<ffffffffa0529357>] _iwl_mvm_power_update_binding+0x27/0x80 [iwlmvm]
       [<ffffffffa0516eb1>] iwl_mvm_unassign_vif_chanctx+0x81/0xc0 [iwlmvm]
       [<ffffffffa062d3ff>] __ieee80211_vif_release_channel+0xdf/0x470 [mac80211]
       [<ffffffffa062e2fa>] ieee80211_vif_release_channel+0x4a/0xb0 [mac80211]
       [<ffffffffa0609ec3>] ieee80211_set_monitor_channel+0x113/0x1b0 [mac80211]
       [<ffffffffa058fb37>] cfg80211_set_monitor_channel+0x77/0x2b0 [cfg80211]
       [<ffffffffa056e0b2>] __nl80211_set_channel+0x122/0x140 [cfg80211]
       [<ffffffffa0581374>] nl80211_set_wiphy+0x284/0xaf0 [cfg80211]
      
      This fixes https://bugzilla.kernel.org/show_bug.cgi?id=75541Reviewed-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
      [ kamal: backport to 3.13: omit iwl_mvm_recalc_multicast change (not impl.) ]
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      1413ca2b