1. 19 Feb, 2015 40 commits
    • Nadav Amit's avatar
      KVM: x86: Fix of previously incomplete fix for CVE-2014-8480 · 1708c31e
      Nadav Amit authored
      STR and SLDT with rip-relative operand can cause a host kernel oops.
      Mark them as DstMem as well.
      
      Cc: stable@vger.linux.org
      Signed-off-by: default avatarNadav Amit <namit@cs.technion.ac.il>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      
      (cherry picked from commit 63ea0a49)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      1708c31e
    • Alexandre Demers's avatar
      x86/tsc: Change Fast TSC calibration failed from error to info · 2cfb161c
      Alexandre Demers authored
      Many users see this message when booting without knowning that it is
      of no importance and that TSC calibration may have succeeded by
      another way.
      
      As explained by Paul Bolle in
      http://lkml.kernel.org/r/1348488259.1436.22.camel@x61.thuisdomein
      
        "Fast TSC calibration failed" should not be considered as an error
        since other calibration methods are being tried afterward. At most,
        those send a warning if they fail (not an error). So let's change
        the message from error to warning.
      
      [ tglx: Make if pr_info. It's really not important at all ]
      
      Fixes: c767a54b x86/debug: Add KERN_<LEVEL> to bare printks, convert printks to pr_<level>
      Signed-off-by: default avatarAlexandre Demers <alexandre.f.demers@gmail.com>
      Cc: stable@vger.kernel.org
      Link: http://lkml.kernel.org/r/1418106470-6906-1-git-send-email-alexandre.f.demers@gmail.comSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      
      (cherry picked from commit 52045217)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      2cfb161c
    • K. Y. Srinivasan's avatar
      x86, hyperv: Mark the Hyper-V clocksource as being continuous · 08fcd8f5
      K. Y. Srinivasan authored
      The Hyper-V clocksource is continuous; mark it accordingly.
      Signed-off-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
      Acked-by: jasowang@redhat.com
      Cc: gregkh@linuxfoundation.org
      Cc: devel@linuxdriverproject.org
      Cc: olaf@aepfle.de
      Cc: apw@canonical.com
      Cc: stable@vger.kernel.org
      Link: http://lkml.kernel.org/r/1421108762-3331-1-git-send-email-kys@microsoft.comSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      
      (cherry picked from commit 32c6590d)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      08fcd8f5
    • Fabio Estevam's avatar
      ARM: dts: imx25: Fix PWM "per" clocks · b95a2f41
      Fabio Estevam authored
      Currently PWM functionality is broken on mx25 due to the wrong assignment of the
      PWM "per" clock.
      
      According to Documentation/devicetree/bindings/clock/imx25-clock.txt:
      	pwm_ipg_per		52
      
      ,so update the pwm "per" to use 'pwm_ipg_per' instead of 'per10' clock.
      
      With this change PWM can work fine on mx25.
      
      Cc: <stable@vger.kernel.org>
      Reported-by: default avatarCarlos Soto <csotoalonso@gmail.com>
      Signed-off-by: default avatarFabio Estevam <fabio.estevam@freescale.com>
      Signed-off-by: default avatarShawn Guo <shawn.guo@linaro.org>
      
      (cherry picked from commit 7ecd0bde)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      b95a2f41
    • Yinghai Lu's avatar
      PCI: Add pci_claim_bridge_resource() to clip window if necessary · 34991580
      Yinghai Lu authored
      Add pci_claim_bridge_resource() to claim a PCI-PCI bridge window.  This is
      like regular pci_claim_resource(), except that if we fail to claim the
      window, we check to see if we can reduce the size of the window and try
      again.
      
      This is for scenarios like this:
      
        pci_bus 0000:00: root bus resource [mem 0xc0000000-0xffffffff]
        pci 0000:00:01.0:   bridge window [mem 0xbdf00000-0xddefffff 64bit pref]
        pci 0000:01:00.0: reg 0x10: [mem 0xc0000000-0xcfffffff pref]
      
      The 00:01.0 window is illegal: it starts before the host bridge window, so
      we have to assume the [0xbdf00000-0xbfffffff] region is inaccessible.  We
      can make it legal by clipping it to [mem 0xc0000000-0xddefffff 64bit pref].
      
      Previously we discarded the 00:01.0 window and tried to reassign that part
      of the hierarchy from scratch.  That is a problem because Linux doesn't
      always assign things optimally.  For example, in this case, BIOS put the
      01:00.0 device in a prefetchable window below 4GB, but after 5b285415,
      Linux puts the prefetchable window above 4GB where the 32-bit 01:00.0
      device can't use it.
      
      Clipping the 00:01.0 window is less intrusive than completely reassigning
      things and is sufficient to let us use most of the BIOS configuration.  Of
      course, it's possible that devices below 00:01.0 will no longer fit.  If
      that's the case, we'll have to reassign things.  But that's a separate
      problem.
      
      [bhelgaas: changelog, split into separate patch]
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=85491Reported-by: default avatarMarek Kordik <kordikmarek@gmail.com>
      Fixes: 5b285415 ("PCI: Restrict 64-bit prefetchable bridge windows to 64-bit resources")
      Signed-off-by: default avatarYinghai Lu <yinghai@kernel.org>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      CC: stable@vger.kernel.org	# v3.16+
      
      (cherry picked from commit 8505e729)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      34991580
    • Chris Wilson's avatar
      drm/i915: Fix mutex->owner inspection race under DEBUG_MUTEXES · 8eb2bfe5
      Chris Wilson authored
      commit 226e5ae9 upstream.
      
      If CONFIG_DEBUG_MUTEXES is set, the mutex->owner field is only cleared
      if the mutex debugging is enabled which introduces a race in our
      mutex_is_locked_by() - i.e. we may inspect the old owner value before it
      is acquired by the new task.
      
      This is the root cause of this error:
      
      # diff --git a/kernel/locking/mutex-debug.c b/kernel/locking/mutex-debug.c
      # index 5cf6731..3ef3736 100644
      # --- a/kernel/locking/mutex-debug.c
      # +++ b/kernel/locking/mutex-debug.c
      # @@ -80,13 +80,13 @@ void debug_mutex_unlock(struct mutex *lock)
      # 			DEBUG_LOCKS_WARN_ON(lock->owner != current);
      #
      # 		DEBUG_LOCKS_WARN_ON(!lock->wait_list.prev && !lock->wait_list.next);
      # -		mutex_clear_owner(lock);
      # 	}
      #
      # 	/*
      # 	 * __mutex_slowpath_needs_to_unlock() is explicitly 0 for debug
      # 	 * mutexes so that we can do it here after we've verified state.
      # 	 */
      # +	mutex_clear_owner(lock);
      # 	atomic_set(&lock->count, 1);
      #  }
      
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=87955Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      (cherry picked from commit 8dcffdd3)
      8eb2bfe5
    • Michael Karcher's avatar
      scripts/recordmcount.pl: There is no -m32 gcc option on Super-H anymore · 351af5ab
      Michael Karcher authored
      Compiling SH with gcc-4.8 fails due to the -m32 option not being
      supported.
      
      From http://buildd.debian-ports.org/status/fetch.php?pkg=linux&arch=sh4&ver=3.16.7-ckt4-1&stamp=1421425783
      
            CC      init/main.o
          gcc-4.8: error: unrecognized command line option '-m32'
          ld: cannot find init/.tmp_mc_main.o: No such file or directory
          objcopy: 'init/.tmp_mx_main.o': No such file
          rm: cannot remove 'init/.tmp_mx_main.o': No such file or directory
          rm: cannot remove 'init/.tmp_mc_main.o': No such file or directory
      
      Link: http://lkml.kernel.org/r/1421537778-29001-1-git-send-email-kernel@mkarcher.dialup.fu-berlin.de
      Link: http://lkml.kernel.org/r/54BCBDD4.10102@physik.fu-berlin.de
      
      Cc: stable@vger.kernel.org
      Cc: Matt Fleming <matt@console-pimps.org>
      Reported-by: default avatarJohn Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
      Signed-off-by: default avatarMichael Karcher <kernel@mkarcher.dialup.fu-berlin.de>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      
      (cherry picked from commit 1caf6aaa)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      351af5ab
    • Jason Lee Cragg's avatar
      ALSA: usb-audio: Add mic volume fix quirk for Logitech Webcam C210 · f5ac399e
      Jason Lee Cragg authored
      Signed-off-by: default avatarJason Lee Cragg <jcragg@gmail.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      
      (cherry picked from commit 64559311)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      f5ac399e
    • David Jeffery's avatar
      libata: prevent HSM state change race between ISR and PIO · 9e2dbc23
      David Jeffery authored
      It is possible for ata_sff_flush_pio_task() to set ap->hsm_task_state to
      HSM_ST_IDLE in between the time __ata_sff_port_intr() checks for HSM_ST_IDLE
      and before it calls ata_sff_hsm_move() causing ata_sff_hsm_move() to BUG().
      
      This problem is hard to reproduce making this patch hard to verify, but this
      fix will prevent the race.
      
      I have not been able to reproduce the problem, but here is a crash dump from
      a 2.6.32 kernel.
      
      On examining the ata port's state, its hsm_task_state field has a value of HSM_ST_IDLE:
      
      crash> struct ata_port.hsm_task_state ffff881c1121c000
        hsm_task_state = 0
      
      Normally, this should not be possible as ata_sff_hsm_move() was called from ata_sff_host_intr(),
      which checks hsm_task_state and won't call ata_sff_hsm_move() if it has a HSM_ST_IDLE value.
      
      PID: 11053  TASK: ffff8816e846cae0  CPU: 0   COMMAND: "sshd"
       #0 [ffff88008ba03960] machine_kexec at ffffffff81038f3b
       #1 [ffff88008ba039c0] crash_kexec at ffffffff810c5d92
       #2 [ffff88008ba03a90] oops_end at ffffffff8152b510
       #3 [ffff88008ba03ac0] die at ffffffff81010e0b
       #4 [ffff88008ba03af0] do_trap at ffffffff8152ad74
       #5 [ffff88008ba03b50] do_invalid_op at ffffffff8100cf95
       #6 [ffff88008ba03bf0] invalid_op at ffffffff8100bf9b
          [exception RIP: ata_sff_hsm_move+317]
          RIP: ffffffff813a77ad  RSP: ffff88008ba03ca0  RFLAGS: 00010097
          RAX: 0000000000000000  RBX: ffff881c1121dc60  RCX: 0000000000000000
          RDX: ffff881c1121dd10  RSI: ffff881c1121dc60  RDI: ffff881c1121c000
          RBP: ffff88008ba03d00   R8: 0000000000000000   R9: 000000000000002e
          R10: 000000000001003f  R11: 000000000000009b  R12: ffff881c1121c000
          R13: 0000000000000000  R14: 0000000000000050  R15: ffff881c1121dd78
          ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0018
       #7 [ffff88008ba03d08] ata_sff_host_intr at ffffffff813a7fbd
       #8 [ffff88008ba03d38] ata_sff_interrupt at ffffffff813a821e
       #9 [ffff88008ba03d78] handle_IRQ_event at ffffffff810e6ec0
      --- <IRQ stack> ---
          [exception RIP: pipe_poll+48]
          RIP: ffffffff81192780  RSP: ffff880f26d459b8  RFLAGS: 00000246
          RAX: 0000000000000000  RBX: ffff880f26d459c8  RCX: 0000000000000000
          RDX: 0000000000000001  RSI: 0000000000000000  RDI: ffff881a0539fa80
          RBP: ffffffff8100bb8e   R8: ffff8803b23324a0   R9: 0000000000000000
          R10: ffff880f26d45dd0  R11: 0000000000000008  R12: ffffffff8109b646
          R13: ffff880f26d45948  R14: 0000000000000246  R15: 0000000000000246
          ORIG_RAX: ffffffffffffff10  CS: 0010  SS: 0018
          RIP: 00007f26017435c3  RSP: 00007fffe020c420  RFLAGS: 00000206
          RAX: 0000000000000017  RBX: ffffffff8100b072  RCX: 00007fffe020c45c
          RDX: 00007f2604a3f120  RSI: 00007f2604a3f140  RDI: 000000000000000d
          RBP: 0000000000000000   R8: 00007fffe020e570   R9: 0101010101010101
          R10: 0000000000000000  R11: 0000000000000246  R12: 00007fffe020e5f0
          R13: 00007fffe020e5f4  R14: 00007f26045f373c  R15: 00007fffe020e5e0
          ORIG_RAX: 0000000000000017  CS: 0033  SS: 002b
      
      Somewhere between the ata_sff_hsm_move() check and the ata_sff_host_intr() check, the value changed.
      On examining the other cpus to see what else was running, another cpu was running the error handler
      routines:
      
      PID: 326    TASK: ffff881c11014aa0  CPU: 1   COMMAND: "scsi_eh_1"
       #0 [ffff88008ba27e90] crash_nmi_callback at ffffffff8102fee6
       #1 [ffff88008ba27ea0] notifier_call_chain at ffffffff8152d515
       #2 [ffff88008ba27ee0] atomic_notifier_call_chain at ffffffff8152d57a
       #3 [ffff88008ba27ef0] notify_die at ffffffff810a154e
       #4 [ffff88008ba27f20] do_nmi at ffffffff8152b1db
       #5 [ffff88008ba27f50] nmi at ffffffff8152aaa0
          [exception RIP: _spin_lock_irqsave+47]
          RIP: ffffffff8152a1ff  RSP: ffff881c11a73aa0  RFLAGS: 00000006
          RAX: 0000000000000001  RBX: ffff881c1121deb8  RCX: 0000000000000000
          RDX: 0000000000000246  RSI: 0000000000000020  RDI: ffff881c122612d8
          RBP: ffff881c11a73aa0   R8: ffff881c17083800   R9: 0000000000000000
          R10: 0000000000000000  R11: 0000000000000000  R12: ffff881c1121c000
          R13: 000000000000001f  R14: ffff881c1121dd50  R15: ffff881c1121dc60
          ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0000
      --- <NMI exception stack> ---
       #6 [ffff881c11a73aa0] _spin_lock_irqsave at ffffffff8152a1ff
       #7 [ffff881c11a73aa8] ata_exec_internal_sg at ffffffff81396fb5
       #8 [ffff881c11a73b58] ata_exec_internal at ffffffff81397109
       #9 [ffff881c11a73bd8] atapi_eh_request_sense at ffffffff813a34eb
      
      Before it tried to acquire a spinlock, ata_exec_internal_sg() called ata_sff_flush_pio_task().
      This function will set ap->hsm_task_state to HSM_ST_IDLE, and has no locking around setting this
      value. ata_sff_flush_pio_task() can then race with the interrupt handler and potentially set
      HSM_ST_IDLE at a fatal moment, which will trigger a kernel BUG.
      
      v2: Fixup comment in ata_sff_flush_pio_task()
      
      tj: Further updated comment.  Use ap->lock instead of shost lock and
          use the [un]lock_irq variant instead of the irqsave/restore one.
      Signed-off-by: default avatarDavid Milburn <dmilburn@redhat.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: stable@vger.kernel.org
      
      (cherry picked from commit ce751452)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      9e2dbc23
    • Dan Williams's avatar
      libata: allow sata_sil24 to opt-out of tag ordered submission · 1ee1bdbe
      Dan Williams authored
      Ronny reports: https://bugzilla.kernel.org/show_bug.cgi?id=87101
          "Since commit 8a4aeec8 "libata/ahci: accommodate tag ordered
          controllers" the access to the harddisk on the first SATA-port is
          failing on its first access. The access to the harddisk on the
          second port is working normal.
      
          When reverting the above commit, access to both harddisks is working
          fine again."
      
      Maintain tag ordered submission as the default, but allow sata_sil24 to
      continue with the old behavior.
      
      Cc: <stable@vger.kernel.org>
      Cc: Tejun Heo <tj@kernel.org>
      Reported-by: default avatarRonny Hegewald <Ronny.Hegewald@online.de>
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      
      (cherry picked from commit 72dd299d)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      1ee1bdbe
    • Trond Myklebust's avatar
      LOCKD: Fix a race when initialising nlmsvc_timeout · cd55fa4d
      Trond Myklebust authored
      This commit fixes a race whereby nlmclnt_init() first starts the lockd
      daemon, and then calls nlm_bind_host() with the expectation that
      nlmsvc_timeout has already been initialised. Unfortunately, there is no
      no synchronisation between lockd() and lockd_up() to guarantee that this
      is the case.
      
      Fix is to move the initialisation of nlmsvc_timeout into lockd_create_svc
      
      Fixes: 9a1b6bf8 ("LOCKD: Don't call utsname()->nodename...")
      Cc: Bruce Fields <bfields@fieldses.org>
      Cc: stable@vger.kernel.org # 3.10.x
      Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
      
      (cherry picked from commit 06bed7d1)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      cd55fa4d
    • Michal Marek's avatar
      kbuild: Fix removal of the debian/ directory · 1d0cb9a6
      Michal Marek authored
      scripts/Makefile.clean treats absolute path specially, but
      $(objtree)/debian is no longer an absolute path since 7e1c0477 (kbuild:
      Use relative path for $(objtree). Work around this by checking if the
      path starts with $(objtree)/.
      Reported-and-tested-by: default avatarSedat Dilek <sedat.dilek@gmail.com>
      Fixes: 7e1c0477 (kbuild: Use relative path for $(objtree)
      Signed-off-by: default avatarMichal Marek <mmarek@suse.cz>
      
      (cherry picked from commit a16c5f99)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      1d0cb9a6
    • Daniel Borkmann's avatar
      x86, um: actually mark system call tables readonly · caf1432f
      Daniel Borkmann authored
      Commit a074335a ("x86, um: Mark system call tables readonly") was
      supposed to mark the sys_call_table in UML as RO by adding the const,
      but it doesn't have the desired effect as it's nevertheless being placed
      into the data section since __cacheline_aligned enforces sys_call_table
      being placed into .data..cacheline_aligned instead. We need to use
      the ____cacheline_aligned version instead to fix this issue.
      
      Before:
      
      $ nm -v arch/x86/um/sys_call_table_64.o | grep -1 "sys_call_table"
                       U sys_writev
      0000000000000000 D sys_call_table
      0000000000000000 D syscall_table_size
      
      After:
      
      $ nm -v arch/x86/um/sys_call_table_64.o | grep -1 "sys_call_table"
                       U sys_writev
      0000000000000000 R sys_call_table
      0000000000000000 D syscall_table_size
      
      Fixes: a074335a ("x86, um: Mark system call tables readonly")
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarDaniel Borkmann <dborkman@redhat.com>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      
      (cherry picked from commit b485342b)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      caf1432f
    • Richard Weinberger's avatar
      um: Skip futex_atomic_cmpxchg_inatomic() test · 8031c906
      Richard Weinberger authored
      futex_atomic_cmpxchg_inatomic() does not work on UML because
      it triggers a copy_from_user() in kernel context.
      On UML copy_from_user() can only be used if the kernel was called
      by a real user space process such that UML can use ptrace()
      to fetch the value.
      Reported-by: default avatarMiklos Szeredi <miklos@szeredi.hu>
      Suggested-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      Tested-by: default avatarDaniel Walter <d.walter@0x90.at>
      
      (cherry picked from commit f911d731)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      8031c906
    • Dan Carpenter's avatar
      decompress_bunzip2: off by one in get_next_block() · d575f592
      Dan Carpenter authored
      "origPtr" is used as an offset into the bd->dbuf[] array.  That array is
      allocated in start_bunzip() and has "bd->dbufSize" number of elements so
      the test here should be >= instead of >.
      
      Later we check "origPtr" again before using it as an offset so I don't
      know if this bug can be triggered in real life.
      
      Fixes: bc22c17e ('bzip2/lzma: library support for gzip, bzip2 and lzma decompression')
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Cc: Alain Knaff <alain@knaff.lu>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      
      (cherry picked from commit b5c8afe5)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      d575f592
    • Dmitry Torokhov's avatar
      Input: I8042 - add Acer Aspire 7738 to the nomux list · eae803ce
      Dmitry Torokhov authored
      When KBC is in active multiplexing mode the touchpad on this laptop does
      not work.
      Reported-by: default avatarBilal Koc <koc.bilo@googlemail.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      
      (cherry picked from commit 9333caea)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      eae803ce
    • Srihari Vijayaraghavan's avatar
      Input: i8042 - reset keyboard to fix Elantech touchpad detection · 8b06ef19
      Srihari Vijayaraghavan authored
      On some laptops, keyboard needs to be reset in order to successfully detect
      touchpad (e.g., some Gigabyte laptop models with Elantech touchpads).
      Without resettin keyboard touchpad pretends to be completely dead.
      
      Based on the original patch by Mateusz Jończyk this version has been
      expanded to include DMI based detection & application of the fix
      automatically on the affected models of laptops. This has been confirmed to
      fix problem by three users already on three different models of laptops.
      
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=81331
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSrihari Vijayaraghavan <linux.bug.reporting@gmail.com>
      Acked-by: default avatarMateusz Jończyk <mat.jonczyk@o2.pl>
      Tested-by: default avatarSrihari Vijayaraghavan <linux.bug.reporting@gmail.com>
      Tested by: Zakariya Dehlawi <zdehlawi@gmail.com>
      Tested-by: default avatarGuillaum Bouchard <guillaum.bouchard@gmail.com>
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      
      (cherry picked from commit 148e9a71)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      8b06ef19
    • Ahmed S. Darwish's avatar
      can: kvaser_usb: Don't send a RESET_CHIP for non-existing channels · 309ab223
      Ahmed S. Darwish authored
      Recent Leaf firmware versions (>= 3.1.557) do not allow to send
      commands for non-existing channels.  If a command is sent for a
      non-existing channel, the firmware crashes.
      Reported-by: default avatarChristopher Storah <Christopher.Storah@invetech.com.au>
      Signed-off-by: default avatarOlivier Sobrie <olivier@sobrie.be>
      Signed-off-by: default avatarAhmed S. Darwish <ahmed.darwish@valeo.com>
      Cc: linux-stable <stable@vger.kernel.org>
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      
      (cherry picked from commit 5e7e6e0c)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      309ab223
    • Ahmed S. Darwish's avatar
      can: kvaser_usb: Reset all URB tx contexts upon channel close · 149da762
      Ahmed S. Darwish authored
      commit 889b77f7 upstream.
      
      Flooding the Kvaser CAN to USB dongle with multiple reads and
      writes in very high frequency (*), closing the CAN channel while
      all the transmissions are on (#), opening the device again (@),
      then sending a small number of packets would make the driver
      enter an almost infinite loop of:
      
      [....]
      [15959.853988] kvaser_usb 4-3:1.0 can0: cannot find free context
      [15959.853990] kvaser_usb 4-3:1.0 can0: cannot find free context
      [15959.853991] kvaser_usb 4-3:1.0 can0: cannot find free context
      [15959.853993] kvaser_usb 4-3:1.0 can0: cannot find free context
      [15959.853994] kvaser_usb 4-3:1.0 can0: cannot find free context
      [15959.853995] kvaser_usb 4-3:1.0 can0: cannot find free context
      [....]
      
      _dragging the whole system down_ in the process due to the
      excessive logging output.
      
      Initially, this has caused random panics in the kernel due to a
      buggy error recovery path.  That got fixed in an earlier commit.(%)
      This patch aims at solving the root cause. -->
      
      16 tx URBs and contexts are allocated per CAN channel per USB
      device. Such URBs are protected by:
      
      a) A simple atomic counter, up to a value of MAX_TX_URBS (16)
      b) A flag in each URB context, stating if it's free
      c) The fact that ndo_start_xmit calls are themselves protected
         by the networking layers higher above
      
      After grabbing one of the tx URBs, if the driver noticed that all
      of them are now taken, it stops the netif transmission queue.
      Such queue is worken up again only if an acknowedgment was received
      from the firmware on one of our earlier-sent frames.
      
      Meanwhile, upon channel close (#), the driver sends a CMD_STOP_CHIP
      to the firmware, effectively closing all further communication.  In
      the high traffic case, the atomic counter remains at MAX_TX_URBS,
      and all the URB contexts remain marked as active.  While opening
      the channel again (@), it cannot send any further frames since no
      more free tx URB contexts are available.
      
      Reset all tx URB contexts upon CAN channel close.
      
      (*) 50 parallel instances of `cangen0 -g 0 -ix`
      (#) `ifconfig can0 down`
      (@) `ifconfig can0 up`
      (%) "can: kvaser_usb: Don't free packets when tight on URBs"
      Signed-off-by: default avatarAhmed S. Darwish <ahmed.darwish@valeo.com>
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      (cherry picked from commit 9111e41c)
      149da762
    • Ahmed S. Darwish's avatar
      can: kvaser_usb: Reset all URB tx contexts upon channel close · 3500ef97
      Ahmed S. Darwish authored
      Flooding the Kvaser CAN to USB dongle with multiple reads and
      writes in very high frequency (*), closing the CAN channel while
      all the transmissions are on (#), opening the device again (@),
      then sending a small number of packets would make the driver
      enter an almost infinite loop of:
      
      [....]
      [15959.853988] kvaser_usb 4-3:1.0 can0: cannot find free context
      [15959.853990] kvaser_usb 4-3:1.0 can0: cannot find free context
      [15959.853991] kvaser_usb 4-3:1.0 can0: cannot find free context
      [15959.853993] kvaser_usb 4-3:1.0 can0: cannot find free context
      [15959.853994] kvaser_usb 4-3:1.0 can0: cannot find free context
      [15959.853995] kvaser_usb 4-3:1.0 can0: cannot find free context
      [....]
      
      _dragging the whole system down_ in the process due to the
      excessive logging output.
      
      Initially, this has caused random panics in the kernel due to a
      buggy error recovery path.  That got fixed in an earlier commit.(%)
      This patch aims at solving the root cause. -->
      
      16 tx URBs and contexts are allocated per CAN channel per USB
      device. Such URBs are protected by:
      
      a) A simple atomic counter, up to a value of MAX_TX_URBS (16)
      b) A flag in each URB context, stating if it's free
      c) The fact that ndo_start_xmit calls are themselves protected
         by the networking layers higher above
      
      After grabbing one of the tx URBs, if the driver noticed that all
      of them are now taken, it stops the netif transmission queue.
      Such queue is worken up again only if an acknowedgment was received
      from the firmware on one of our earlier-sent frames.
      
      Meanwhile, upon channel close (#), the driver sends a CMD_STOP_CHIP
      to the firmware, effectively closing all further communication.  In
      the high traffic case, the atomic counter remains at MAX_TX_URBS,
      and all the URB contexts remain marked as active.  While opening
      the channel again (@), it cannot send any further frames since no
      more free tx URB contexts are available.
      
      Reset all tx URB contexts upon CAN channel close.
      
      (*) 50 parallel instances of `cangen0 -g 0 -ix`
      (#) `ifconfig can0 down`
      (@) `ifconfig can0 up`
      (%) "can: kvaser_usb: Don't free packets when tight on URBs"
      Signed-off-by: default avatarAhmed S. Darwish <ahmed.darwish@valeo.com>
      Cc: linux-stable <stable@vger.kernel.org>
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      
      can: kvaser_usb: Don't free packets when tight on URBs
      
      Flooding the Kvaser CAN to USB dongle with multiple reads and
      writes in high frequency caused seemingly-random panics in the
      kernel.
      
      On further inspection, it seems the driver erroneously freed the
      to-be-transmitted packet upon getting tight on URBs and returning
      NETDEV_TX_BUSY, leading to invalid memory writes and double frees
      at a later point in time.
      
      Note:
      
      Finding no more URBs/transmit-contexts and returning NETDEV_TX_BUSY
      is a driver bug in and out of itself: it means that our start/stop
      queue flow control is broken.
      
      This patch only fixes the (buggy) error handling code; the root
      cause shall be fixed in a later commit.
      Acked-by: default avatarOlivier Sobrie <olivier@sobrie.be>
      Signed-off-by: default avatarAhmed S. Darwish <ahmed.darwish@valeo.com>
      Cc: linux-stable <stable@vger.kernel.org>
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      
      (cherry picked from commit 889b77f7
      b442723f)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      3500ef97
    • Johan Hovold's avatar
      USB: console: fix uninitialised ldisc semaphore · a6790aaf
      Johan Hovold authored
      The USB console currently allocates a temporary fake tty which is used
      to pass terminal settings to the underlying serial driver.
      
      The tty struct is not fully initialised, something which can lead to a
      lockdep warning (or worse) if a serial driver tries to acquire a
      line-discipline reference:
      
      	usbserial: USB Serial support registered for pl2303
      	pl2303 1-2.1:1.0: pl2303 converter detected
      	usb 1-2.1: pl2303 converter now attached to ttyUSB0
      	INFO: trying to register non-static key.
      	the code is fine but needs lockdep annotation.
      	turning off the locking correctness validator.
      	CPU: 0 PID: 68 Comm: udevd Tainted: G        W      3.18.0-rc5 #10
      	[<c0016f04>] (unwind_backtrace) from [<c0013978>] (show_stack+0x20/0x24)
      	[<c0013978>] (show_stack) from [<c0449794>] (dump_stack+0x24/0x28)
      	[<c0449794>] (dump_stack) from [<c006f730>] (__lock_acquire+0x1e50/0x2004)
      	[<c006f730>] (__lock_acquire) from [<c0070128>] (lock_acquire+0xe4/0x18c)
      	[<c0070128>] (lock_acquire) from [<c027c6f8>] (ldsem_down_read_trylock+0x78/0x90)
      	[<c027c6f8>] (ldsem_down_read_trylock) from [<c027a1cc>] (tty_ldisc_ref+0x24/0x58)
      	[<c027a1cc>] (tty_ldisc_ref) from [<c0340760>] (usb_serial_handle_dcd_change+0x48/0xe8)
      	[<c0340760>] (usb_serial_handle_dcd_change) from [<bf000484>] (pl2303_read_int_callback+0x210/0x220 [pl2303])
      	[<bf000484>] (pl2303_read_int_callback [pl2303]) from [<c031624c>] (__usb_hcd_giveback_urb+0x80/0x140)
      	[<c031624c>] (__usb_hcd_giveback_urb) from [<c0316fc0>] (usb_giveback_urb_bh+0x98/0xd4)
      	[<c0316fc0>] (usb_giveback_urb_bh) from [<c0042e44>] (tasklet_hi_action+0x9c/0x108)
      	[<c0042e44>] (tasklet_hi_action) from [<c0042380>] (__do_softirq+0x148/0x42c)
      	[<c0042380>] (__do_softirq) from [<c00429cc>] (irq_exit+0xd8/0x114)
      	[<c00429cc>] (irq_exit) from [<c007ae58>] (__handle_domain_irq+0x84/0xdc)
      	[<c007ae58>] (__handle_domain_irq) from [<c000879c>] (omap_intc_handle_irq+0xd8/0xe0)
      	[<c000879c>] (omap_intc_handle_irq) from [<c0014544>] (__irq_svc+0x44/0x7c)
      	Exception stack(0xdf4e7f08 to 0xdf4e7f50)
      	7f00:                   debc0b80 df4e7f5c 00000000 00000000 debc0b80 be8da96c
      	7f20: 00000000 00000128 c000fc84 df4e6000 00000000 df4e7f94 00000004 df4e7f50
      	7f40: c038ebc0 c038d74c 600f0013 ffffffff
      	[<c0014544>] (__irq_svc) from [<c038d74c>] (___sys_sendmsg.part.29+0x0/0x2e0)
      	[<c038d74c>] (___sys_sendmsg.part.29) from [<c038ec08>] (SyS_sendmsg+0x18/0x1c)
      	[<c038ec08>] (SyS_sendmsg) from [<c000fa00>] (ret_fast_syscall+0x0/0x48)
      	console [ttyUSB0] enabled
      
      Fixes: 36697529 ("tty: Replace ldisc locking with ldisc_sem")
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      
      (cherry picked from commit d269d443)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      a6790aaf
    • David Peterson's avatar
      USB: cp210x: add IDs for CEL USB sticks and MeshWorks devices · c694a480
      David Peterson authored
      Added virtual com port VID/PID entries for CEL USB sticks and MeshWorks
      devices.
      Signed-off-by: default avatarDavid Peterson <david.peterson@cel.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      
      (cherry picked from commit 1ae78a48)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      c694a480
    • Preston Fick's avatar
      USB: cp210x: fix ID for production CEL MeshConnect USB Stick · 7d98425c
      Preston Fick authored
      Fixing typo for MeshConnect IDs. The original PID (0x8875) is not in
      production and is not needed. Instead it has been changed to the
      official production PID (0x8857).
      Signed-off-by: default avatarPreston Fick <pffick@gmail.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      
      (cherry picked from commit 90441b4d)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      7d98425c
    • Amit Virdi's avatar
      usb: dwc3: gadget: Stop TRB preparation after limit is reached · dae63c4e
      Amit Virdi authored
      DWC3 gadget sets up a pool of 32 TRBs for each EP during initialization. This
      means, the max TRBs that can be submitted for an EP is fixed to 32. Since the
      request queue for an EP is a linked list, any number of requests can be queued
      to it by the gadget layer.  However, the dwc3 driver must not submit TRBs more
      than the pool it has created for. This limit wasn't respected when SG was used
      resulting in submitting more than the max TRBs, eventually leading to
      non-transfer of the TRBs submitted over the max limit.
      
      Root cause:
      When SG is used, there are two loops iterating to prepare TRBs:
       - Outer loop over the request_list
       - Inner loop over the SG list
      The code was missing break to get out of the outer loop.
      
      Fixes: eeb720fb (usb: dwc3: gadget: add support for SG lists)
      Cc: <stable@vger.kernel.org> # v3.9+
      Signed-off-by: default avatarAmit Virdi <amit.virdi@st.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      
      (cherry picked from commit 39e60635)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      dae63c4e
    • Arseny Solokha's avatar
      OHCI: add a quirk for ULi M5237 blocking on reset · 465fa38f
      Arseny Solokha authored
      Commit 8dccddbc ("OHCI: final fix for NVIDIA problems (I hope)")
      introduced into 3.1.9 broke boot on e.g. Freescale P2020DS development
      board. The code path that was previously specific to NVIDIA controllers
      had then become taken for all chips.
      
      However, the M5237 installed on the board wedges solid when accessing
      its base+OHCI_FMINTERVAL register, making it impossible to boot any
      kernel newer than 3.1.8 on this particular and apparently other similar
      machines.
      
      Don't readl() and writel() base+OHCI_FMINTERVAL on PCI ID 10b9:5237.
      
      The patch is suitable for the -next tree as well as all maintained
      kernels up to 3.2 inclusive.
      Signed-off-by: default avatarArseny Solokha <asolokha@kb.kras.ru>
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Cc: stable <stable@vger.kernel.org> # 3.2
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      (cherry picked from commit 56abcab8)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      465fa38f
    • Hans Holmberg's avatar
      gpiolib: of: Correct error handling in of_get_named_gpiod_flags · c751310f
      Hans Holmberg authored
      of_get_named_gpiod_flags fails with -EPROBE_DEFER in cases
      where the gpio chip is available and the GPIO translation fails.
      
      This causes drivers to be re-probed erroneusly, and hides the
      real problem(i.e. the GPIO number being out of range).
      
      Cc: Stable <stable@vger.kernel.org>
      Signed-off-by: default avatarHans Holmberg <hans.holmberg@intel.com>
      Reviewed-by: default avatarAlexandre Courbot <acourbot@nvidia.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      
      (cherry picked from commit 7b8792bb)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      c751310f
    • Johan Hovold's avatar
      pinctrl: lantiq: remove bogus of_gpio_chip_add · cb8b445b
      Johan Hovold authored
      Remove bogus call to of_gpiochip_add (and of_gpio_chip remove in error
      path) which is also called when adding the gpio chip.
      
      This prevents adding the same pinctrl range twice.
      
      Fixes: 3f8c50c9 ("OF: pinctrl: MIPS: lantiq: implement lantiq/xway
      pinctrl support")
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      
      (cherry picked from commit 41f632fe)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      cb8b445b
    • Trond Myklebust's avatar
      NFSv4.1: Fix client id trunking on Linux · ba0534e2
      Trond Myklebust authored
      Currently, our trunking code will check for session trunking, but will
      fail to detect client id trunking. This is a problem, because it means
      that the client will fail to recognise that the two connections represent
      shared state, even if they do not permit a shared session.
      By removing the check for the server minor id, and only checking the
      major id, we will end up doing the right thing in both cases: we close
      down the new nfs_client and fall back to using the existing one.
      
      Fixes: 05f4c350 ("NFS: Discover NFSv4 server trunking when mounting")
      Cc: Chuck Lever <chuck.lever@oracle.com>
      Cc: stable@vger.kernel.org # 3.7.x
      Tested-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
      
      (cherry picked from commit 1fc0703a)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      ba0534e2
    • Simon Guinot's avatar
      leds: netxbig: fix oops at probe time · d45fc9e2
      Simon Guinot authored
      This patch fixes a NULL pointer dereference on led_dat->mode_val. Due to
      this bug, a kernel oops can be observed at probe time on the LaCie 2Big
      and 5Big v2 boards:
      
      Unable to handle kernel NULL pointer dereference at virtual address 00000008
      [...]
      [<c03f244c>] (netxbig_led_probe) from [<c02c8c6c>] (platform_drv_probe+0x4c/0x9c)
      [<c02c8c6c>] (platform_drv_probe) from [<c02c72d0>] (driver_probe_device+0x98/0x25c)
      [<c02c72d0>] (driver_probe_device) from [<c02c7520>] (__driver_attach+0x8c/0x90)
      [<c02c7520>] (__driver_attach) from [<c02c5c24>] (bus_for_each_dev+0x68/0x94)
      [<c02c5c24>] (bus_for_each_dev) from [<c02c6408>] (bus_add_driver+0x124/0x1dc)
      [<c02c6408>] (bus_add_driver) from [<c02c7ac0>] (driver_register+0x78/0xf8)
      [<c02c7ac0>] (driver_register) from [<c000888c>] (do_one_initcall+0x80/0x1cc)
      [<c000888c>] (do_one_initcall) from [<c0733618>] (kernel_init_freeable+0xe4/0x1b4)
      [<c0733618>] (kernel_init_freeable) from [<c058db9c>] (kernel_init+0xc/0xec)
      [<c058db9c>] (kernel_init) from [<c0009850>] (ret_from_fork+0x14/0x24)
      [...]
      
      This bug was introduced by commit 588a6a99
      ("leds: netxbig: fix attribute-creation race").
      Signed-off-by: default avatarSimon Guinot <simon.guinot@sequanux.org>
      Cc: <stable@vger.kernel.org> # 3.17+
      Acked-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarBryan Wu <cooloney@gmail.com>
      
      (cherry picked from commit 0c86ac2c)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      d45fc9e2
    • Wei Yang's avatar
      vfio-pci: Fix the check on pci device type in vfio_pci_probe() · dd97930b
      Wei Yang authored
      Current vfio-pci just supports normal pci device, so vfio_pci_probe() will
      return if the pci device is not a normal device. While current code makes a
      mistake. PCI_HEADER_TYPE is the offset in configuration space of the device
      type, but we use this value to mask the type value.
      
      This patch fixs this by do the check directly on the pci_dev->hdr_type.
      Signed-off-by: default avatarWei Yang <weiyang@linux.vnet.ibm.com>
      Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
      Cc: stable@vger.kernel.org # v3.6+
      
      (cherry picked from commit 7c2e211f)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      dd97930b
    • Takashi Iwai's avatar
      [media] uvcvideo: Fix destruction order in uvc_delete() · eaa743e3
      Takashi Iwai authored
      We've got a bug report at disconnecting a Webcam, where the kernel
      spews warnings like below:
        WARNING: CPU: 0 PID: 8385 at ../fs/sysfs/group.c:219 sysfs_remove_group+0x87/0x90()
        sysfs group c0b2350c not found for kobject 'event3'
        CPU: 0 PID: 8385 Comm: queue2:src Not tainted 3.16.2-1.gdcee397-default #1
        Hardware name: ASUSTeK Computer INC. A7N8X-E/A7N8X-E, BIOS ASUS A7N8X-E Deluxe ACPI BIOS Rev 1013  11/12/2004
          c08d0705 ddc75cbc c0718c5b ddc75ccc c024b654 c08c6d44 ddc75ce8 000020c1
          c08d0705 000000db c03d1ec7 c03d1ec7 00000009 00000000 c0b2350c d62c9064
          ddc75cd4 c024b6a3 00000009 ddc75ccc c08c6d44 ddc75ce8 ddc75cfc c03d1ec7
        Call Trace:
          [<c0205ba6>] try_stack_unwind+0x156/0x170
          [<c02046f3>] dump_trace+0x53/0x180
          [<c0205c06>] show_trace_log_lvl+0x46/0x50
          [<c0204871>] show_stack_log_lvl+0x51/0xe0
          [<c0205c67>] show_stack+0x27/0x50
          [<c0718c5b>] dump_stack+0x3e/0x4e
          [<c024b654>] warn_slowpath_common+0x84/0xa0
          [<c024b6a3>] warn_slowpath_fmt+0x33/0x40
          [<c03d1ec7>] sysfs_remove_group+0x87/0x90
          [<c05a2c54>] device_del+0x34/0x180
          [<c05e3989>] evdev_disconnect+0x19/0x50
          [<c05e06fa>] __input_unregister_device+0x9a/0x140
          [<c05e0845>] input_unregister_device+0x45/0x80
          [<f854b1d6>] uvc_delete+0x26/0x110 [uvcvideo]
          [<f84d66f8>] v4l2_device_release+0x98/0xc0 [videodev]
          [<c05a25bb>] device_release+0x2b/0x90
          [<c04ad8bf>] kobject_cleanup+0x6f/0x1a0
          [<f84d5453>] v4l2_release+0x43/0x70 [videodev]
          [<c0372f31>] __fput+0xb1/0x1b0
          [<c02650c1>] task_work_run+0x91/0xb0
          [<c024d845>] do_exit+0x265/0x910
          [<c024df64>] do_group_exit+0x34/0xa0
          [<c025a76f>] get_signal_to_deliver+0x17f/0x590
          [<c0201b6a>] do_signal+0x3a/0x960
          [<c02024f7>] do_notify_resume+0x67/0x90
          [<c071ebb5>] work_notifysig+0x30/0x3b
          [<b7739e60>] 0xb7739e5f
         ---[ end trace b1e56095a485b631 ]---
      
      The cause is that uvc_status_cleanup() is called after usb_put_*() in
      uvc_delete().  usb_put_*() removes the sysfs parent and eventually
      removes the children recursively, so the later device_del() can't find
      its sysfs.  The fix is simply rearrange the call orders in
      uvc_delete() so that the child is removed before the parent.
      
      Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=897736Reported-and-tested-by: default avatarMartin Pluskal <mpluskal@suse.com>
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
      
      (cherry picked from commit 2228d80d)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      eaa743e3
    • Sakari Ailus's avatar
      [media] smiapp: Take mutex during PLL update in sensor initialisation · 933c69f7
      Sakari Ailus authored
      The mutex does not serialise anything in this case but avoids a lockdep
      warning from the control framework.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Acked-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
      
      (cherry picked from commit f85698cd)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      933c69f7
    • Frank Schaefer's avatar
      [media] af9005: fix kernel panic on init if compiled without IR · ee5f285a
      Frank Schaefer authored
      This patches fixes an ancient bug in the dvb_usb_af9005 driver, which
      has been reported at least in the following threads:
      https://lkml.org/lkml/2009/2/4/350
      https://lkml.org/lkml/2014/9/18/558
      
      If the driver is compiled in without any IR support (neither
      DVB_USB_AF9005_REMOTE nor custom symbols), the symbol_request calls in
      af9005_usb_module_init() return pointers != NULL although the IR
      symbols are not available.
      
      This leads to the following oops:
      ...
      [    8.529751] usbcore: registered new interface driver dvb_usb_af9005
      [    8.531584] BUG: unable to handle kernel paging request at 02e00000
      [    8.533385] IP: [<7d9d67c6>] af9005_usb_module_init+0x6b/0x9d
      [    8.535613] *pde = 00000000
      [    8.536416] Oops: 0000 [#1] PREEMPT PREEMPT DEBUG_PAGEALLOCDEBUG_PAGEALLOC
      [    8.537863] CPU: 0 PID: 1 Comm: swapper Not tainted 3.15.0-rc6-00151-ga5c075cf #1
      [    8.539827] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.7.5-20140531_083030-gandalf 04/01/2014
      [    8.541519] task: 89c9a670 ti: 89c9c000 task.ti: 89c9c000
      [    8.541519] EIP: 0060:[<7d9d67c6>] EFLAGS: 00010206 CPU: 0
      [    8.541519] EIP is at af9005_usb_module_init+0x6b/0x9d
      [    8.541519] EAX: 02e00000 EBX: 00000000 ECX: 00000006 EDX: 00000000
      [    8.541519] ESI: 00000000 EDI: 7da33ec8 EBP: 89c9df30 ESP: 89c9df2c
      [    8.541519]  DS: 007b ES: 007b FS: 0000 GS: 00e0 SS: 0068
      [    8.541519] CR0: 8005003b CR2: 02e00000 CR3: 05a54000 CR4: 00000690
      [    8.541519] Stack:
      [    8.541519]  7d9d675b 89c9df90 7d992a49 7d7d5914 89c9df4c 7be3a800 7d08c58c 8a4c3968
      [    8.541519]  89c9df80 7be3a966 00000192 00000006 00000006 7d7d3ff4 8a4c397a 00000200
      [    8.541519]  7d6b1280 8a4c3979 00000006 000009a6 7da32db8 b13eec81 00000006 000009a6
      [    8.541519] Call Trace:
      [    8.541519]  [<7d9d675b>] ? ttusb2_driver_init+0x16/0x16
      [    8.541519]  [<7d992a49>] do_one_initcall+0x77/0x106
      [    8.541519]  [<7be3a800>] ? parameqn+0x2/0x35
      [    8.541519]  [<7be3a966>] ? parse_args+0x113/0x25c
      [    8.541519]  [<7d992bc2>] kernel_init_freeable+0xea/0x167
      [    8.541519]  [<7cf01070>] kernel_init+0x8/0xb8
      [    8.541519]  [<7cf27ec0>] ret_from_kernel_thread+0x20/0x30
      [    8.541519]  [<7cf01068>] ? rest_init+0x10c/0x10c
      [    8.541519] Code: 08 c2 c7 05 44 ed f9 7d 00 00 e0 02 c7 05 40 ed f9 7d 00 00 e0 02 c7 05 3c ed f9 7d 00 00 e0 02 75 1f b8 00 00 e0 02 85 c0 74 16 <a1> 00 00 e0 02 c7 05 54 84 8e 7d 00 00 e0 02 a3 58 84 8e 7d eb
      [    8.541519] EIP: [<7d9d67c6>] af9005_usb_module_init+0x6b/0x9d SS:ESP 0068:89c9df2c
      [    8.541519] CR2: 0000000002e00000
      [    8.541519] ---[ end trace 768b6faf51370fc7 ]---
      
      The prefered fix would be to convert the whole IR code to use the kernel IR
      infrastructure (which wasn't available at the time this driver had been created).
      
      Until anyone who still has this old hardware steps up an does the conversion,
      fix it by not calling the symbol_request calls if the driver is compiled in
      without the default IR symbols (CONFIG_DVB_USB_AF9005_REMOTE).
      Due to the IR related pointers beeing NULL by default, IR support will then be disabled.
      
      The downside of this solution is, that it will no longer be possible to
      compile custom IR symbols (not using CONFIG_DVB_USB_AF9005_REMOTE) in.
      
      Please note that this patch has NOT been tested with all possible cases.
      I don't have the hardware and could only verify that it fixes the reported
      bug.
      Reported-by: default avatarFengguag Wu <fengguang.wu@intel.com>
      Signed-off-by: default avatarFrank Schäfer <fschaefer.oss@googlemail.com>
      Cc: <stable@vger.kernel.org>
      Acked-by: default avatarLuca Olivetti <luca@ventoso.org>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
      
      (cherry picked from commit 22799487)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      ee5f285a
    • Sakari Ailus's avatar
      [media] smiapp-pll: Correct clock debug prints · 78e0fdeb
      Sakari Ailus authored
      The PLL flags were not used correctly.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Acked-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
      
      (cherry picked from commit bc47150a)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      78e0fdeb
    • Tomi Valkeinen's avatar
      video/logo: prevent use of logos after they have been freed · 3f7faeee
      Tomi Valkeinen authored
      If the probe of an fb driver has been deferred due to missing
      dependencies, and the probe is later ran when a module is loaded, the
      fbdev framework will try to find a logo to use.
      
      However, the logos are __initdata, and have already been freed. This
      causes sometimes page faults, if the logo memory is not mapped,
      sometimes other random crashes as the logo data is invalid, and
      sometimes nothing, if the fbdev decides to reject the logo (e.g. the
      random value depicting the logo's height is too big).
      
      This patch adds a late_initcall function to mark the logos as freed. In
      reality the logos are freed later, and fbdev probe may be ran between
      this late_initcall and the freeing of the logos. In that case we will
      miss drawing the logo, even if it would be possible.
      Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
      Cc: stable@vger.kernel.org
      
      (cherry picked from commit 92b004d1)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      3f7faeee
    • Long Li's avatar
      storvsc: ring buffer failures may result in I/O freeze · 98b44a69
      Long Li authored
      When ring buffer returns an error indicating retry, storvsc may not
      return a proper error code to SCSI when bounce buffer is not used.
      This has introduced I/O freeze on RAID running atop storvsc devices.
      This patch fixes it by always returning a proper error code.
      Signed-off-by: default avatarLong Li <longli@microsoft.com>
      Reviewed-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      cc: stable@vger.kernel.org
      
      (cherry picked from commit e86fb5e8)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      98b44a69
    • John David Anglin's avatar
      parisc: fix out-of-register compiler error in ldcw inline assembler function · 862af405
      John David Anglin authored
      The __ldcw macro has a problem when its argument needs to be reloaded from
      memory. The output memory operand and the input register operand both need to
      be reloaded using a register in class R1_REGS when generating 64-bit code.
      This fails because there's only a single register in the class. Instead, use a
      memory clobber. This also makes the __ldcw macro a compiler memory barrier.
      Signed-off-by: default avatarJohn David Anglin <dave.anglin@bell.net>
      Cc: <stable@vger.kernel.org>        [3.13+]
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      
      (cherry picked from commit 45db0738)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      862af405
    • Stephen Boyd's avatar
      clk: Really fix deadlock with mmap_sem · d8927bb6
      Stephen Boyd authored
      Commit 6314b679 (clk: Don't hold prepare_lock across debugfs
      creation, 2014-09-04) forgot to update one place where we hold
      the prepare_lock while creating debugfs directories. This means
      we still have the chance of a deadlock that the commit was trying
      to fix. Actually fix it by moving the debugfs creation outside
      the prepare_lock.
      
      Cc: <stable@vger.kernel.org> # 3.18
      Reported-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
      Fixes: 6314b679 "clk: Don't hold prepare_lock across debugfs creation"
      Signed-off-by: default avatarStephen Boyd <sboyd@codeaurora.org>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarMichael Turquette <mturquette@linaro.org>
      [mturquette@linaro.org: removed lockdep_assert]
      
      (cherry picked from commit 89f7e9de)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      d8927bb6
    • Martin K. Petersen's avatar
      scsi: blacklist RSOC for Microsoft iSCSI target devices · f5b4e8f1
      Martin K. Petersen authored
      The Microsoft iSCSI target does not support REPORT SUPPORTED OPERATION
      CODES. Blacklist these devices so we don't attempt to send the command.
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Tested-by: default avatarMike Christie <michaelc@cs.wisc.edu>
      Reported-by: jazz@deti74.ru
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Cc: stable@vger.kernel.org # v3.10+
      
      (cherry picked from commit 198a956a)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      f5b4e8f1
    • Nicholas Bellinger's avatar
      iscsi-target: Fail connection on short sendmsg writes · 913c905e
      Nicholas Bellinger authored
      This patch changes iscsit_do_tx_data() to fail on short writes
      when kernel_sendmsg() returns a value different than requested
      transfer length, returning -EPIPE and thus causing a connection
      reset to occur.
      
      This avoids a potential bug in the original code where a short
      write would result in kernel_sendmsg() being called again with
      the original iovec base + length.
      
      In practice this has not been an issue because iscsit_do_tx_data()
      is only used for transferring 48 byte headers + 4 byte digests,
      along with seldom used control payloads from NOPIN + TEXT_RSP +
      REJECT with less than 32k of data.
      
      So following Al's audit of iovec consumers, go ahead and fail
      the connection on short writes for now, and remove the bogus
      logic ahead of his proper upstream fix.
      Reported-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: <stable@vger.kernel.org> # v3.1+
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      
      (cherry picked from commit 6bf6ca75)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      913c905e