12 Jan, 2017

5 commits

  • commit 7f847dd31736f1284538e54f46cf10e63929eb7f upstream.

    The slp_s0_residency_usec debugfs file currently uses
    DEFINE_DEBUGFS_ATTRIBUTE(), but that macro cannot really be used to
    define files outside of the debugfs code, as it has no reference to
    the get/set functions if CONFIG_DEBUG_FS is not defined:

    drivers/platform/x86/intel_pmc_core.c:80:12: error: ‘pmc_core_dev_state_get’ defined but not used [-Werror=unused-function]

    This fixes the macro to always contain the reference, and instead rely
    on the stubbed-out debugfs_create_file to not actually refer to
    its arguments so the compiler can still drop the reference.
    This works because the attribute definition is always 'static',
    and the dead-code removal silently drops all static symbols
    that are not used.

    Fixes: c64688081490 ("debugfs: add support for self-protecting attribute file fops")
    Fixes: df2294fb6428 ("intel_pmc_core: Convert to DEFINE_DEBUGFS_ATTRIBUTE")
    Signed-off-by: Arnd Bergmann
    [nicstange@gmail.com: Add dummy implementations of debugfs_attr_read() and
    debugfs_attr_write() in order to protect against possibly broken dead
    code elimination and to improve readability.
    Correct CONFIG_DEBUGFS_FS -> CONFIG_DEBUG_FS typo in changelog.]
    Signed-off-by: Nicolai Stange
    Reviewed-by: Andy Shevchenko
    Signed-off-by: Greg Kroah-Hartman
    Signed-off-by: Greg Kroah-Hartman

    Arnd Bergmann
     
  • commit 2fa436b3a2a7009c11a3bc03fe0ff4c26e80fd87 upstream.

    NL80211_ATTR_MAC was used to set both the specific BSSID to be scanned
    and the random MAC address to be used when privacy is enabled. When both
    the features are enabled, both the BSSID and the local MAC address were
    getting same value causing Probe Request frames to go with unintended
    DA. Hence, this has been fixed by using a different NL80211_ATTR_BSSID
    attribute to set the specific BSSID (which was the more recent addition
    in cfg80211) for a scan.

    Backwards compatibility with old userspace software is maintained to
    some extent by allowing NL80211_ATTR_MAC to be used to set the specific
    BSSID when scanning without enabling random MAC address use.

    Scanning with random source MAC address was introduced by commit
    ad2b26abc157 ("cfg80211: allow drivers to support random MAC addresses
    for scan") and the issue was introduced with the addition of the second
    user for the same attribute in commit 818965d39177 ("cfg80211: Allow a
    scan request for a specific BSSID").

    Fixes: 818965d39177 ("cfg80211: Allow a scan request for a specific BSSID")
    Signed-off-by: Vamsi Krishna
    Signed-off-by: Jouni Malinen
    Signed-off-by: Johannes Berg
    Signed-off-by: Greg Kroah-Hartman

    Vamsi Krishna
     
  • commit 65e4345c8ef8811bbb4860fe5f2df10646b7f2e1 upstream.

    The LIS3LV02 has a special bit that need to be set to get the
    read values left aligned. Before this patch we get gibberish
    like this:

    iio_generic_buffer -a -c10 -n lis3lv02dl_accel
    (...)
    0.000000 -0.010042 -0.642688 19155832931907
    0.000000 -0.010042 -0.642688 19155858751073

    Which is because we read a raw value for 1g as 64 which is
    the nominal 1024 for 1g shifted 4 bits to the left by being
    right-aligned rather than left aligned.

    Since all other sensors are left aligned, add some code to
    set the special DAS (data alignment setting) bit to 1 so that
    the right value is now read like this:

    iio_generic_buffer -a -c10 -n lis3lv02dl_accel
    (...)
    0.000000 -0.147095 -10.120135 24761614364956
    -0.029419 -0.176514 -10.120135 24761631624540

    The scaling was weird as well: we have a gain of 1000 for 1g
    and 3000 for 6g. I don't even remember how I came up with the
    old values but they are wrong.

    Fixes: 3acddf74f807 ("iio: st-sensors: add support for lis3lv02d accelerometer")
    Cc: Lorenzo Bianconi
    Cc: Giuseppe Barba
    Cc: Denis Ciocca
    Signed-off-by: Linus Walleij
    Signed-off-by: Jonathan Cameron
    Signed-off-by: Greg Kroah-Hartman

    Linus Walleij
     
  • commit 982555fc26f9d8bcdbd5f9db0378fe0682eb4188 upstream.

    For isoc endpoint descriptor, the wMaxPacketSize is not real max packet
    size (see Table 9-13. Standard Endpoint Descriptor, USB 2.0 specifcation),
    it may contain the number of packet, so the real max packet should be
    ep->desc->wMaxPacketSize && 0x7ff.

    Cc: Felipe F. Tonello
    Cc: Felipe Balbi
    Fixes: 16b114a6d797 ("usb: gadget: fix usb_ep_align_maybe
    endianness and new usb_ep_aligna")
    Signed-off-by: Peter Chen
    Signed-off-by: Felipe Balbi
    Signed-off-by: Greg Kroah-Hartman

    Peter Chen
     
  • commit c7858bf16c0b2cc62f475f31e6df28c3a68da1d6 upstream.

    The asm-prototypes.h file is used to provide dummy function declarations
    for genksyms, when processing asm files with EXPORT_SYMBOL. Make sure
    that any architecture defines get out of our way. x86 currently has an
    issue with memcpy on 64bit with CONFIG_KMEMCHECK=y and with
    memset/__memset on 32bit:

    $ cat init/test.c
    #include
    $ make -s init/test.o
    In file included from ./arch/x86/include/asm/string.h:4:0,
    from ./include/linux/string.h:18,
    from ./include/linux/bitmap.h:8,
    from ./include/linux/cpumask.h:11,
    from ./arch/x86/include/asm/cpumask.h:4,
    from ./arch/x86/include/asm/msr.h:10,
    from ./arch/x86/include/asm/processor.h:20,
    from ./arch/x86/include/asm/cpufeature.h:4,
    from ./arch/x86/include/asm/thread_info.h:52,
    from ./include/linux/thread_info.h:25,
    from ./arch/x86/include/asm/preempt.h:6,
    from ./include/linux/preempt.h:59,
    from ./include/linux/spinlock.h:50,
    from ./include/linux/seqlock.h:35,
    from ./include/linux/time.h:5,
    from ./include/uapi/linux/timex.h:56,
    from ./include/linux/timex.h:56,
    from ./include/linux/sched.h:19,
    from ./include/linux/uaccess.h:4,
    from ./arch/x86/include/asm/asm-prototypes.h:2,
    from init/test.c:1:
    ./arch/x86/include/asm/string_64.h:52:47: error: expected declaration specifiers or ‘...’ before ‘(’ token
    #define memcpy(dst, src, len) __inline_memcpy((dst), (src), (len))
    ./include/asm-generic/asm-prototypes.h:6:14: note: in expansion of macro ‘memcpy’
    extern void *memcpy(void *, const void *, __kernel_size_t);

    ^
    ...

    During real build, this manifests itself by genksyms segfaulting.

    Fixes: 334bb7738764 ("x86/kbuild: enable modversions for symbols exported from asm")
    Reported-and-tested-by: Borislav Petkov
    Cc: Adam Borowski
    Signed-off-by: Michal Marek
    Signed-off-by: Greg Kroah-Hartman

    Michal Marek
     

09 Jan, 2017

2 commits

  • commit fba332b079029c2f4f7e84c1c1cd8e3867310c90 upstream.

    Code that dereferences the struct net_device ip_ptr member must be
    protected with an in_dev_get() / in_dev_put() pair. Hence insert
    calls to these functions.

    Fixes: commit 7b85627b9f02 ("IB/cma: IBoE (RoCE) IP-based GID addressing")
    Signed-off-by: Bart Van Assche
    Reviewed-by: Moni Shoua
    Cc: Or Gerlitz
    Cc: Roland Dreier
    Signed-off-by: Doug Ledford
    Signed-off-by: Greg Kroah-Hartman

    Bart Van Assche
     
  • commit e6f462df9acd2a3295e5d34eb29e2823220cf129 upstream.

    When mac80211 abandons an association attempt, it may free
    all the data structures, but inform cfg80211 and userspace
    about it only by sending the deauth frame it received, in
    which case cfg80211 has no link to the BSS struct that was
    used and will not cfg80211_unhold_bss() it.

    Fix this by providing a way to inform cfg80211 of this with
    the BSS entry passed, so that it can clean up properly, and
    use this ability in the appropriate places in mac80211.

    This isn't ideal: some code is more or less duplicated and
    tracing is missing. However, it's a fairly small change and
    it's thus easier to backport - cleanups can come later.

    Signed-off-by: Johannes Berg
    Signed-off-by: Greg Kroah-Hartman

    Johannes Berg
     

06 Jan, 2017

7 commits

  • commit 334bb773876403eae3457d81be0b8ea70f8e4ccc upstream.

    Commit 4efca4ed ("kbuild: modversions for EXPORT_SYMBOL() for asm") adds
    modversion support for symbols exported from asm files. Architectures
    must include C-style declarations for those symbols in asm/asm-prototypes.h
    in order for them to be versioned.

    Add these declarations for x86, and an architecture-independent file that
    can be used for common symbols.

    With f27c2f6 reverting 8ab2ae6 ("default exported asm symbols to zero") we
    produce a scary warning on x86, this commit fixes that.

    Signed-off-by: Adam Borowski
    Tested-by: Kalle Valo
    Acked-by: Nicholas Piggin
    Tested-by: Peter Wu
    Tested-by: Oliver Hartkopp
    Signed-off-by: Michal Marek
    Signed-off-by: Greg Kroah-Hartman

    Adam Borowski
     
  • commit 91291d9ad92faa65a56a9a19d658d8049b78d3d4 upstream.

    Joonyoung Shim reported an interesting problem on his ARM octa-core
    Odoroid-XU3 platform. During system suspend, dev_pm_opp_put_regulator()
    was failing for a struct device for which dev_pm_opp_set_regulator() is
    called earlier.

    This happened because an earlier call to
    dev_pm_opp_of_cpumask_remove_table() function (from cpufreq-dt.c file)
    removed all the entries from opp_table->dev_list apart from the last CPU
    device in the cpumask of CPUs sharing the OPP.

    But both dev_pm_opp_set_regulator() and dev_pm_opp_put_regulator()
    routines get CPU device for the first CPU in the cpumask. And so the OPP
    core failed to find the OPP table for the struct device.

    This patch attempts to fix this problem by returning a pointer to the
    opp_table from dev_pm_opp_set_regulator() and using that as the
    parameter to dev_pm_opp_put_regulator(). This ensures that the
    dev_pm_opp_put_regulator() doesn't fail to find the opp table.

    Note that similar design problem also exists with other
    dev_pm_opp_put_*() APIs, but those aren't used currently by anyone and
    so we don't need to update them for now.

    Reported-by: Joonyoung Shim
    Signed-off-by: Stephen Boyd
    Signed-off-by: Viresh Kumar
    [ Viresh: Wrote commit log and tested on exynos 5250 ]
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Greg Kroah-Hartman

    Stephen Boyd
     
  • commit 84d77d3f06e7e8dea057d10e8ec77ad71f721be3 upstream.

    It is the reasonable expectation that if an executable file is not
    readable there will be no way for a user without special privileges to
    read the file. This is enforced in ptrace_attach but if ptrace
    is already attached before exec there is no enforcement for read-only
    executables.

    As the only way to read such an mm is through access_process_vm
    spin a variant called ptrace_access_vm that will fail if the
    target process is not being ptraced by the current process, or
    the current process did not have sufficient privileges when ptracing
    began to read the target processes mm.

    In the ptrace implementations replace access_process_vm by
    ptrace_access_vm. There remain several ptrace sites that still use
    access_process_vm as they are reading the target executables
    instructions (for kernel consumption) or register stacks. As such it
    does not appear necessary to add a permission check to those calls.

    This bug has always existed in Linux.

    Fixes: v1.0
    Reported-by: Andy Lutomirski
    Signed-off-by: "Eric W. Biederman"
    Signed-off-by: Greg Kroah-Hartman

    Eric W. Biederman
     
  • commit 64b875f7ac8a5d60a4e191479299e931ee949b67 upstream.

    When the flag PT_PTRACE_CAP was added the PTRACE_TRACEME path was
    overlooked. This can result in incorrect behavior when an application
    like strace traces an exec of a setuid executable.

    Further PT_PTRACE_CAP does not have enough information for making good
    security decisions as it does not report which user namespace the
    capability is in. This has already allowed one mistake through
    insufficient granulariy.

    I found this issue when I was testing another corner case of exec and
    discovered that I could not get strace to set PT_PTRACE_CAP even when
    running strace as root with a full set of caps.

    This change fixes the above issue with strace allowing stracing as
    root a setuid executable without disabling setuid. More fundamentaly
    this change allows what is allowable at all times, by using the correct
    information in it's decision.

    Fixes: 4214e42f96d4 ("v2.4.9.11 -> v2.4.9.12")
    Signed-off-by: "Eric W. Biederman"
    Signed-off-by: Greg Kroah-Hartman

    Eric W. Biederman
     
  • commit bfedb589252c01fa505ac9f6f2a3d5d68d707ef4 upstream.

    During exec dumpable is cleared if the file that is being executed is
    not readable by the user executing the file. A bug in
    ptrace_may_access allows reading the file if the executable happens to
    enter into a subordinate user namespace (aka clone(CLONE_NEWUSER),
    unshare(CLONE_NEWUSER), or setns(fd, CLONE_NEWUSER).

    This problem is fixed with only necessary userspace breakage by adding
    a user namespace owner to mm_struct, captured at the time of exec, so
    it is clear in which user namespace CAP_SYS_PTRACE must be present in
    to be able to safely give read permission to the executable.

    The function ptrace_may_access is modified to verify that the ptracer
    has CAP_SYS_ADMIN in task->mm->user_ns instead of task->cred->user_ns.
    This ensures that if the task changes it's cred into a subordinate
    user namespace it does not become ptraceable.

    The function ptrace_attach is modified to only set PT_PTRACE_CAP when
    CAP_SYS_PTRACE is held over task->mm->user_ns. The intent of
    PT_PTRACE_CAP is to be a flag to note that whatever permission changes
    the task might go through the tracer has sufficient permissions for
    it not to be an issue. task->cred->user_ns is always the same
    as or descendent of mm->user_ns. Which guarantees that having
    CAP_SYS_PTRACE over mm->user_ns is the worst case for the tasks
    credentials.

    To prevent regressions mm->dumpable and mm->user_ns are not considered
    when a task has no mm. As simply failing ptrace_may_attach causes
    regressions in privileged applications attempting to read things
    such as /proc//stat

    Acked-by: Kees Cook
    Tested-by: Cyrill Gorcunov
    Fixes: 8409cca70561 ("userns: allow ptrace from non-init user namespaces")
    Signed-off-by: "Eric W. Biederman"
    Signed-off-by: Greg Kroah-Hartman

    Eric W. Biederman
     
  • commit f84df2a6f268de584a201e8911384a2d244876e3 upstream.

    When the user namespace support was merged the need to prevent
    ptrace from revealing the contents of an unreadable executable
    was overlooked.

    Correct this oversight by ensuring that the executed file
    or files are in mm->user_ns, by adjusting mm->user_ns.

    Use the new function privileged_wrt_inode_uidgid to see if
    the executable is a member of the user namespace, and as such
    if having CAP_SYS_PTRACE in the user namespace should allow
    tracing the executable. If not update mm->user_ns to
    the parent user namespace until an appropriate parent is found.

    Reported-by: Jann Horn
    Fixes: 9e4a36ece652 ("userns: Fail exec for suid and sgid binaries with ids outside our user namespace.")
    Signed-off-by: "Eric W. Biederman"
    Signed-off-by: Greg Kroah-Hartman

    Eric W. Biederman
     
  • commit 777c6e0daebb3fcefbbd6f620410a946b07ef6d0 upstream.

    Yu Zhao has noticed that __unregister_cpu_notifier only unregisters its
    notifiers when HOTPLUG_CPU=y while the registration might succeed even
    when HOTPLUG_CPU=n if MODULE is enabled. This means that e.g. zswap
    might keep a stale notifier on the list on the manual clean up during
    the pool tear down and thus corrupt the list. Resulting in the following

    [ 144.964346] BUG: unable to handle kernel paging request at ffff880658a2be78
    [ 144.971337] IP: [] raw_notifier_chain_register+0x1b/0x40

    [ 145.122628] Call Trace:
    [ 145.125086] [] __register_cpu_notifier+0x18/0x20
    [ 145.131350] [] zswap_pool_create+0x273/0x400
    [ 145.137268] [] __zswap_param_set+0x1fc/0x300
    [ 145.143188] [] ? trace_hardirqs_on+0xd/0x10
    [ 145.149018] [] ? kernel_param_lock+0x28/0x30
    [ 145.154940] [] ? __might_fault+0x4f/0xa0
    [ 145.160511] [] zswap_compressor_param_set+0x17/0x20
    [ 145.167035] [] param_attr_store+0x5c/0xb0
    [ 145.172694] [] module_attr_store+0x1d/0x30
    [ 145.178443] [] sysfs_kf_write+0x4f/0x70
    [ 145.183925] [] kernfs_fop_write+0x149/0x180
    [ 145.189761] [] __vfs_write+0x18/0x40
    [ 145.194982] [] vfs_write+0xb2/0x1a0
    [ 145.200122] [] SyS_write+0x52/0xa0
    [ 145.205177] [] entry_SYSCALL_64_fastpath+0x12/0x17

    This can be even triggered manually by changing
    /sys/module/zswap/parameters/compressor multiple times.

    Fix this issue by making unregister APIs symmetric to the register so
    there are no surprises.

    Fixes: 47e627bc8c9a ("[PATCH] hotplug: Allow modules to use the cpu hotplug notifiers even if !CONFIG_HOTPLUG_CPU")
    Reported-and-tested-by: Yu Zhao
    Signed-off-by: Michal Hocko
    Cc: linux-mm@kvack.org
    Cc: Andrew Morton
    Cc: Dan Streetman
    Link: http://lkml.kernel.org/r/20161207135438.4310-1-mhocko@kernel.org
    Signed-off-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Michal Hocko
     

11 Dec, 2016

1 commit

  • Pull networking fixes from David Miller:

    1) Limit the number of can filters to avoid > MAX_ORDER allocations.
    Fix from Marc Kleine-Budde.

    2) Limit GSO max size in netvsc driver to avoid problems with NVGRE
    configurations. From Stephen Hemminger.

    3) Return proper error when memory allocation fails in
    ser_gigaset_init(), from Dan Carpenter.

    4) Missing linkage undo in error paths of ipvlan_link_new(), from Gao
    Feng.

    5) Missing necessayr SET_NETDEV_DEV in lantiq and cpmac drivers, from
    Florian Fainelli.

    6) Handle probe deferral properly in smsc911x driver.

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net:
    net: mlx5: Fix Kconfig help text
    net: smsc911x: back out silently on probe deferrals
    ibmveth: set correct gso_size and gso_type
    net: ethernet: cpmac: Call SET_NETDEV_DEV()
    net: ethernet: lantiq_etop: Call SET_NETDEV_DEV()
    vhost-vsock: fix orphan connection reset
    cxgb4/cxgb4vf: Assign netdev->dev_port with port ID
    driver: ipvlan: Unlink the upper dev when ipvlan_link_new failed
    ser_gigaset: return -ENOMEM on error instead of success
    NET: usb: cdc_mbim: add quirk for supporting Telit LE922A
    can: peak: fix bad memory access and free sequence
    phy: Don't increment MDIO bus refcount unless it's a different owner
    netvsc: reduce maximum GSO size
    drivers: net: cpsw-phy-sel: Clear RGMII_IDMODE on "rgmii" links
    can: raw: raw_setsockopt: limit number of can_filter that can be set

    Linus Torvalds
     

10 Dec, 2016

1 commit

  • Pull libnvdimm fixes from Dan Williams:
    "Several fixes to the DSM (ACPI device specific method) marshaling
    implementation.

    I consider these urgent enough to send for 4.9 consideration since
    they fix the kernel's handling of ARS (Address Range Scrub) commands.
    Especially for platforms without machine-check-recovery capabilities,
    successful execution of ARS commands enables the platform to
    potentially break out of an infinite reboot problem if a media error
    is present in the boot path. There is also a one line fix for a
    device-dax read-only mapping regression.

    Commits 9a901f5495e2 ("acpi, nfit: fix extended status translations
    for ACPI DSMs") and 325896ffdf90 ("device-dax: fix private mapping
    restriction, permit read-only") are true regression fixes for changes
    introduced this cycle.

    Commit efda1b5d87cb ("acpi, nfit, libnvdimm: fix / harden ars_status
    output length handling") fixes the kernel's handling of zero-length
    results, this never would have worked in the past, but we only just
    recently discovered a BIOS implementation that emits this arguably
    spec non-compliant result.

    The remaining two commits are additional fall out from thinking
    through the implications of a zero / truncated length result of the
    ARS Status command.

    In order to mitigate the risk that these changes introduce yet more
    regressions they are backstopped by a new unit test in commit
    a7de92dac9f0 ("tools/testing/nvdimm: unit test acpi_nfit_ctl()") that
    mocks up inputs to acpi_nfit_ctl()"

    * 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm:
    device-dax: fix private mapping restriction, permit read-only
    tools/testing/nvdimm: unit test acpi_nfit_ctl()
    acpi, nfit: fix bus vs dimm confusion in xlat_status
    acpi, nfit: validate ars_status output buffer size
    acpi, nfit, libnvdimm: fix / harden ars_status output length handling
    acpi, nfit: fix extended status translations for ACPI DSMs

    Linus Torvalds
     

09 Dec, 2016

1 commit

  • Telit LE922A MBIM based composition does not work properly
    with altsetting toggle done in cdc_ncm_bind_common.

    This patch adds CDC_MBIM_FLAG_AVOID_ALTSETTING_TOGGLE quirk
    to avoid this procedure that, instead, is mandatory for
    other modems.

    Signed-off-by: Daniele Palmas
    Reviewed-by: Bjørn Mork
    Signed-off-by: David S. Miller

    Daniele Palmas
     

08 Dec, 2016

1 commit

  • This reverts commit 8ab2ae655bfe384335c5b6b0d6041e0ddce26b00.

    I loved that commit because of how it explained what the problem with
    newer versions of binutils were, but the actual patch itself turns out
    to not work very well.

    It has two problems:

    - a zero CRC value isn't actually right. It happens to work for the
    case where both sides of the equation fail at giving the symbol a
    crc, but there are cases where the users of the exported symbol get
    the right crc (due to seeing the C declarations), but the actual
    exporting itself does not (due to the whole weak asm symbol issue).

    So then the module load fails after all - we did have a crc for the
    symbol, but we couldn't match it with the loaded module.

    - it seems that the alpha assembler has special semantics for the
    '.set' directive, and on alpha it doesn't actually set the value of
    the specified symbol at all, it is instead used to set various
    assembly modes (eg ".set noat" and ".set noreorder").

    So using ".set" to set the symbol value would just cause build
    failures on alpha.

    I'm sure we'll find some other workaround for these issues (hopefully
    that involves getting rid of modversions entirely some day, but people
    are also talking about just using smarter tools). But for now we'll
    just fall back on commit faaae2a58143 ("Re-enable CONFIG_MODVERSIONS in
    a slightly weaker form") that just let's a missing crc through.

    Reported-by: Jan Stancek
    Reported-by: Philip Müller
    Reported-by: Guenter Roeck
    Cc: Arnd Bergmann
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

07 Dec, 2016

3 commits

  • This patch adds a check to limit the number of can_filters that can be
    set via setsockopt on CAN_RAW sockets. Otherwise allocations > MAX_ORDER
    are not prevented resulting in a warning.

    Reference: https://lkml.org/lkml/2016/12/2/230

    Reported-by: Andrey Konovalov
    Tested-by: Andrey Konovalov
    Cc: linux-stable
    Signed-off-by: Marc Kleine-Budde

    Marc Kleine-Budde
     
  • Given ambiguities in the ACPI 6.1 definition of the "Output (Size)"
    field of the ARS (Address Range Scrub) Status command, a firmware
    implementation may in practice return 0, 4, or 8 to indicate that there
    is no output payload to process.

    The specification states "Size of Output Buffer in bytes, including this
    field.". However, 'Output Buffer' is also the name of the entire
    payload, and earlier in the specification it states "Max Query ARS
    Status Output Buffer Size: Maximum size of buffer (including the Status
    and Extended Status fields)".

    Without this fix if the BIOS happens to return 0 it causes memory
    corruption as evidenced by this result from the acpi_nfit_ctl() unit
    test.

    ars_status00000000: 00020000 00000000 ........
    BUG: stack guard page was hit at ffffc90001750000 (stack is ffffc9000174c000..ffffc9000174ffff)
    kernel stack overflow (page fault): 0000 [#1] SMP DEBUG_PAGEALLOC
    task: ffff8803332d2ec0 task.stack: ffffc9000174c000
    RIP: 0010:[] [] __memcpy+0x12/0x20
    RSP: 0018:ffffc9000174f9a8 EFLAGS: 00010246
    RAX: ffffc9000174fab8 RBX: 0000000000000000 RCX: 000000001fffff56
    RDX: 0000000000000000 RSI: ffff8803231f5a08 RDI: ffffc90001750000
    RBP: ffffc9000174fa88 R08: ffffc9000174fab0 R09: ffff8803231f54b8
    R10: 0000000000000008 R11: 0000000000000001 R12: 0000000000000000
    R13: 0000000000000000 R14: 0000000000000003 R15: ffff8803231f54a0
    FS: 00007f3a611af640(0000) GS:ffff88033ed00000(0000) knlGS:0000000000000000
    CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: ffffc90001750000 CR3: 0000000325b20000 CR4: 00000000000406e0
    Stack:
    ffffffffa00bc60d 0000000000000008 ffffc90000000001 ffffc9000174faac
    0000000000000292 ffffffffa00c24e4 ffffffffa00c2914 0000000000000000
    0000000000000000 ffffffff00000003 ffff880331ae8ad0 0000000800000246
    Call Trace:
    [] ? acpi_nfit_ctl+0x49d/0x750 [nfit]
    [] nfit_test_probe+0x670/0xb1b [nfit_test]

    Cc:
    Fixes: 747ffe11b440 ("libnvdimm, tools/testing/nvdimm: fix 'ars_status' output buffer sizing")
    Signed-off-by: Dan Williams

    Dan Williams
     
  • Pull networking fixes from David Miller:

    1) When dcbnl_cee_fill() fails to be able to push a new netlink
    attribute, it return 0 instead of an error code. From Pan Bian.

    2) Two suffix handling fixes to FIB trie code, from Alexander Duyck.

    3) bnxt_hwrm_stat_ctx_alloc() goes through all the trouble of setting
    and maintaining a return code 'rc' but fails to actually return it.
    Also from Pan Bian.

    4) ping socket ICMP handler needs to validate ICMP header length, from
    Kees Cook.

    5) caif_sktinit_module() has this interesting logic:

    int err = sock_register(...);
    if (!err)
    return err;
    return 0;

    Just return sock_register()'s return value directly which is the
    only possible correct thing to do.

    6) Two bnx2x driver fixes from Yuval Mintz, return a reasonable
    estimate from get_ringparam() ethtool op when interface is down and
    avoid trying to use UDP port based tunneling on 577xx chips.

    7) Fix ep93xx_eth crash on module unload from Florian Fainelli.

    8) Missing uapi exports, from Stephen Hemminger.

    9) Don't schedule work from sk_destruct(), because the socket will be
    freed upon return from that function. From Herbert Xu.

    10) Buggy drivers, of which we know there is at least one, can send a
    huge packet into the TCP stack but forget to set the gso_size in the
    SKB, which causes all kinds of problems.

    Correct this when it happens, and emit a one-time warning with the
    device name included so that it can be diagnosed more easily.

    From Marcelo Ricardo Leitner.

    11) virtio-net does DMA off the stack causes hiccups with VMAP_STACK,
    fix from Andy Lutomirski.

    12) Fix fec driver compilation with CONFIG_M5272, from Nikita
    Yushchenko.

    13) mlx5 fixes from Kamal Heib, Saeed Mahameed, and Mohamad Haj Yahia.
    (erroneously flushing queues on error, module parameter validation,
    etc)

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (34 commits)
    net/mlx5e: Change the SQ/RQ operational state to positive logic
    net/mlx5e: Don't flush SQ on error
    net/mlx5e: Don't notify HW when filling the edge of ICO SQ
    net/mlx5: Fix query ISSI flow
    net/mlx5: Remove duplicate pci dev name print
    net/mlx5: Verify module parameters
    net: fec: fix compile with CONFIG_M5272
    be2net: Add DEVSEC privilege to SET_HSW_CONFIG command.
    virtio-net: Fix DMA-from-the-stack in virtnet_set_mac_address()
    tcp: warn on bogus MSS and try to amend it
    uapi glibc compat: fix outer guard of net device flags enum
    net: stmmac: clear reset value of snps, wr_osr_lmt/snps, rd_osr_lmt before writing
    netlink: Do not schedule work from sk_destruct
    uapi: export nf_log.h
    uapi: export tc_skbmod.h
    net: ep93xx_eth: Do not crash unloading module
    bnx2x: Prevent tunnel config for 577xx
    bnx2x: Correct ringparam estimate when DOWN
    isdn: hisax: set error code on failure
    net: bnx2x: fix improper return value
    ...

    Linus Torvalds
     

06 Dec, 2016

4 commits

  • Fix a wrong condition preventing the higher net device flags
    IFF_LOWER_UP etc to be defined if net/if.h is included before
    linux/if.h.

    The comment makes it clear the intention was to allow partial
    definition with either parts.

    This fixes compilation of userspace programs trying to use
    IFF_LOWER_UP, IFF_DORMANT or IFF_ECHO.

    Fixes: 4a91cb61bb99 ("uapi glibc compat: fix compile errors when glibc net/if.h included before linux/if.h")
    Signed-off-by: Jonas Gorski
    Reviewed-by: Mikko Rapeli
    Signed-off-by: David S. Miller

    Jonas Gorski
     
  • File is in uapi directory but not being copied on
    make install_headers

    Fixes commit 4ec9c8fbbc22 ("netfilter: nft_log: complete
    NFTA_LOG_FLAGS attr support").

    Signed-off-by: Stephen Hemminger
    Signed-off-by: David S. Miller

    stephen hemminger
     
  • Fixes commit 735cffe5d800 ("net_sched: Introduce skbmod action")
    Not used by iproute2 but maybe in future.

    Signed-off-by: Stephen Hemminger
    Signed-off-by: David S. Miller

    stephen hemminger
     
  • Pull crypto fixes from Herbert Xu:
    "This fixes the following issues:

    - Intermittent build failure in RSA

    - Memory corruption in chelsio crypto driver

    - Regression in DRBG due to vmalloced stack"

    * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
    crypto: rsa - Add Makefile dependencies to fix parallel builds
    crypto: chcr - Fix memory corruption
    crypto: drbg - prevent invalid SG mappings

    Linus Torvalds
     

03 Dec, 2016

2 commits

  • Pull networking fixes from David Miller:

    1) Lots more phydev and probe error path leaks in various drivers by
    Johan Hovold.

    2) Fix race in packet_set_ring(), from Philip Pettersson.

    3) Use after free in dccp_invalid_packet(), from Eric Dumazet.

    4) Signnedness overflow in SO_{SND,RCV}BUFFORCE, also from Eric
    Dumazet.

    5) When tunneling between ipv4 and ipv6 we can be left with the wrong
    skb->protocol value as we enter the IPSEC engine and this causes all
    kinds of problems. Set it before the output path does any
    dst_output() calls, from Eli Cooper.

    6) bcmgenet uses wrong device struct pointer in DMA API calls, fix from
    Florian Fainelli.

    7) Various netfilter nat bug fixes from FLorian Westphal.

    8) Fix memory leak in ipvlan_link_new(), from Gao Feng.

    9) Locking fixes, particularly wrt. socket lookups, in l2tp from
    Guillaume Nault.

    10) Avoid invoking rhash teardowns in atomic context by moving netlink
    cb->done() dump completion from a worker thread. Fix from Herbert
    Xu.

    11) Buffer refcount problems in tun and macvtap on errors, from Jason
    Wang.

    12) We don't set Kconfig symbol DEFAULT_TCP_CONG properly when the user
    selects BBR. Fix from Julian Wollrath.

    13) Fix deadlock in transmit path on altera TSE driver, from Lino
    Sanfilippo.

    14) Fix unbalanced reference counting in dsa_switch_tree, from Nikita
    Yushchenko.

    15) tc_tunnel_key needs to be properly exported to userspace via uapi,
    fix from Roi Dayan.

    16) rds_tcp_init_net() doesn't unregister notifier in error path, fix
    from Sowmini Varadhan.

    17) Stale packet header pointer access after pskb_expand_head() in
    genenve driver, fix from Sabrina Dubroca.

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (103 commits)
    net: avoid signed overflows for SO_{SND|RCV}BUFFORCE
    geneve: avoid use-after-free of skb->data
    tipc: check minimum bearer MTU
    net: renesas: ravb: unintialized return value
    sh_eth: remove unchecked interrupts for RZ/A1
    net: bcmgenet: Utilize correct struct device for all DMA operations
    NET: usb: qmi_wwan: add support for Telit LE922A PID 0x1040
    cdc_ether: Fix handling connection notification
    ip6_offload: check segs for NULL in ipv6_gso_segment.
    RDS: TCP: unregister_netdevice_notifier() in error path of rds_tcp_init_net
    Revert: "ip6_tunnel: Update skb->protocol to ETH_P_IPV6 in ip6_tnl_xmit()"
    ipv6: Set skb->protocol properly for local output
    ipv4: Set skb->protocol properly for local output
    packet: fix race condition in packet_set_ring
    net: ethernet: altera: TSE: do not use tx queue lock in tx completion handler
    net: ethernet: altera: TSE: Remove unneeded dma sync for tx buffers
    net: ethernet: stmmac: fix of-node and fixed-link-phydev leaks
    net: ethernet: stmmac: platform: fix outdated function header
    net: ethernet: stmmac: dwmac-meson8b: fix probe error path
    net: ethernet: stmmac: dwmac-generic: fix probe error path
    ...

    Linus Torvalds
     
  • With binutils-2.26 and before, a weak missing symbol was kept during the
    final link, and a missing CRC for an export would lead to that CRC being
    treated as zero implicitly. With binutils-2.27, the crc symbol gets
    dropped, and any module trying to use it will fail to load.

    This sets the weak CRC symbol to zero explicitly, making it defined in
    vmlinux, which in turn lets us load the modules referring to that CRC.

    The comment above the __CRC_SYMBOL macro suggests that this was always
    the intention, although it also seems that all symbols defined in C have
    a correct CRC these days, and only the exports that are now done in
    assembly need this.

    Signed-off-by: Arnd Bergmann
    Tested-by: Adam Borowski
    Cc: stable@kernel.org
    Signed-off-by: Linus Torvalds

    Arnd Bergmann
     

02 Dec, 2016

3 commits

  • Pull PCI fixes from Bjorn Helgaas:
    "PCI fixes:

    - Fix Read Completion Boundary setting, which fixes a boot failure on
    IBM x3850 with Mellanox MT27500 ConnectX-3

    - Update some MAINTAINERS entries and email addresses"

    * tag 'pci-v4.9-fixes-4' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci:
    PCI: Set Read Completion Boundary to 128 iff Root Port supports it (_HPX)
    PCI: Export pcie_find_root_port
    PCI: designware-plat: Update author email
    PCI: designware: Change maintainer to Joao Pinto
    MAINTAINERS: Add devicetree binding to PCI i.MX6 entry
    MAINTAINERS: Update Richard Zhu's email address

    Linus Torvalds
     
  • Pull input fixes from Dmitry Torokhov: "We are disabling automatic
    probing of BYD touchpads as it results in too many false positives,
    and the hardware is not terribly popular and having the protocol
    support does not result in significantly improved user experience.

    We also change keycode for KEY_DATA to avoid clashing with
    KEY_FASTREVERSE. Luckily this newish code is used by CEC framework
    that is still in staging, so it is extremely unlikely that someone has
    already started using this keycode"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
    Input: change KEY_DATA from 0x275 to 0x277
    Input: psmouse - disable automatic probing of BYD touchpads

    Linus Torvalds
     
  • Pablo Neira Ayuso says:

    ====================
    Netfilter fixes for net

    This is a large batch of Netfilter fixes for net, they are:

    1) Three patches to fix NAT conversion to rhashtable: Switch to rhlist
    structure that allows to have several objects with the same key.
    Moreover, fix wrong comparison logic in nf_nat_bysource_cmp() as this is
    expecting a return value similar to memcmp(). Change location of
    the nat_bysource field in the nf_conn structure to avoid zeroing
    this as it breaks interaction with SLAB_DESTROY_BY_RCU and lead us
    to crashes. From Florian Westphal.

    2) Don't allow malformed fragments go through in IPv6, drop them,
    otherwise we hit GPF, patch from Florian Westphal.

    3) Fix crash if attributes are missing in nft_range, from Liping Zhang.

    4) Fix arptables 32-bits userspace 64-bits kernel compat, from Hongxu Jia.

    5) Two patches from David Ahern to fix netfilter interaction with vrf.
    From David Ahern.

    6) Fix element timeout calculation in nf_tables, we take milliseconds
    from userspace, but we use jiffies from kernelspace. Patch from
    Anders K. Pedersen.

    7) Missing validation length netlink attribute for nft_hash, from
    Laura Garcia.

    8) Fix nf_conntrack_helper documentation, we don't default to off
    anymore for a bit of time so let's get this in sync with the code.

    I know is late but I think these are important, specifically the NAT
    bits, as they are mostly addressing fallout from recent changes. I also
    read there are chances to have -rc8, if that is the case, that would
    also give us a bit more time to test this.
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     

01 Dec, 2016

4 commits

  • Hugetlb pages have ->index in size of the huge pages (PMD_SIZE or
    PUD_SIZE), not in PAGE_SIZE as other types of pages. This means we
    cannot user page_to_pgoff() to check whether we've got the right page
    for the radix-tree index.

    Let's introduce page_to_index() which would return radix-tree index for
    given page.

    We will be able to get rid of this once hugetlb will be switched to
    multi-order entries.

    Fixes: fc127da085c2 ("truncate: handle file thp")
    Link: http://lkml.kernel.org/r/20161123093053.mjbnvn5zwxw5e6lk@black.fi.intel.com
    Signed-off-by: Kirill A. Shutemov
    Reported-by: Doug Nelson
    Tested-by: Doug Nelson
    Reviewed-by: Naoya Horiguchi
    Cc: [4.8+]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Kirill A. Shutemov
     
  • kasan_global struct is part of compiler/runtime ABI. gcc revision
    241983 has added a new field to kasan_global struct. Update kernel
    definition of kasan_global struct to include the new field.

    Without this patch KASAN is broken with gcc 7.

    Link: http://lkml.kernel.org/r/1479219743-28682-1-git-send-email-dvyukov@google.com
    Signed-off-by: Dmitry Vyukov
    Acked-by: Andrey Ryabinin
    Cc: Alexander Potapenko
    Cc: [4.0+]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dmitry Vyukov
     
  • Socket flags aren't updated atomically, so the socket must be locked
    while reading the SOCK_ZAPPED flag.

    This issue exists for both l2tp_ip and l2tp_ip6. For IPv6, this patch
    also brings error handling for __ip6_datagram_connect() failures.

    Signed-off-by: Guillaume Nault
    Signed-off-by: David S. Miller

    Guillaume Nault
     
  • 0x275 is used by KEY_FASTREVERSE.

    Fixes: 488326947cd1 ("Input: add HDMI CEC specific keycodes")
    Signed-off-by: Ping Cheng
    Acked-by: Hans Verkuil
    Cc: stable@vger.kernel.org
    Signed-off-by: Dmitry Torokhov

    Ping Cheng
     

30 Nov, 2016

2 commits

  • When using SGs, only heap memory (memory that is valid as per
    virt_addr_valid) is allowed to be referenced. The CTR DRBG used to
    reference the caller-provided memory directly in an SG. In case the
    caller provided stack memory pointers, the SG mapping is not considered
    to be valid. In some cases, this would even cause a paging fault.

    The change adds a new scratch buffer that is used unconditionally to
    catch the cases where the caller-provided buffer is not suitable for
    use in an SG. The crypto operation of the CTR DRBG produces its output
    with that scratch buffer and finally copies the content of the
    scratch buffer to the caller's buffer.

    The scratch buffer is allocated during allocation time of the CTR DRBG
    as its access is protected with the DRBG mutex.

    Signed-off-by: Stephan Mueller
    Signed-off-by: Herbert Xu

    Stephan Mueller
     
  • Add helper to deregister fixed-link PHYs registered using
    of_phy_register_fixed_link().

    Convert the two drivers that care to deregister their fixed-link PHYs to
    use the new helper, but note that most drivers currently fail to do so.

    Signed-off-by: Johan Hovold
    Signed-off-by: David S. Miller

    Johan Hovold
     

29 Nov, 2016

2 commits

  • This reverts commit 9d76931180557270796f9631e2c79b9c7bb3c9fb.

    Using unregister_netdev at shutdown flow prevents calling
    the netdev's ndos or trying to access its freed resources.

    This fixes crashes like the following:
    Call Trace:
    [] dev_get_phys_port_id+0x1e/0x30
    [] rtnl_fill_ifinfo+0x4be/0xff0
    [] rtmsg_ifinfo_build_skb+0x73/0xe0
    [] rtmsg_ifinfo.part.27+0x16/0x50
    [] rtmsg_ifinfo+0x18/0x20
    [] netdev_state_change+0x46/0x50
    [] linkwatch_do_dev+0x38/0x50
    [] __linkwatch_run_queue+0xf5/0x170
    [] linkwatch_event+0x25/0x30
    [] process_one_work+0x152/0x400
    [] worker_thread+0x125/0x4b0
    [] ? rescuer_thread+0x350/0x350
    [] kthread+0xca/0xe0
    [] ? kthread_park+0x60/0x60
    [] ret_from_fork+0x25/0x30

    Fixes: 9d7693118055 ("net/mlx4_en: Avoid unregister_netdev at shutdown flow")
    Signed-off-by: Tariq Toukan
    Reported-by: Sebastian Ott
    Reported-by: Steve Wise
    Cc: Jiri Pirko
    Signed-off-by: David S. Miller

    Tariq Toukan
     
  • Export tc_tunnel_key so it can be used from user space.

    Signed-off-by: Roi Dayan
    Reviewed-by: Amir Vadai
    Signed-off-by: David S. Miller

    Roi Dayan
     

28 Nov, 2016

1 commit

  • Pull IOMMU fixes from David Woodhouse:
    "Two minor fixes.

    The first fixes the assignment of SR-IOV virtual functions to the
    correct IOMMU unit, and the second fixes the excessively large (and
    physically contiguous) PASID tables used with SVM"

    * git://git.infradead.org/intel-iommu:
    iommu/vt-d: Fix PASID table allocation
    iommu/vt-d: Fix IOMMU lookup for SR-IOV Virtual Functions

    Linus Torvalds
     

27 Nov, 2016

1 commit

  • Pull networking fixes from David Miller:

    1) Fix leak in fsl/fman driver, from Dan Carpenter.

    2) Call flow dissector initcall earlier than any networking driver can
    register and start to use it, from Eric Dumazet.

    3) Some dup header fixes from Geliang Tang.

    4) TIPC link monitoring compat fix from Jon Paul Maloy.

    5) Link changes require EEE re-negotiation in bcm_sf2 driver, from
    Florian Fainelli.

    6) Fix bogus handle ID passed into tfilter_notify_chain(), from Roman
    Mashak.

    7) Fix dump size calculation in rtnl_calcit(), from Zhang Shengju.

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (26 commits)
    tipc: resolve connection flow control compatibility problem
    mvpp2: use correct size for memset
    net/mlx5: drop duplicate header delay.h
    net: ieee802154: drop duplicate header delay.h
    ibmvnic: drop duplicate header seq_file.h
    fsl/fman: fix a leak in tgec_free()
    net: ethtool: don't require CAP_NET_ADMIN for ETHTOOL_GLINKSETTINGS
    tipc: improve sanity check for received domain records
    tipc: fix compatibility bug in link monitoring
    net: ethernet: mvneta: Remove IFF_UNICAST_FLT which is not implemented
    dwc_eth_qos: drop duplicate headers
    net sched filters: fix filter handle ID in tfilter_notify_chain()
    net: dsa: bcm_sf2: Ensure we re-negotiate EEE during after link change
    bnxt: do not busy-poll when link is down
    udplite: call proper backlog handlers
    ipv6: bump genid when the IFA_F_TENTATIVE flag is clear
    net/mlx4_en: Free netdev resources under state lock
    net: revert "net: l2tp: Treat NET_XMIT_CN as success in l2tp_eth_dev_xmit"
    rtnetlink: fix the wrong minimal dump size getting from rtnl_calcit()
    bnxt_en: Fix a VXLAN vs GENEVE issue
    ...

    Linus Torvalds