Skip to content
Snippets Groups Projects
  1. Dec 20, 2015
  2. Dec 19, 2015
    • Hidehiro Kawai's avatar
      Documentation: Document kernel.panic_on_io_nmi sysctl · 9f318e3f
      Hidehiro Kawai authored
      
      kernel.panic_on_io_nmi sysctl was introduced by commit
      
        5211a242 ("x86: Add sysctl to allow panic on IOCK NMI error")
      
      but its documentation is missing. So, add it.
      
      Signed-off-by: default avatarHidehiro Kawai <hidehiro.kawai.ez@hitachi.com>
      Requested-by: default avatarBorislav Petkov <bp@alien8.de>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Baoquan He <bhe@redhat.com>
      Cc: Chris Metcalf <cmetcalf@ezchip.com>
      Cc: Don Zickus <dzickus@redhat.com>
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Kosina <jkosina@suse.cz>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: kexec@lists.infradead.org
      Cc: linux-doc@vger.kernel.org
      Cc: Manfred Spraul <manfred@colorfullife.com>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Seth Jennings <sjenning@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ulrich Obergfell <uobergfe@redhat.com>
      Cc: Vivek Goyal <vgoyal@redhat.com>
      Cc: x86-ml <x86@kernel.org>
      Link: http://lkml.kernel.org/r/20151210014637.25437.71903.stgit@softrs
      
      
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      9f318e3f
    • Hidehiro Kawai's avatar
      x86/nmi: Save regs in crash dump on external NMI · b279d67d
      Hidehiro Kawai authored
      
      Now, multiple CPUs can receive an external NMI simultaneously by
      specifying the "apic_extnmi=all" command line parameter. When we take
      a crash dump by using external NMI with this option, we fail to save
      registers into the crash dump. This happens as follows:
      
        CPU 0                              CPU 1
        ================================   =============================
        receive an external NMI
        default_do_nmi()                   receive an external NMI
          spin_lock(&nmi_reason_lock)      default_do_nmi()
          io_check_error()                   spin_lock(&nmi_reason_lock)
            panic()                            busy loop
            ...
              kdump_nmi_shootdown_cpus()
                issue NMI IPI -----------> blocked until IRET
                                               busy loop...
      
      Here, since CPU 1 is in NMI context, an additional NMI from CPU 0
      remains unhandled until CPU 1 IRETs. However, CPU 1 will never execute
      IRET so the NMI is not handled and the callback function to save
      registers is never called.
      
      To solve this issue, we check if the IPI for crash dumping was issued
      while waiting for nmi_reason_lock to be released, and if so, call its
      callback function directly. If the IPI is not issued (e.g. kdump is
      disabled), the actual behavior doesn't change.
      
      Signed-off-by: default avatarHidehiro Kawai <hidehiro.kawai.ez@hitachi.com>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Baoquan He <bhe@redhat.com>
      Cc: Dave Young <dyoung@redhat.com>
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiang Liu <jiang.liu@linux.intel.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: kexec@lists.infradead.org
      Cc: linux-doc@vger.kernel.org
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stefan Lippers-Hollmann <s.l-h@gmx.de>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vivek Goyal <vgoyal@redhat.com>
      Cc: x86-ml <x86@kernel.org>
      Link: http://lkml.kernel.org/r/20151210065245.4587.39316.stgit@softrs
      
      
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      b279d67d
    • Hidehiro Kawai's avatar
      x86/apic: Introduce apic_extnmi command line parameter · b7c4948e
      Hidehiro Kawai authored
      
      This patch introduces a command line parameter apic_extnmi:
      
       apic_extnmi=( bsp|all|none )
      
      The default value is "bsp" and this is the current behavior: only the
      Boot-Strapping Processor receives an external NMI.
      
      "all" allows external NMIs to be broadcast to all CPUs. This would
      raise the success rate of panic on NMI when BSP hangs in NMI context
      or the external NMI is swallowed by other NMI handlers on the BSP.
      
      If you specify "none", no CPUs receive external NMIs. This is useful for
      the dump capture kernel so that it cannot be shot down by accidentally
      pressing the external NMI button (on platforms which have it) while
      saving a crash dump.
      
      Signed-off-by: default avatarHidehiro Kawai <hidehiro.kawai.ez@hitachi.com>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Bandan Das <bsd@redhat.com>
      Cc: Baoquan He <bhe@redhat.com>
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiang Liu <jiang.liu@linux.intel.com>
      Cc: Joerg Roedel <joro@8bytes.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: kexec@lists.infradead.org
      Cc: linux-doc@vger.kernel.org
      Cc: "Maciej W. Rozycki" <macro@linux-mips.org>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Viresh Kumar <viresh.kumar@linaro.org>
      Cc: Vivek Goyal <vgoyal@redhat.com>
      Cc: x86-ml <x86@kernel.org>
      Link: http://lkml.kernel.org/r/20151210014632.25437.43778.stgit@softrs
      
      
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      b7c4948e
    • Hidehiro Kawai's avatar
      kexec: Fix race between panic() and crash_kexec() · 7bbee5ca
      Hidehiro Kawai authored
      
      Currently, panic() and crash_kexec() can be called at the same time.
      For example (x86 case):
      
      CPU 0:
        oops_end()
          crash_kexec()
            mutex_trylock() // acquired
              nmi_shootdown_cpus() // stop other CPUs
      
      CPU 1:
        panic()
          crash_kexec()
            mutex_trylock() // failed to acquire
          smp_send_stop() // stop other CPUs
          infinite loop
      
      If CPU 1 calls smp_send_stop() before nmi_shootdown_cpus(), kdump
      fails.
      
      In another case:
      
      CPU 0:
        oops_end()
          crash_kexec()
            mutex_trylock() // acquired
              <NMI>
              io_check_error()
                panic()
                  crash_kexec()
                    mutex_trylock() // failed to acquire
                  infinite loop
      
      Clearly, this is an undesirable result.
      
      To fix this problem, this patch changes crash_kexec() to exclude others
      by using the panic_cpu atomic.
      
      Signed-off-by: default avatarHidehiro Kawai <hidehiro.kawai.ez@hitachi.com>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Baoquan He <bhe@redhat.com>
      Cc: Dave Young <dyoung@redhat.com>
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Cc: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: kexec@lists.infradead.org
      Cc: linux-doc@vger.kernel.org
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Minfei Huang <mnfhuang@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Seth Jennings <sjenning@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
      Cc: Vivek Goyal <vgoyal@redhat.com>
      Cc: x86-ml <x86@kernel.org>
      Link: http://lkml.kernel.org/r/20151210014630.25437.94161.stgit@softrs
      
      
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      7bbee5ca
    • Hidehiro Kawai's avatar
      panic, x86: Allow CPUs to save registers even if looping in NMI context · 58c5661f
      Hidehiro Kawai authored
      
      Currently, kdump_nmi_shootdown_cpus(), a subroutine of crash_kexec(),
      sends an NMI IPI to CPUs which haven't called panic() to stop them,
      save their register information and do some cleanups for crash dumping.
      However, if such a CPU is infinitely looping in NMI context, we fail to
      save its register information into the crash dump.
      
      For example, this can happen when unknown NMIs are broadcast to all
      CPUs as follows:
      
        CPU 0                             CPU 1
        ===========================       ==========================
        receive an unknown NMI
        unknown_nmi_error()
          panic()                         receive an unknown NMI
            spin_trylock(&panic_lock)     unknown_nmi_error()
            crash_kexec()                   panic()
                                              spin_trylock(&panic_lock)
                                              panic_smp_self_stop()
                                                infinite loop
              kdump_nmi_shootdown_cpus()
                issue NMI IPI -----------> blocked until IRET
                                                infinite loop...
      
      Here, since CPU 1 is in NMI context, the second NMI from CPU 0 is
      blocked until CPU 1 executes IRET. However, CPU 1 never executes IRET,
      so the NMI is not handled and the callback function to save registers is
      never called.
      
      In practice, this can happen on some servers which broadcast NMIs to all
      CPUs when the NMI button is pushed.
      
      To save registers in this case, we need to:
      
        a) Return from NMI handler instead of looping infinitely
        or
        b) Call the callback function directly from the infinite loop
      
      Inherently, a) is risky because NMI is also used to prevent corrupted
      data from being propagated to devices.  So, we chose b).
      
      This patch does the following:
      
      1. Move the infinite looping of CPUs which haven't called panic() in NMI
         context (actually done by panic_smp_self_stop()) outside of panic() to
         enable us to refer pt_regs. Please note that panic_smp_self_stop() is
         still used for normal context.
      
      2. Call a callback of kdump_nmi_shootdown_cpus() directly to save
         registers and do some cleanups after setting waiting_for_crash_ipi which
         is used for counting down the number of CPUs which handled the callback
      
      Signed-off-by: default avatarHidehiro Kawai <hidehiro.kawai.ez@hitachi.com>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Cc: Aaron Tomlin <atomlin@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Baoquan He <bhe@redhat.com>
      Cc: Chris Metcalf <cmetcalf@ezchip.com>
      Cc: Dave Young <dyoung@redhat.com>
      Cc: David Hildenbrand <dahi@linux.vnet.ibm.com>
      Cc: Don Zickus <dzickus@redhat.com>
      Cc: Eric Biederman <ebiederm@xmission.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Gobinda Charan Maji <gobinda.cemk07@gmail.com>
      Cc: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
      Cc: Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Javi Merino <javi.merino@arm.com>
      Cc: Jiang Liu <jiang.liu@linux.intel.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: kexec@lists.infradead.org
      Cc: linux-doc@vger.kernel.org
      Cc: lkml <linux-kernel@vger.kernel.org>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Michal Nazarewicz <mina86@mina86.com>
      Cc: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Prarit Bhargava <prarit@redhat.com>
      Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
      Cc: Seth Jennings <sjenning@redhat.com>
      Cc: Stefan Lippers-Hollmann <s.l-h@gmx.de>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ulrich Obergfell <uobergfe@redhat.com>
      Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
      Cc: Vivek Goyal <vgoyal@redhat.com>
      Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
      Link: http://lkml.kernel.org/r/20151210014628.25437.75256.stgit@softrs
      
      
      [ Cleanup comments, fixup formatting. ]
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      58c5661f
    • Hidehiro Kawai's avatar
      panic, x86: Fix re-entrance problem due to panic on NMI · 1717f209
      Hidehiro Kawai authored
      
      If panic on NMI happens just after panic() on the same CPU, panic() is
      recursively called. Kernel stalls, as a result, after failing to acquire
      panic_lock.
      
      To avoid this problem, don't call panic() in NMI context if we've
      already entered panic().
      
      For that, introduce nmi_panic() macro to reduce code duplication. In
      the case of panic on NMI, don't return from NMI handlers if another CPU
      already panicked.
      
      Signed-off-by: default avatarHidehiro Kawai <hidehiro.kawai.ez@hitachi.com>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Cc: Aaron Tomlin <atomlin@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Baoquan He <bhe@redhat.com>
      Cc: Chris Metcalf <cmetcalf@ezchip.com>
      Cc: David Hildenbrand <dahi@linux.vnet.ibm.com>
      Cc: Don Zickus <dzickus@redhat.com>
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Gobinda Charan Maji <gobinda.cemk07@gmail.com>
      Cc: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Javi Merino <javi.merino@arm.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: kexec@lists.infradead.org
      Cc: linux-doc@vger.kernel.org
      Cc: lkml <linux-kernel@vger.kernel.org>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Michal Nazarewicz <mina86@mina86.com>
      Cc: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Prarit Bhargava <prarit@redhat.com>
      Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Seth Jennings <sjenning@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ulrich Obergfell <uobergfe@redhat.com>
      Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
      Cc: Vivek Goyal <vgoyal@redhat.com>
      Link: http://lkml.kernel.org/r/20151210014626.25437.13302.stgit@softrs
      
      
      [ Cleanup comments, fixup formatting. ]
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      1717f209
    • Thomas Gleixner's avatar
      Merge branch 'linus' into x86/apic · d267b8d6
      Thomas Gleixner authored
      Pull in update changes so we can apply conflicting patches
      d267b8d6
    • Linus Torvalds's avatar
      Merge tag 'pm+acpi-4.4-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 1eab0e42
      Linus Torvalds authored
      Pull power management fixes from Rafael Wysocki:
       "These fix a potential regression introduced during the 4.3 cycle
        (generic power domains framework), a nasty bug that has been present
        forever (power capping RAPL driver), a build issue (Tegra cpufreq
        driver) and a minor ugliness introduced recently (intel_pstate).
      
        Specifics:
      
         - Fix a potential regression in the generic power domains framework
           introduced during the 4.3 development cycle that may lead to
           spurious failures of system suspend in certain situations (Ulf
           Hansson).
      
         - Fix a problem in the power capping RAPL (Running Average Power
           Limits) driver that causes it to initialize successfully on some
           systems where it is not supposed to do that which is due to an
           incorrect check in an initialization routine (Prarit Bhargava).
      
         - Fix a build problem in the cpufreq Tegra driver that depends on the
           regulator framework, but that dependency is not reflected in
           Kconfig (Arnd Bergmann).
      
         - Fix a recent mistake in the intel_pstate driver where a numeric
           constant is used directly instead of a symbol defined specifically
           for the case in question (Prarit Bhargava)"
      
      * tag 'pm+acpi-4.4-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        powercap / RAPL: fix BIOS lock check
        cpufreq: intel_pstate: Minor cleanup for FRAC_BITS
        cpufreq: tegra: add regulator dependency for T124
        PM / Domains: Allow runtime PM callbacks to be re-used during system PM
      1eab0e42
    • Linus Torvalds's avatar
      Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · 4fee35a3
      Linus Torvalds authored
      Pull SCSI fixes from James Bottomley:
       "Three fixes this time, two in SES picked up by KASAN for various types
        of buffer overrun.  The first is a USB array which returns page 8
        whatever is asked for and causes us to overrun with incorrect data
        format assumptions and the second is an invalid iteration of page 10
        (the additional information page).
      
        The final fix is a reversion of a NULL deref fix which caused
        suspend/resume not to be called in pairs leading to incorrect device
        operation (Jens has queued a more proper fix for the problem in
        block)"
      
      * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
        ses: fix additional element traversal bug
        Revert "SCSI: Fix NULL pointer dereference in runtime PM"
        ses: Fix problems with simple enclosures
      4fee35a3
    • Linus Torvalds's avatar
      Merge tag 'media/v4.4-3' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media · 76b8ebdc
      Linus Torvalds authored
      Pull media fixes from Mauro Carvalho Chehab.
      
      * tag 'media/v4.4-3' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media:
        [media] airspy: increase USB control message buffer size
        [media] hackrf: move RF gain ctrl enable behind module parameter
        [media] hackrf: fix possible null ptr on debug printing
        [media] Revert "[media] ivtv: avoid going past input/audio array"
      76b8ebdc
    • Linus Torvalds's avatar
      Merge branch 'for-linus-4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs · fc315e3e
      Linus Torvalds authored
      Pull btrfs fixes from Chris Mason:
       "A couple of small fixes"
      
      * 'for-linus-4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
        Btrfs: check prepare_uptodate_page() error code earlier
        Btrfs: check for empty bitmap list in setup_cluster_bitmaps
        btrfs: fix misleading warning when space cache failed to load
        Btrfs: fix transaction handle leak in balance
        Btrfs: fix unprotected list move from unused_bgs to deleted_bgs list
      fc315e3e
    • Linus Torvalds's avatar
      Merge branch 'akpm' (patches from Andrew) · 8b4414f5
      Linus Torvalds authored
      Merge misc fixes from Andrew Morton:
       "Three patches"
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>:
        include/linux/mmdebug.h: should include linux/bug.h
        mm/zswap: change incorrect strncmp use to strcmp
        proc: fix -ESRCH error when writing to /proc/$pid/coredump_filter
      8b4414f5
    • James Morse's avatar
      include/linux/mmdebug.h: should include linux/bug.h · 1d5cda40
      James Morse authored
      
      mmdebug.h uses BUILD_BUG_ON_INVALID(), assuming someone else included
      linux/bug.h.  Include it ourselves.
      
      This saves build-failures such as:
      
        arch/arm64/include/asm/pgtable.h: In function 'set_pte_at':
        arch/arm64/include/asm/pgtable.h:281:3: error: implicit declaration of function 'BUILD_BUG_ON_INVALID' [-Werror=implicit-function-declaration]
         VM_WARN_ONCE(!pte_young(pte),
      
      Fixes: 02602a18 ("bug: completely remove code generated by disabled VM_BUG_ON()")
      Signed-off-by: default avatarJames Morse <james.morse@arm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1d5cda40
    • Dan Streetman's avatar
      mm/zswap: change incorrect strncmp use to strcmp · 8bc8b228
      Dan Streetman authored
      
      Change the use of strncmp in zswap_pool_find_get() to strcmp.
      
      The use of strncmp is no longer correct, now that zswap_zpool_type is
      not an array; sizeof() will return the size of a pointer, which isn't
      the right length to compare.  We don't need to use strncmp anyway,
      because the existing params and the passed in params are all guaranteed
      to be null terminated, so strcmp should be used.
      
      Signed-off-by: default avatarDan Streetman <ddstreet@ieee.org>
      Reported-by: default avatarWeijie Yang <weijie.yang@samsung.com>
      Cc: Seth Jennings <sjennings@variantweb.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      8bc8b228
    • Colin Ian King's avatar
      proc: fix -ESRCH error when writing to /proc/$pid/coredump_filter · 41a0c249
      Colin Ian King authored
      
      Writing to /proc/$pid/coredump_filter always returns -ESRCH because commit
      774636e1 ("proc: convert to kstrto*()/kstrto*_from_user()") removed
      the setting of ret after the get_proc_task call and incorrectly left it as
      -ESRCH.  Instead, return 0 when successful.
      
      Example breakage:
      
        echo 0 > /proc/self/coredump_filter
        bash: echo: write error: No such process
      
      Fixes: 774636e1 ("proc: convert to kstrto*()/kstrto*_from_user()")
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Acked-by: default avatarKees Cook <keescook@chromium.org>
      Cc: <stable@vger.kernel.org> [4.3+]
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      41a0c249
    • Linus Torvalds's avatar
      Merge tag 'hwmon-for-linus-v4.4-rc6' of... · 65d70e79
      Linus Torvalds authored
      Merge tag 'hwmon-for-linus-v4.4-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
      
      Pull hwmon fixes from Guenter Roeck:
      
       - Select CONFIG_BITREVERSE for sht15 driver to avoid build failure if
         it is not configured.
      
       - Force wait for conversion time for the first valid data in tmp102
         driver to avoid reporting erroneous data to the thermal subsystem.
      
      * tag 'hwmon-for-linus-v4.4-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
        hwmon: (sht15) Select CONFIG_BITREVERSE
        hwmon: (tmp102) Force wait for conversion time for the first valid data
      65d70e79
    • Linus Torvalds's avatar
      Merge tag 'iommu-fixes-v4.4-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu · ccdd96be
      Linus Torvalds authored
      Pull IOMMU fixes from Joerg Roedel:
       "Two similar fixes for the Intel and AMD IOMMU drivers to add proper
        access checks before calling handle_mm_fault"
      
      * tag 'iommu-fixes-v4.4-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
        iommu/vt-d: Do access checks before calling handle_mm_fault()
        iommu/amd: Do proper access checking before calling handle_mm_fault()
      ccdd96be
    • Linus Torvalds's avatar
      Merge tag 'for-linus-4.4-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip · 3273cba1
      Linus Torvalds authored
      Pull xen bug fixes from David Vrabel:
       - XSA-155 security fixes to backend drivers.
       - XSA-157 security fixes to pciback.
      
      * tag 'for-linus-4.4-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
        xen-pciback: fix up cleanup path when alloc fails
        xen/pciback: Don't allow MSI-X ops if PCI_COMMAND_MEMORY is not set.
        xen/pciback: For XEN_PCI_OP_disable_msi[|x] only disable if device has MSI(X) enabled.
        xen/pciback: Do not install an IRQ handler for MSI interrupts.
        xen/pciback: Return error on XEN_PCI_OP_enable_msix when device has MSI or MSI-X enabled
        xen/pciback: Return error on XEN_PCI_OP_enable_msi when device has MSI or MSI-X enabled
        xen/pciback: Save xen_pci_op commands before processing it
        xen-scsiback: safely copy requests
        xen-blkback: read from indirect descriptors only once
        xen-blkback: only read request operation from shared ring once
        xen-netback: use RING_COPY_REQUEST() th...
      3273cba1
    • Linus Torvalds's avatar
      Merge tag 'arc-fixes-for-4.4-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc · 83ad283f
      Linus Torvalds authored
      Pull ARC architecture fixes from Vineet Gupta:
       "Fixes for:
      
       - perf interrupts on SMP: Not enabled (at boot) and disabled (at runtime)
       - stack unwinder regression (for modules, ignoring dwarf3)
       - nsim hosed for non default kernel link base builds"
      
      * tag 'arc-fixes-for-4.4-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc:
        ARC: smp: Rename platform hook @init_cpu_smp -> @init_per_cpu
        ARC: rename smp operation init_irq_cpu() to init_per_cpu()
        ARC: dw2 unwind: Ignore CIE version !=1 gracefully instead of bailing
        ARC: dw2 unwind: Reinstante unwinding out of modules
        ARC: [plat-sim] unbork non default CONFIG_LINUX_LINK_BASE
        ARC: intc: Document arc_request_percpu_irq() better
        ARCv2: perf: Ensure perf intr gets enabled on all cores
        ARC: intc: No need to clear IRQ_NOAUTOEN
        ARCv2: intc: Fix random perf irq disabling in SMP setup
        ARC: [axs10x] cap ethernet phy to 100 Mbit/sec
      83ad283f
    • Linus Torvalds's avatar
      Merge tag 'sound-4.4-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound · 7b612255
      Linus Torvalds authored
      Pull sound fixes from Takashi Iwai:
       "As usual in rc6, this update contains only a few HD-audio and
        USB-audio device-specific quirks: yet another Thinkpad noise fixes,
        Dell headphone mic fixes, and AudioQuest DragonFly fixes"
      
      * tag 'sound-4.4-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
        ALSA: hda - Add a fixup for Thinkpad X1 Carbon 2nd
        ALSA: hda - Set codec to D3 at reboot/shutdown on Thinkpads
        ALSA: hda - Apply click noise workaround for Thinkpads generically
        ALSA: hda - Fix headphone mic input on a few Dell ALC293 machines
        ALSA: usb-audio: Add sample rate inquiry quirk for AudioQuest DragonFly
        ALSA: usb-audio: Add a more accurate volume quirk for AudioQuest DragonFly
      7b612255
    • Linus Torvalds's avatar
      Merge tag 'for-linus-20151217' of git://git.infradead.org/linux-mtd · 19c52240
      Linus Torvalds authored
      Pull MTD fixes from Brian Norris:
       "I was holding out on this pull request for a bit, since there are a
        few other small issues being discussed that look like 4.4-rc
        regressions.  Hopefully I can get those stabilized soon, but these are
        ready at any rate:
      
         - A little bit of a last-minute change for the device tree "fixed
           partition" binding.  This is needed because we might want to reuse
           the 'partitions' subnode for other sorts of partitioning
           descriptions -- e.g., for describing which on-flash partition
           format(s) might be used on the system.
      
         - Also tone down a warning message, since it is probably going to
           show up on a lot of systems where it should just be ignored"
      
      * tag 'for-linus-20151217' of git://git.infradead.org/linux-mtd:
        doc: dt: mtd: partitions: add compatible property to "partitions" node
        mtd: ofpart: don't complain about missing 'partitions' node too loudly
      19c52240
    • Antti Palosaari's avatar
      [media] airspy: increase USB control message buffer size · aa0850e1
      Antti Palosaari authored
      Driver requested device firmware version string during probe using
      only 24 byte long buffer. That buffer is too small for newer firmware
      versions, which causes device firmware hang - device stops responding
      to any commands after that. Increase buffer size to 128 which should
      be enough for any current and future version strings.
      
      Link: https://github.com/airspy/host/issues/27
      
      
      
      Cc: <stable@vger.kernel.org> # 3.17+
      Reported-by: default avatarBenjamin Vernoux <bvernoux@gmail.com>
      Signed-off-by: default avatarAntti Palosaari <crope@iki.fi>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
      aa0850e1
    • Antti Palosaari's avatar
      [media] hackrf: move RF gain ctrl enable behind module parameter · d47fa531
      Antti Palosaari authored
      
      Used Avago MGA-81563 RF amplifier could be destroyed pretty easily
      with too strong signal or transmitting to bad antenna.
      Add module parameter 'enable_rf_gain_ctrl' which allows enabling
      RF gain control - otherwise, default without the module parameter,
      RF gain control is set to 'grabbed' state which prevents setting
      value to the control.
      
      Signed-off-by: default avatarAntti Palosaari <crope@iki.fi>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
      d47fa531
    • Antti Palosaari's avatar
      [media] hackrf: fix possible null ptr on debug printing · eb35cf47
      Antti Palosaari authored
      
      drivers/media/usb/hackrf/hackrf.c:1533 hackrf_probe()
      error: we previously assumed 'dev' could be null (see line 1366)
      
      Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarAntti Palosaari <crope@iki.fi>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
      eb35cf47
    • Mauro Carvalho Chehab's avatar
      [media] Revert "[media] ivtv: avoid going past input/audio array" · dfcf36d9
      Mauro Carvalho Chehab authored
      This patch broke ivtv logic, as reported at
       https://bugzilla.redhat.com/show_bug.cgi?id=1278942
      
      
      
      This reverts commit 09290cc8.
      
      Cc: stable@vger.kernel.org # for v4.1 and upper
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
      dfcf36d9
    • Doug Goldstein's avatar
      xen-pciback: fix up cleanup path when alloc fails · 584a561a
      Doug Goldstein authored
      
      When allocating a pciback device fails, clear the private
      field. This could lead to an use-after free, however
      the 'really_probe' takes care of setting
      dev_set_drvdata(dev, NULL) in its failure path (which we would
      exercise if the ->probe function failed), so we we
      are OK. However lets be defensive as the code can change.
      
      Going forward we should clean up the pci_set_drvdata(dev, NULL)
      in the various code-base. That will be for another day.
      
      Reviewed-by: default avatarBoris Ostrovsky <boris.ostrovsky@oracle.com>
      Reported-by: default avatarJonathan Creekmore <jonathan.creekmore@gmail.com>
      Signed-off-by: default avatarDoug Goldstein <cardoe@cardoe.com>
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      584a561a
    • Arnd Bergmann's avatar
      hwmon: (sht15) Select CONFIG_BITREVERSE · a3a316cf
      Arnd Bergmann authored
      
      If CONFIG_BITREVERSE is not built-in, the sht15 driver fails to link:
      
      drivers/built-in.o: In function `sht15_crc8':
      drivers/hwmon/sht15.c:195: undefined reference to `byte_rev_table'
      
      This adds a Kconfig 'select' statement, like all other users of
      bitrev.h have it.
      
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Fixes: 33836ee9 ("hwmon:change sht15_reverse()")
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      a3a316cf
  3. Dec 18, 2015
    • Konrad Rzeszutek Wilk's avatar
      xen/pciback: Don't allow MSI-X ops if PCI_COMMAND_MEMORY is not set. · 408fb0e5
      Konrad Rzeszutek Wilk authored
      
      commit f598282f ("PCI: Fix the NIU MSI-X problem in a better way")
      teaches us that dealing with MSI-X can be troublesome.
      
      Further checks in the MSI-X architecture shows that if the
      PCI_COMMAND_MEMORY bit is turned of in the PCI_COMMAND we
      may not be able to access the BAR (since they are memory regions).
      
      Since the MSI-X tables are located in there.. that can lead
      to us causing PCIe errors. Inhibit us performing any
      operation on the MSI-X unless the MEMORY bit is set.
      
      Note that Xen hypervisor with:
      "x86/MSI-X: access MSI-X table only after having enabled MSI-X"
      will return:
      xen_pciback: 0000:0a:00.1: error -6 enabling MSI-X for guest 3!
      
      When the generic MSI code tries to setup the PIRQ without
      MEMORY bit set. Which means with later versions of Xen
      (4.6) this patch is not neccessary.
      
      This is part of XSA-157
      
      CC: stable@vger.kernel.org
      Reviewed-by: default avatarJan Beulich <jbeulich@suse.com>
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      408fb0e5
    • Konrad Rzeszutek Wilk's avatar
      xen/pciback: For XEN_PCI_OP_disable_msi[|x] only disable if device has MSI(X) enabled. · 7cfb905b
      Konrad Rzeszutek Wilk authored
      
      Otherwise just continue on, returning the same values as
      previously (return of 0, and op->result has the PIRQ value).
      
      This does not change the behavior of XEN_PCI_OP_disable_msi[|x].
      
      The pci_disable_msi or pci_disable_msix have the checks for
      msi_enabled or msix_enabled so they will error out immediately.
      
      However the guest can still call these operations and cause
      us to disable the 'ack_intr'. That means the backend IRQ handler
      for the legacy interrupt will not respond to interrupts anymore.
      
      This will lead to (if the device is causing an interrupt storm)
      for the Linux generic code to disable the interrupt line.
      
      Naturally this will only happen if the device in question
      is plugged in on the motherboard on shared level interrupt GSI.
      
      This is part of XSA-157
      
      CC: stable@vger.kernel.org
      Reviewed-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      7cfb905b
    • Konrad Rzeszutek Wilk's avatar
      xen/pciback: Do not install an IRQ handler for MSI interrupts. · a396f3a2
      Konrad Rzeszutek Wilk authored
      
      Otherwise an guest can subvert the generic MSI code to trigger
      an BUG_ON condition during MSI interrupt freeing:
      
       for (i = 0; i < entry->nvec_used; i++)
              BUG_ON(irq_has_action(entry->irq + i));
      
      Xen PCI backed installs an IRQ handler (request_irq) for
      the dev->irq whenever the guest writes PCI_COMMAND_MEMORY
      (or PCI_COMMAND_IO) to the PCI_COMMAND register. This is
      done in case the device has legacy interrupts the GSI line
      is shared by the backend devices.
      
      To subvert the backend the guest needs to make the backend
      to change the dev->irq from the GSI to the MSI interrupt line,
      make the backend allocate an interrupt handler, and then command
      the backend to free the MSI interrupt and hit the BUG_ON.
      
      Since the backend only calls 'request_irq' when the guest
      writes to the PCI_COMMAND register the guest needs to call
      XEN_PCI_OP_enable_msi before any other operation. This will
      cause the generic MSI code to setup an MSI entry and
      populate dev->irq with the new PIRQ value.
      
      Then the guest can write to PCI_COMMAND PCI_COMMAND_MEMORY
      and cause the backend to setup an IRQ handler for dev->irq
      (which instead of the GSI value has the MSI pirq). See
      'xen_pcibk_control_isr'.
      
      Then the guest disables the MSI: XEN_PCI_OP_disable_msi
      which ends up triggering the BUG_ON condition in 'free_msi_irqs'
      as there is an IRQ handler for the entry->irq (dev->irq).
      
      Note that this cannot be done using MSI-X as the generic
      code does not over-write dev->irq with the MSI-X PIRQ values.
      
      The patch inhibits setting up the IRQ handler if MSI or
      MSI-X (for symmetry reasons) code had been called successfully.
      
      P.S.
      Xen PCIBack when it sets up the device for the guest consumption
      ends up writting 0 to the PCI_COMMAND (see xen_pcibk_reset_device).
      XSA-120 addendum patch removed that - however when upstreaming said
      addendum we found that it caused issues with qemu upstream. That
      has now been fixed in qemu upstream.
      
      This is part of XSA-157
      
      CC: stable@vger.kernel.org
      Reviewed-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      a396f3a2
    • Konrad Rzeszutek Wilk's avatar
      xen/pciback: Return error on XEN_PCI_OP_enable_msix when device has MSI or MSI-X enabled · 5e0ce145
      Konrad Rzeszutek Wilk authored
      
      The guest sequence of:
      
        a) XEN_PCI_OP_enable_msix
        b) XEN_PCI_OP_enable_msix
      
      results in hitting an NULL pointer due to using freed pointers.
      
      The device passed in the guest MUST have MSI-X capability.
      
      The a) constructs and SysFS representation of MSI and MSI groups.
      The b) adds a second set of them but adding in to SysFS fails (duplicate entry).
      'populate_msi_sysfs' frees the newly allocated msi_irq_groups (note that
      in a) pdev->msi_irq_groups is still set) and also free's ALL of the
      MSI-X entries of the device (the ones allocated in step a) and b)).
      
      The unwind code: 'free_msi_irqs' deletes all the entries and tries to
      delete the pdev->msi_irq_groups (which hasn't been set to NULL).
      However the pointers in the SysFS are already freed and we hit an
      NULL pointer further on when 'strlen' is attempted on a freed pointer.
      
      The patch adds a simple check in the XEN_PCI_OP_enable_msix to guard
      against that. The check for msi_enabled is not stricly neccessary.
      
      This is part of XSA-157
      
      CC: stable@vger.kernel.org
      Reviewed-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      Reviewed-by: default avatarJan Beulich <jbeulich@suse.com>
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      5e0ce145
    • Konrad Rzeszutek Wilk's avatar
      xen/pciback: Return error on XEN_PCI_OP_enable_msi when device has MSI or MSI-X enabled · 56441f3c
      Konrad Rzeszutek Wilk authored
      
      The guest sequence of:
      
       a) XEN_PCI_OP_enable_msi
       b) XEN_PCI_OP_enable_msi
       c) XEN_PCI_OP_disable_msi
      
      results in hitting an BUG_ON condition in the msi.c code.
      
      The MSI code uses an dev->msi_list to which it adds MSI entries.
      Under the above conditions an BUG_ON() can be hit. The device
      passed in the guest MUST have MSI capability.
      
      The a) adds the entry to the dev->msi_list and sets msi_enabled.
      The b) adds a second entry but adding in to SysFS fails (duplicate entry)
      and deletes all of the entries from msi_list and returns (with msi_enabled
      is still set).  c) pci_disable_msi passes the msi_enabled checks and hits:
      
      BUG_ON(list_empty(dev_to_msi_list(&dev->dev)));
      
      and blows up.
      
      The patch adds a simple check in the XEN_PCI_OP_enable_msi to guard
      against that. The check for msix_enabled is not stricly neccessary.
      
      This is part of XSA-157.
      
      CC: stable@vger.kernel.org
      Reviewed-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      Reviewed-by: default avatarJan Beulich <jbeulich@suse.com>
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      56441f3c
    • Konrad Rzeszutek Wilk's avatar
      xen/pciback: Save xen_pci_op commands before processing it · 8135cf8b
      Konrad Rzeszutek Wilk authored
      
      Double fetch vulnerabilities that happen when a variable is
      fetched twice from shared memory but a security check is only
      performed the first time.
      
      The xen_pcibk_do_op function performs a switch statements on the op->cmd
      value which is stored in shared memory. Interestingly this can result
      in a double fetch vulnerability depending on the performed compiler
      optimization.
      
      This patch fixes it by saving the xen_pci_op command before
      processing it. We also use 'barrier' to make sure that the
      compiler does not perform any optimization.
      
      This is part of XSA155.
      
      CC: stable@vger.kernel.org
      Reviewed-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: default avatarJan Beulich <JBeulich@suse.com>
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      8135cf8b
    • David Vrabel's avatar
      xen-scsiback: safely copy requests · be69746e
      David Vrabel authored
      
      The copy of the ring request was lacking a following barrier(),
      potentially allowing the compiler to optimize the copy away.
      
      Use RING_COPY_REQUEST() to ensure the request is copied to local
      memory.
      
      This is part of XSA155.
      
      CC: stable@vger.kernel.org
      Reviewed-by: default avatarJuergen Gross <jgross@suse.com>
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      be69746e
    • Roger Pau Monné's avatar
      xen-blkback: read from indirect descriptors only once · 18779149
      Roger Pau Monné authored
      
      Since indirect descriptors are in memory shared with the frontend, the
      frontend could alter the first_sect and last_sect values after they have
      been validated but before they are recorded in the request.  This may
      result in I/O requests that overflow the foreign page, possibly
      overwriting local pages when the I/O request is executed.
      
      When parsing indirect descriptors, only read first_sect and last_sect
      once.
      
      This is part of XSA155.
      
      CC: stable@vger.kernel.org
      Signed-off-by: default avatarRoger Pau Monné <roger.pau@citrix.com>
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      18779149
    • Roger Pau Monné's avatar
      xen-blkback: only read request operation from shared ring once · 1f13d75c
      Roger Pau Monné authored
      
      A compiler may load a switch statement value multiple times, which could
      be bad when the value is in memory shared with the frontend.
      
      When converting a non-native request to a native one, ensure that
      src->operation is only loaded once by using READ_ONCE().
      
      This is part of XSA155.
      
      CC: stable@vger.kernel.org
      Signed-off-by: default avatarRoger Pau Monné <roger.pau@citrix.com>
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      1f13d75c
    • David Vrabel's avatar
      xen-netback: use RING_COPY_REQUEST() throughout · 68a33bfd
      David Vrabel authored
      
      Instead of open-coding memcpy()s and directly accessing Tx and Rx
      requests, use the new RING_COPY_REQUEST() that ensures the local copy
      is correct.
      
      This is more than is strictly necessary for guest Rx requests since
      only the id and gref fields are used and it is harmless if the
      frontend modifies these.
      
      This is part of XSA155.
      
      CC: stable@vger.kernel.org
      Reviewed-by: default avatarWei Liu <wei.liu2@citrix.com>
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      68a33bfd
    • David Vrabel's avatar
      xen-netback: don't use last request to determine minimum Tx credit · 0f589967
      David Vrabel authored
      
      The last from guest transmitted request gives no indication about the
      minimum amount of credit that the guest might need to send a packet
      since the last packet might have been a small one.
      
      Instead allow for the worst case 128 KiB packet.
      
      This is part of XSA155.
      
      CC: stable@vger.kernel.org
      Reviewed-by: default avatarWei Liu <wei.liu2@citrix.com>
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      0f589967
    • David Vrabel's avatar
      xen: Add RING_COPY_REQUEST() · 454d5d88
      David Vrabel authored
      
      Using RING_GET_REQUEST() on a shared ring is easy to use incorrectly
      (i.e., by not considering that the other end may alter the data in the
      shared ring while it is being inspected).  Safe usage of a request
      generally requires taking a local copy.
      
      Provide a RING_COPY_REQUEST() macro to use instead of
      RING_GET_REQUEST() and an open-coded memcpy().  This takes care of
      ensuring that the copy is done correctly regardless of any possible
      compiler optimizations.
      
      Use a volatile source to prevent the compiler from reordering or
      omitting the copy.
      
      This is part of XSA155.
      
      CC: stable@vger.kernel.org
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      454d5d88