1. 15 May, 2017 21 commits
  2. 08 May, 2017 19 commits
    • Greg Kroah-Hartman's avatar
      Linux 3.18.52 · 68e50dad
      Greg Kroah-Hartman authored
      68e50dad
    • Adrian Salido's avatar
      dm ioctl: prevent stack leak in dm ioctl call · d9684d5c
      Adrian Salido authored
      commit 4617f564 upstream.
      
      When calling a dm ioctl that doesn't process any data
      (IOCTL_FLAGS_NO_PARAMS), the contents of the data field in struct
      dm_ioctl are left initialized.  Current code is incorrectly extending
      the size of data copied back to user, causing the contents of kernel
      stack to be leaked to user.  Fix by only copying contents before data
      and allow the functions processing the ioctl to override.
      Signed-off-by: default avatarAdrian Salido <salidoa@google.com>
      Reviewed-by: default avatarAlasdair G Kergon <agk@redhat.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d9684d5c
    • Masahiro Yamada's avatar
      kbuild: mergeconfig: fix "jobserver unavailable" warning · a82c4da2
      Masahiro Yamada authored
      commit de461993 upstream.
      
      If "make kvmconfig" is run with "-j" option, a warning message,
      "jobserver unavailable: using -j1.  Add `+' to parent make rule.",
      is displayed.
      
        $ make -s defconfig
        *** Default configuration is based on 'x86_64_defconfig'
        #
        # configuration written to .config
        #
        $ make -j8 kvmconfig
        Using ./.config as base
        Merging ./arch/x86/configs/kvm_guest.config
          [ snip ]
        #
        # merged configuration written to ./.config (needs make)
        #
        make[2]: warning: jobserver unavailable: using -j1.  Add `+' to
        parent make rule.
        scripts/kconfig/conf --oldconfig Kconfig
          [ snip ]
        #
        # configuration written to .config
        #
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: default avatarJosh Triplett <josh@joshtriplett.org>
      Reviewed-by: default avatarDarren Hart <dvhart@linux.intel.com>
      Signed-off-by: default avatarMichal Marek <mmarek@suse.cz>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a82c4da2
    • Arnd Bergmann's avatar
      gfs2: remove IS_ERR_VALUE abuse · 12bf6fbc
      Arnd Bergmann authored
      Picked from commit 287980e4 ("remove lots
      of IS_ERR_VALUE abuses") upstream.
      
      The original fix that was backported to 3.18 already addressed the warning
      in some configurations, but not in others, leaving us with the same output:
      
      ../fs/gfs2/dir.c: In function 'get_first_leaf':
      ../fs/gfs2/dir.c:768:9: warning: 'leaf_no' may be used uninitialized in this function [-Wmaybe-uninitialized]
         error = get_leaf(dip, leaf_no, bh_out);
               ^
      ../fs/gfs2/dir.c: In function 'dir_split_leaf.isra.20':
      ../fs/gfs2/dir.c:987:8: warning: 'leaf_no' may be used uninitialized in this function [-Wmaybe-uninitialized]
      
      This takes the approach that we took in later versions in mainline,
      but does not backport the entire patch, as that would be too large
      for stable and IIRC caused regressions in other drivers.
      
      Fixes: 9d46d31e ("gfs2: avoid uninitialized variable warning")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      12bf6fbc
    • Jeff Kirsher's avatar
      e1000e: fix call to do_div() to use u64 arg · 8d86ef0c
      Jeff Kirsher authored
      commit 30544af5 upstream.
      
      We were using s64 for lat_ns (latency nano-second value) since in
      our calculations a negative value could be a resultant.  For negative
      values, we then assign lat_ns to be zero, so the value passed to
      do_div() was never negative, but do_div() expects the argument type
      to be u64, so do a cast to resolve a compile warning seen on
      PowerPC.
      
      CC: Yanjiang Jin <yanjiang.jin@windriver.com>
      CC: Yanir Lubetkin <yanirx.lubetkin@intel.com>
      Reported-by: default avatarYanjiang Jin <yanjiang.jin@windriver.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8d86ef0c
    • Rusty Russell's avatar
      cpumask_set_cpu_local_first => cpumask_local_spread, lament · 706470a2
      Rusty Russell authored
      commit f36963c9 upstream.
      
      da91309e (cpumask: Utility function to set n'th cpu...) created a
      genuinely weird function.  I never saw it before, it went through DaveM.
      (He only does this to make us other maintainers feel better about our own
      mistakes.)
      
      cpumask_set_cpu_local_first's purpose is say "I need to spread things
      across N online cpus, choose the ones on this numa node first"; you call
      it in a loop.
      
      It can fail.  One of the two callers ignores this, the other aborts and
      fails the device open.
      
      It can fail in two ways: allocating the off-stack cpumask, or through a
      convoluted codepath which AFAICT can only occur if cpu_online_mask
      changes.  Which shouldn't happen, because if cpu_online_mask can change
      while you call this, it could return a now-offline cpu anyway.
      
      It contains a nonsensical test "!cpumask_of_node(numa_node)".  This was
      drawn to my attention by Geert, who said this causes a warning on Sparc.
      It sets a single bit in a cpumask instead of returning a cpu number,
      because that's what the callers want.
      
      It could be made more efficient by passing the previous cpu rather than
      an index, but that would be more invasive to the callers.
      
      [backporting for 3.18: only two callers exist, otherwise no change.
       The same warning shows up for "!cpumask_of_node()", and I thought
       about just addressing the warning, but using the whole fix seemed
       better in the end as one of the two callers also lacks the error
       handling]
      
      Fixes: da91309e
      Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (then rebased)
      Tested-by: default avatarAmir Vadai <amirv@mellanox.com>
      Acked-by: default avatarAmir Vadai <amirv@mellanox.com>
      Acked-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      706470a2
    • Paul Gortmaker's avatar
      modpost: don't emit section mismatch warnings for compiler optimizations · 62011a96
      Paul Gortmaker authored
      commit 4a3893d0 upstream.
      
      Currently an allyesconfig build [gcc-4.9.1] can generate the following:
      
         WARNING: vmlinux.o(.text.unlikely+0x3864): Section mismatch in
         reference from the function cpumask_empty.constprop.3() to the
         variable .init.data:nmi_ipi_mask
      
      which comes from the cpumask_empty usage in arch/x86/kernel/nmi_selftest.c.
      
      Normally we would not see a symbol entry for cpumask_empty since it is:
      
      	static inline bool cpumask_empty(const struct cpumask *srcp)
      
      however in this case, the variant of the symbol gets emitted when GCC does
      constant propagation optimization.
      
      Fix things up so that any locally optimized constprop variants don't warn
      when accessing variables that live in the __init sections.
      
      [arnd: adapted text_sections definition to 3.18]
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      62011a96
    • Paul Gortmaker's avatar
      modpost: expand pattern matching to support substring matches · 0acdf438
      Paul Gortmaker authored
      commit 09c20c03 upstream.
      
      Currently the match() function supports a leading * to match any
      prefix and a trailing * to match any suffix.  However there currently
      is not a combination of both that can be used to target matches of
      whole families of functions that share a common substring.
      
      Here we expand the *foo and foo* match to also support *foo* with
      the goal of targeting compiler generated symbol names that contain
      strings like ".constprop." and ".isra."
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0acdf438
    • Arnd Bergmann's avatar
      scsi: advansys: remove #warning message · 5ef34699
      Arnd Bergmann authored
      The advansys driver was converted to the proper DMA API in linux-4.2, but
      the 3.18-stable kernel still warns about this:
      
      drivers/scsi/advansys.c:71:2: warning: #warning this driver is still not properly converted to the DMA API [-Wcpp]
      
      The warning clearly is not helpful in 3.18 any more, it just clutters up
      the build log. This removes the warning instead, and clarifies the
      comment above it.
      
      Cc: Hannes Reinecke <hare@suse.de>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5ef34699
    • Arnd Bergmann's avatar
      i2o: hide unsafe ioctl on 64-bit · 85741f96
      Arnd Bergmann authored
      We get a warning about a broken pointer conversion on 64-bit architectures:
      
      drivers/message/i2o/i2o_config.c: In function 'i2o_cfg_passthru':
      drivers/message/i2o/i2o_config.c:893:19: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
               (p->virt, (void __user *)sg[i].addr_bus,
                         ^
      drivers/message/i2o/i2o_config.c:953:10: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
               ((void __user *)sg[j].addr_bus, sg_list[j].virt,
                ^
      
      This has clearly never worked right, so we can add an #ifdef around the code.
      The driver was moved to staging in linux-4.0 and finally removed in 4.2,
      so upstream does not have a fix for it.
      
      The driver originally got this mostly right, though probably by accident.
      
      Fixes: f4c2c15b ("[PATCH] Convert i2o to compat_ioctl")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      85741f96
    • Benjamin Romer's avatar
      staging: unisys: correctly handle return value from queue_delayed_work() · c2bccd02
      Benjamin Romer authored
      commit f84bd626 upstream.
      
      Properly handle the return value from queue_delayed_work() - it's a
      bool, not an int, so using a less than comparison isn't appropriate.
      
      This mistake was found by David Binderman <dcb314@hotmail.com>.
      
      [arnd: the fix is from 4.4 but needed some minor fixup to adapt
       to context changes]
      Signed-off-by: default avatarBenjamin Romer <benjamin.romer@unisys.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      c2bccd02
    • Ralf Baechle's avatar
      MIPS: elf2ecoff: Fix warning due to dead code. · b7745161
      Ralf Baechle authored
      commit 2d76e963 upstream.
      
        HOSTCC  arch/mips/boot/elf2ecoff
      arch/mips/boot/elf2ecoff.c: In function ‘main’:
      arch/mips/boot/elf2ecoff.c:271:8: warning: variable ‘shstrtab’ set but not used [-Wunused-but-set-variable]
        char *shstrtab;
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b7745161
    • Ralf Baechle's avatar
      MIPS: elf2ecoff: Ignore PT_MIPS_ABIFLAGS program headers. · 607333f5
      Ralf Baechle authored
      commit 26f7c4bd upstream.
      
      These are generated by very recent toolchains and result in an error
      message when attenpting to convert a kernel from ELF to ECOFF.
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      607333f5
    • Arnd Bergmann's avatar
      MIPS: jz4740: fix build error in irq.h · 4617a70c
      Arnd Bergmann authored
      kernelci found build error on the 3.18 stable tree that don't
      show up in later versions:
      
      arch/mips/jz4740/irq.h:21:38: error: 'struct irq_data' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
      arch/mips/jz4740/irq.h:20:39: error: 'struct irq_data' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
      include/linux/irqdesc.h:92:33: error: 'NR_IRQS' undeclared here (not in a function)
      arch/mips/jz4740/irq.c:91:41: error: 'JZ4740_IRQ_BASE' undeclared (first use in this function)
      arch/mips/jz4740/irq.c:68:6: error: conflicting types for 'jz4740_irq_resume'
      arch/mips/jz4740/irq.c:62:6: error: conflicting types for 'jz4740_irq_suspend'
      arch/mips/jz4740/irq.c:49:39: error: 'JZ4740_IRQ_BASE' undeclared (first use in this function)
      arch/mips/jz4740/gpio.c:47:32: error: initializer element is not constant
      arch/mips/jz4740/gpio.c:46:32: error: initializer element is not constant
      arch/mips/jz4740/gpio.c:45:32: error: initializer element is not constant
      arch/mips/jz4740/gpio.c:44:32: error: initializer element is not constant
      arch/mips/jz4740/gpio.c:447:22: error: assignment from incompatible pointer type [-Werror=incompatible-pointer-types]
      arch/mips/jz4740/gpio.c:446:23: error: assignment from incompatible pointer type [-Werror=incompatible-pointer-types]
      arch/mips/jz4740/gpio.c:427:14: error: implicit declaration of function 'JZ4740_IRQ_INTC_GPIO' [-Werror=implicit-function-declaration]
      arch/mips/jz4740/gpio.c:269:9: error: implicit declaration of function 'JZ4740_IRQ_GPIO' [-Werror=implicit-function-declaration]
      
      The problem seems to be caused by commit 83bc7692 ("MIPS: JZ4740: Use
      generic irq chip") from linux-3.2, but only showed up in a defconfig
      build when qi_lb60_defconfig was added in linux-3.13 and that configuration
      never successfully built.
      
      The code has changed in a number of ways before 4.4, which builds fine.
      While I did not bisect the problem to a specific change, I found a simple
      fix by including the obviously missing header.
      
      Cc: Lars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4617a70c
    • Stephen Rothwell's avatar
      mm/cma: silence warnings due to max() usage · dec349c0
      Stephen Rothwell authored
      commit badbda53 upstream.
      
      pageblock_order can be (at least) an unsigned int or an unsigned long
      depending on the kernel config and architecture, so use max_t(unsigned
      long, ...) when comparing it.
      
      fixes these warnings:
      
      In file included from include/asm-generic/bug.h:13:0,
                       from arch/powerpc/include/asm/bug.h:127,
                       from include/linux/bug.h:4,
                       from include/linux/mmdebug.h:4,
                       from include/linux/mm.h:8,
                       from include/linux/memblock.h:18,
                       from mm/cma.c:28:
      mm/cma.c: In function 'cma_init_reserved_mem':
      include/linux/kernel.h:748:17: warning: comparison of distinct pointer types lacks a cast
        (void) (&_max1 == &_max2);                   ^
      mm/cma.c:186:27: note: in expansion of macro 'max'
        alignment = PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order);
                                 ^
      mm/cma.c: In function 'cma_declare_contiguous':
      include/linux/kernel.h:748:17: warning: comparison of distinct pointer types lacks a cast
        (void) (&_max1 == &_max2);                   ^
      include/linux/kernel.h:747:9: note: in definition of macro 'max'
        typeof(y) _max2 = (y);            ^
      mm/cma.c:270:29: note: in expansion of macro 'max'
         (phys_addr_t)PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order));
                                   ^
      include/linux/kernel.h:748:17: warning: comparison of distinct pointer types lacks a cast
        (void) (&_max1 == &_max2);                   ^
      include/linux/kernel.h:747:21: note: in definition of macro 'max'
        typeof(y) _max2 = (y);                        ^
      mm/cma.c:270:29: note: in expansion of macro 'max'
         (phys_addr_t)PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order));
                                   ^
      
      [akpm@linux-foundation.org: coding-style fixes]
      Link: http://lkml.kernel.org/r/20160526150748.5be38a4f@canb.auug.org.auSigned-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      dec349c0
    • Arnd Bergmann's avatar
      arm64: build vdso without libgcov · d7aebee9
      Arnd Bergmann authored
      commit 54309784 upstream.
      
      On a cross-toolchain without glibc support, libgcov may not be
      available, and attempting to build an arm64 kernel with GCOV
      enabled then results in a build error:
      
      /home/arnd/cross-gcc/lib/gcc/aarch64-linux/5.2.1/../../../../aarch64-linux/bin/ld: cannot find -lgcov
      
      We don't really want to link libgcov into the vdso anyway, so
      this patch just disables GCOV in the vdso directory, just as
      we do for most other architectures.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d7aebee9
    • Arnd Bergmann's avatar
      mISDN: avoid arch specific __builtin_return_address call · 66ef39fe
      Arnd Bergmann authored
      commit 3e7a8716 upstream.
      
      Not all architectures are able to call __builtin_return_address().
      On ARM, the mISDN code produces this warning:
      
      hardware/mISDN/w6692.c: In function 'w6692_dctrl':
      hardware/mISDN/w6692.c:1181:75: warning: unsupported argument to '__builtin_return_address'
        pr_debug("%s: %s dev(%d) open from %p\n", card->name, __func__,
                                                                                 ^
      hardware/mISDN/mISDNipac.c: In function 'open_dchannel':
      hardware/mISDN/mISDNipac.c:759:75: warning: unsupported argument to '__builtin_return_address'
        pr_debug("%s: %s dev(%d) open from %p\n", isac->name, __func__,
                                                                                 ^
      
      In a lot of cases, this is relatively easy to work around by
      passing the value of __builtin_return_address(0) from the
      callers into the functions that want it. One exception is
      the indirect 'open' function call in struct isac_hw. While it
      would be possible to fix this as well, this patch only addresses
      the other callers properly and lets this one return the direct
      parent function, which should be good enough.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      66ef39fe
    • James Bottomley's avatar
      ips: remove pointless #warning · ce662da5
      James Bottomley authored
      commit e03c2da6 upstream.
      
      non-x86 builds want the #warning in the IPS code about compiling on the wrong
      architecture removed because it keeps triggering on their platforms build
      farms.  Transform from a compile time warning into a runtime one with taint to
      preserve the original intent of the authors.
      Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarJames Bottomley <JBottomley@Odin.com>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ce662da5
    • Arnd Bergmann's avatar
      infiniband: mlx5: avoid a compile-time warning · c4a1b5dd
      Arnd Bergmann authored
      commit 7835bfb5 upstream.
      
      The return type of find_first_bit() is architecture specific,
      on ARM it is 'unsigned int', while the asm-generic code used
      on x86 and a lot of other architectures returns 'unsigned long'.
      
      When building the mlx5 driver on ARM, we get a warning about
      this:
      
      infiniband/hw/mlx5/mem.c: In function 'mlx5_ib_cont_pages':
      infiniband/hw/mlx5/mem.c:84:143: warning: comparison of distinct pointer types lacks a cast
           m = min(m, find_first_bit(&tmp, sizeof(tmp)));
      
      This patch changes the driver to use min_t to make it behave
      the same way on all architectures.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Acked-by: default avatarEli Cohen <eli@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c4a1b5dd