25 Nov, 2016

5 commits

  • We shouldn't free cert->pub->key in x509_cert_parse() because
    x509_free_certificate() also does this:
    BUG: Double free or freeing an invalid pointer
    ...
    Call Trace:
    [] dump_stack+0x63/0x83
    [] kasan_object_err+0x21/0x70
    [] kasan_report_double_free+0x49/0x60
    [] kasan_slab_free+0x9d/0xc0
    [] kfree+0x8a/0x1a0
    [] public_key_free+0x1f/0x30
    [] x509_free_certificate+0x24/0x90
    [] x509_cert_parse+0x2bc/0x300
    [] x509_key_preparse+0x3e/0x330
    [] asymmetric_key_preparse+0x6f/0x100
    [] key_create_or_update+0x260/0x5f0
    [] SyS_add_key+0x199/0x2a0
    [] entry_SYSCALL_64_fastpath+0x1e/0xad
    Object at ffff880110bd1900, in cache kmalloc-512 size: 512
    ....
    Freed:
    PID = 2579
    [] save_stack_trace+0x1b/0x20
    [] save_stack+0x46/0xd0
    [] kasan_slab_free+0x73/0xc0
    [] kfree+0x8a/0x1a0
    [] x509_cert_parse+0x2a3/0x300
    [] x509_key_preparse+0x3e/0x330
    [] asymmetric_key_preparse+0x6f/0x100
    [] key_create_or_update+0x260/0x5f0
    [] SyS_add_key+0x199/0x2a0
    [] entry_SYSCALL_64_fastpath+0x1e/0xad

    Fixes: db6c43bd2132 ("crypto: KEYS: convert public key and digsig asym to the akcipher api")
    Signed-off-by: Andrey Ryabinin
    Cc:
    Signed-off-by: David Howells
    Signed-off-by: James Morris

    Andrey Ryabinin
     
  • Pull MMC fixes from Ulf Hansson:
    "MMC host:

    - sdhci-of-esdhc: Fix card detection
    - dw_mmc: Fix DMA error path"

    * tag 'mmc-v4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc:
    mmc: dw_mmc: fix the error handling for dma operation
    mmc: sdhci-of-esdhc: fixup PRESENT_STATE read

    Linus Torvalds
     
  • Pull USB fixes from Greg KH:
    "Here are a few small USB fixes and new device ids for 4.9-rc7.

    The majority of these fixes are in the musb driver, fixing a number of
    regressions that have been reported but took a while to resolve. The
    other fixes are all small ones, to resolve other reported minor
    issues.

    All have been in linux-next for a while with no reported issues"

    * tag 'usb-4.9-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
    usb: gadget: f_fs: fix wrong parenthesis in ffs_func_req_match()
    phy: twl4030-usb: Fix for musb session bit based PM
    usb: musb: Drop pointless PM runtime code for dsps glue
    usb: musb: Add missing pm_runtime_disable and drop 2430 PM timeout
    usb: musb: Fix PM for hub disconnect
    usb: musb: Fix sleeping function called from invalid context for hdrc glue
    usb: musb: Fix broken use of static variable for multiple instances
    USB: serial: cp210x: add ID for the Zone DPMX
    usb: chipidea: move the lock initialization to core file
    Fix USB CB/CBI storage devices with CONFIG_VMAP_STACK=y
    USB: serial: ftdi_sio: add support for TI CC3200 LaunchPad

    Linus Torvalds
     
  • Pull HID fixes from Jiri Kosina:

    - DMA-on-stack fixes for a couple drivers, from Benjamin Tissoires

    - small memory sanitization fix for sensor-hub driver, from Song
    Hongyan

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid:
    HID: hid-sensor-hub: clear memory to avoid random data
    HID: rmi: make transfer buffers DMA capable
    HID: magicmouse: make transfer buffers DMA capable
    HID: lg: make transfer buffers DMA capable
    HID: cp2112: make transfer buffers DMA capable

    Linus Torvalds
     
  • Otherwise each individual rotator char would be printed in a new line:

    (...)
    [ 0.642350] -
    [ 0.644374] |
    [ 0.646367] -
    (...)

    Signed-off-by: Nicolas Schichan
    Signed-off-by: Linus Torvalds

    Nicolas Schichan
     

24 Nov, 2016

9 commits

  • Pull NFS client bugfixes from Anna Schumaker:
    "Most of these fix regressions or races, but there is one patch for
    stable that Arnd sent me

    Stable bugfix:
    - Hide array-bounds warning

    Bugfixes:
    - Keep a reference on lock states while checking
    - Handle NFS4ERR_OLD_STATEID in nfs4_reclaim_open_state
    - Don't call close if the open stateid has already been cleared
    - Fix CLOSE rases with OPEN
    - Fix a regression in DELEGRETURN"

    * tag 'nfs-for-4.9-4' of git://git.linux-nfs.org/projects/anna/linux-nfs:
    NFSv4.x: hide array-bounds warning
    NFSv4.1: Keep a reference on lock states while checking
    NFSv4.1: Handle NFS4ERR_OLD_STATEID in nfs4_reclaim_open_state
    NFSv4: Don't call close if the open stateid has already been cleared
    NFSv4: Fix CLOSE races with OPEN
    NFSv4.1: Fix a regression in DELEGRETURN

    Linus Torvalds
     
  • Pull arch/tile bugfix from Chris Metcalf:
    "This fixes a bug that causes reboots after 208 days of uptime :-)"

    * 'stable' of git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile:
    tile: avoid using clocksource_cyc2ns with absolute cycle count

    Linus Torvalds
     
  • For large values of "mult" and long uptimes, the intermediate
    result of "cycles * mult" can overflow 64 bits. For example,
    the tile platform calls clocksource_cyc2ns with a 1.2 GHz clock;
    we have mult = 853, and after 208.5 days, we overflow 64 bits.

    Since clocksource_cyc2ns() is intended to be used for relative
    cycle counts, not absolute cycle counts, performance is more
    importance than accepting a wider range of cycle values. So,
    just use mult_frac() directly in tile's sched_clock().

    Commit 4cecf6d401a0 ("sched, x86: Avoid unnecessary overflow
    in sched_clock") by Salman Qazi results in essentially the same
    generated code for x86 as this change does for tile. In fact,
    a follow-on change by Salman introduced mult_frac() and switched
    to using it, so the C code was largely identical at that point too.

    Peter Zijlstra then added mul_u64_u32_shr() and switched x86
    to use it. This is, in principle, better; by optimizing the
    64x64->64 multiplies to be 32x32->64 multiplies we can potentially
    save some time. However, the compiler piplines the 64x64->64
    multiplies pretty well, and the conditional branch in the generic
    mul_u64_u32_shr() causes some bubbles in execution, with the
    result that it's pretty much a wash. If tilegx provided its own
    implementation of mul_u64_u32_shr() without the conditional branch,
    we could potentially save 3 cycles, but that seems like small gain
    for a fair amount of additional build scaffolding; no other platform
    currently provides a mul_u64_u32_shr() override, and tile doesn't
    currently have an header to put the override in.

    Additionally, gcc currently has an optimization bug that prevents
    it from recognizing the opportunity to use a 32x32->64 multiply,
    and so the result would be no better than the existing mult_frac()
    until such time as the compiler is fixed.

    For now, just using mult_frac() seems like the right answer.

    Cc: stable@kernel.org [v3.4+]
    Signed-off-by: Chris Metcalf

    Chris Metcalf
     
  • When user tried to read some fields like hysteresis from IIO sysfs on some
    systems, it fails. The reason is that this field is a byte field and caller
    of sensor_hub_get_feature() passes a buffer of 4 bytes. Here the function
    sensor_hub_get_feature() copies the single byte from the report to the
    caller buffer and returns "1" as the number of bytes copied. So caller
    can use the return value.

    But this is done by multiple callers, so if we just change the
    sensor_hub_get_feature so that caller buffer is initialized with 0s
    then we don't to change all functions.

    Signed-off-by: Song Hongyan
    Acked-by: Jonathan Cameron
    Signed-off-by: Jiri Kosina

    Song Hongyan
     
  • Kernel v4.9 strictly enforces DMA capable buffers, so we need to remove
    buffers allocated on the stack.

    Signed-off-by: Benjamin Tissoires
    Signed-off-by: Jiri Kosina

    Benjamin Tissoires
     
  • Kernel v4.9 strictly enforces DMA capable buffers, so we need to remove
    buffers allocated on the stack.

    Signed-off-by: Benjamin Tissoires
    Signed-off-by: Jiri Kosina

    Benjamin Tissoires
     
  • Kernel v4.9 strictly enforces DMA capable buffers, so we need to remove
    buffers allocated on the stack.

    [jkosina@suse.cz: fix up second usage of hid_hw_raw_request(), spotted by
    0day build bot]
    Signed-off-by: Benjamin Tissoires
    Signed-off-by: Jiri Kosina

    Benjamin Tissoires
     
  • Kernel v4.9 strictly enforces DMA capable buffers, so we need to remove
    buffers allocated on the stack.

    Use a spinlock to prevent concurrent accesses to the buffer.

    Signed-off-by: Benjamin Tissoires
    Signed-off-by: Jiri Kosina

    Benjamin Tissoires
     
  • Pull perf fixes from Ingo Molnar:
    "Six fixes for bugs that were found via fuzzing, and a trivial
    hw-enablement patch for AMD Family-17h CPU PMUs"

    * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    perf/x86/intel/uncore: Allow only a single PMU/box within an events group
    perf/x86/intel: Cure bogus unwind from PEBS entries
    perf/x86: Restore TASK_SIZE check on frame pointer
    perf/core: Fix address filter parser
    perf/x86: Add perf support for AMD family-17h processors
    perf/x86/uncore: Fix crash by removing bogus event_list[] handling for SNB client uncore IMC
    perf/core: Do not set cpuctx->cgrp for unscheduled cgroups

    Linus Torvalds
     

23 Nov, 2016

7 commits

  • Pull crypto fixes from Herbert Xu:
    "The last push broke algif_hash for all shash implementations, so this
    is a follow-up to fix that.

    This also fixes a problem in the crypto scatterwalk that triggers a
    BUG_ON with certain debugging options due to the new vmalloced-stack
    code"

    * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
    crypto: scatterwalk - Remove unnecessary aliasing check in map_and_copy
    crypto: algif_hash - Fix result clobbering in recvmsg

    Linus Torvalds
     
  • Pull thermal management fix from Zhang Rui:
    "We only have one urgent fix this time.

    Commit 3105f234e0ab ("thermal/powerclamp: correct cpu support check"),
    which is shipped in 4.9-rc3, fixed a problem introduced by commit
    b721ca0d1927 ("thermal/powerclamp: remove cpu whitelist").

    But unfortunately, it broke intel_powerclamp driver module auto-
    loading at the same time. Thus we need this change to add back module
    auto-loading for 4.9"

    * 'for-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux:
    thermal/powerclamp: add back module device table

    Linus Torvalds
     
  • Pull SCSI fixes from James Bottomley:
    "Two small fixes.

    One prevents timeouts on mpt3sas when trying to use the secure erase
    protocol which causes the erase protocol to be aborted. The second is
    a regression in a prior fix which causes all commands to abort during
    PCI extended error recovery, which is incorrect because PCI EEH is
    independent from what's happening on the FC transport"

    * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
    scsi: qla2xxx: do not abort all commands in the adapter during EEH recovery
    scsi: mpt3sas: Fix secure erase premature termination

    Linus Torvalds
     
  • Pull clk fixes from Stephen Boyd:
    "A handful of driver fixes.

    The sunxi fixes are for an incorrect clk tree configuration and a bad
    frequency calculation. The other two are fixes for passing the wrong
    pointer in drivers recently converted to clk_hw style registration"

    * tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux:
    clk: efm32gg: Pass correct type to hw provider registration
    clk: berlin: Pass correct type to hw provider registration
    clk: sunxi: Fix M factor computation for APB1
    clk: sunxi-ng: sun6i-a31: Force AHB1 clock to use PLL6 as parent

    Linus Torvalds
     
  • A correct bugfix introduced a harmless warning that shows up with gcc-7:

    fs/nfs/callback.c: In function 'nfs_callback_up':
    fs/nfs/callback.c:214:14: error: array subscript is outside array bounds [-Werror=array-bounds]

    What happens here is that the 'minorversion == 0' check tells the
    compiler that we assume minorversion can be something other than 0,
    but when CONFIG_NFS_V4_1 is disabled that would be invalid and
    result in an out-of-bounds access.

    The added check for IS_ENABLED(CONFIG_NFS_V4_1) tells gcc that this
    really can't happen, which makes the code slightly smaller and also
    avoids the warning.

    The bugfix that introduced the warning is marked for stable backports,
    we want this one backported to the same releases.

    Fixes: 98b0f80c2396 ("NFSv4.x: Fix a refcount leak in nfs_callback_up_net")
    Cc: stable@vger.kernel.org # v3.7+
    Signed-off-by: Arnd Bergmann
    Signed-off-by: Anna Schumaker

    Arnd Bergmann
     
  • Pull scheduler fixes from Ingo Molnar:
    "Two fixes for autogroup scheduling, for races when turning the feature
    on/off via /proc/sys/kernel/sched_autogroup_enabled"

    * 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    sched/autogroup: Do not use autogroup->tg in zombie threads
    sched/autogroup: Fix autogroup_move_group() to never skip sched_move_task()

    Linus Torvalds
     
  • Pull x86 fixes from Ingo Molnar:
    "Misc fixes:
    - two fixes to make (very) old Intel CPUs boot reliably
    - fix the intel-mid driver and rename it
    - two KASAN false positive fixes
    - an FPU fix
    - two sysfb fixes
    - two build fixes related to new toolchain versions"

    * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    x86/platform/intel-mid: Rename platform_wdt to platform_mrfld_wdt
    x86/build: Build compressed x86 kernels as PIE when !CONFIG_RELOCATABLE as well
    x86/platform/intel-mid: Register watchdog device after SCU
    x86/fpu: Fix invalid FPU ptrace state after execve()
    x86/boot: Fail the boot if !M486 and CPUID is missing
    x86/traps: Ignore high word of regs->cs in early_fixup_exception()
    x86/dumpstack: Prevent KASAN false positive warnings
    x86/unwind: Prevent KASAN false positive warnings in guess unwinder
    x86/boot: Avoid warning for zero-filling .bss
    x86/sysfb: Fix lfb_size calculation
    x86/sysfb: Add support for 64bit EFI lfb_base

    Linus Torvalds
     

22 Nov, 2016

14 commits

  • Group validation expects all events to be of the same PMU; however
    is_uncore_pmu() is too wide, it matches _all_ uncore events, even
    across PMUs.

    This triggers failure when we group different events from different
    uncore PMUs, like:

    perf stat -vv -e '{uncore_cbox_0/config=0x0334/,uncore_qpi_0/event=1/}' -a sleep 1

    Fix is_uncore_pmu() by only matching events to the box at hand.

    Note that generic code; ran after this step; will disallow this
    mixture of PMU events.

    Reported-by: Jiri Olsa
    Tested-by: Jiri Olsa
    Signed-off-by: Peter Zijlstra (Intel)
    Cc: Alexander Shishkin
    Cc: Arnaldo Carvalho de Melo
    Cc: Kan Liang
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Thomas Gleixner
    Cc: Vince Weaver
    Cc: Vince Weaver
    Link: http://lkml.kernel.org/r/20161118125354.GQ3117@twins.programming.kicks-ass.net
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     
  • Vince Weaver reported that perf_fuzzer + KASAN detects that PEBS event
    unwinds sometimes do 'weird' things. In particular, we seemed to be
    ending up unwinding from random places on the NMI stack.

    While it was somewhat expected that the event record BP,SP would not
    match the interrupt BP,SP in that the interrupt is strictly later than
    the record event, it was overlooked that it could be on an already
    overwritten stack.

    Therefore, don't copy the recorded BP,SP over the interrupted BP,SP
    when we need stack unwinds.

    Note that its still possible the unwind doesn't full match the actual
    event, as its entirely possible to have done an (I)RET between record
    and interrupt, but on average it should still point in the general
    direction of where the event came from. Also, it's the best we can do,
    considering.

    The particular scenario that triggered the bogus NMI stack unwind was
    a PEBS event with very short period, upon enabling the event at the
    tail of the PMI handler (FREEZE_ON_PMI is not used), it instantly
    triggers a record (while still on the NMI stack) which in turn
    triggers the next PMI. This then causes back-to-back NMIs and we'll
    try and unwind the stack-frame from the last NMI, which obviously is
    now overwritten by our own.

    Analyzed-by: Josh Poimboeuf
    Reported-by: Vince Weaver
    Signed-off-by: Peter Zijlstra (Intel)
    Cc: Alexander Shishkin
    Cc: Arnaldo Carvalho de Melo
    Cc: Arnaldo Carvalho de Melo
    Cc: Jiri Olsa
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Stephane Eranian
    Cc: Thomas Gleixner
    Cc: davej@codemonkey.org.uk
    Cc: dvyukov@google.com
    Cc: stable@vger.kernel.org
    Fixes: ca037701a025 ("perf, x86: Add PEBS infrastructure")
    Link: http://lkml.kernel.org/r/20161117171731.GV3157@twins.programming.kicks-ass.net
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     
  • The following commit:

    75925e1ad7f5 ("perf/x86: Optimize stack walk user accesses")

    ... switched from copy_from_user_nmi() to __copy_from_user_nmi() with a manual
    access_ok() check.

    Unfortunately, copy_from_user_nmi() does an explicit check against TASK_SIZE,
    whereas the access_ok() uses whatever the current address limit of the task is.

    We are getting NMIs when __probe_kernel_read() has switched to KERNEL_DS, and
    then see vmalloc faults when we access what looks like pointers into vmalloc
    space:

    [] WARNING: CPU: 3 PID: 3685731 at arch/x86/mm/fault.c:435 vmalloc_fault+0x289/0x290
    [] CPU: 3 PID: 3685731 Comm: sh Tainted: G W 4.6.0-5_fbk1_223_gdbf0f40 #1
    [] Call Trace:
    [] [] dump_stack+0x4d/0x6c
    [] [] __warn+0xd3/0xf0
    [] [] warn_slowpath_null+0x1d/0x20
    [] [] vmalloc_fault+0x289/0x290
    [] [] __do_page_fault+0x330/0x490
    [] [] do_page_fault+0xc/0x10
    [] [] page_fault+0x22/0x30
    [] [] ? perf_callchain_user+0x100/0x2a0
    [] [] get_perf_callchain+0x17f/0x190
    [] [] perf_callchain+0x67/0x80
    [] [] perf_prepare_sample+0x2a0/0x370
    [] [] perf_event_output+0x20/0x60
    [] [] ? perf_event_update_userpage+0xc7/0x130
    [] [] __perf_event_overflow+0x181/0x1d0
    [] [] perf_event_overflow+0x14/0x20
    [] [] intel_pmu_handle_irq+0x1d3/0x490
    [] [] ? copy_user_enhanced_fast_string+0x7/0x10
    [] [] ? vunmap_page_range+0x1a1/0x2f0
    [] [] ? unmap_kernel_range_noflush+0x11/0x20
    [] [] ? ghes_copy_tofrom_phys+0x116/0x1f0
    [] [] ? x2apic_send_IPI_self+0x1d/0x20
    [] [] perf_event_nmi_handler+0x2d/0x50
    [] [] nmi_handle+0x61/0x110
    [] [] default_do_nmi+0x44/0x110
    [] [] do_nmi+0xdb/0x150
    [] [] end_repeat_nmi+0x1a/0x1e
    [] [] ? copy_user_enhanced_fast_string+0x7/0x10
    [] [] ? copy_user_enhanced_fast_string+0x7/0x10
    [] [] ? copy_user_enhanced_fast_string+0x7/0x10
    [] <> [] ? __probe_kernel_read+0x3e/0xa0

    Fix this by moving the valid_user_frame() check to before the uaccess
    that loads the return address and the pointer to the next frame.

    Signed-off-by: Johannes Weiner
    Signed-off-by: Peter Zijlstra (Intel)
    Cc: Alexander Shishkin
    Cc: Arnaldo Carvalho de Melo
    Cc: Jiri Olsa
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Thomas Gleixner
    Cc: Vince Weaver
    Cc: linux-kernel@vger.kernel.org
    Fixes: 75925e1ad7f5 ("perf/x86: Optimize stack walk user accesses")
    Signed-off-by: Ingo Molnar

    Johannes Weiner
     
  • Exactly because for_each_thread() in autogroup_move_group() can't see it
    and update its ->sched_task_group before _put() and possibly free().

    So the exiting task needs another sched_move_task() before exit_notify()
    and we need to re-introduce the PF_EXITING (or similar) check removed by
    the previous change for another reason.

    Signed-off-by: Oleg Nesterov
    Signed-off-by: Peter Zijlstra (Intel)
    Cc: Linus Torvalds
    Cc: Mike Galbraith
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: hartsjc@redhat.com
    Cc: vbendel@redhat.com
    Cc: vlovejoy@redhat.com
    Link: http://lkml.kernel.org/r/20161114184612.GA15968@redhat.com
    Signed-off-by: Ingo Molnar

    Oleg Nesterov
     
  • The PF_EXITING check in task_wants_autogroup() is no longer needed. Remove
    it, but see the next patch.

    However the comment is correct in that autogroup_move_group() must always
    change task_group() for every thread so the sysctl_ check is very wrong;
    we can race with cgroups and even sys_setsid() is not safe because a task
    running with task_group() == ag->tg must participate in refcounting:

    int main(void)
    {
    int sctl = open("/proc/sys/kernel/sched_autogroup_enabled", O_WRONLY);

    assert(sctl > 0);
    if (fork()) {
    wait(NULL); // destroy the child's ag/tg
    pause();
    }

    assert(pwrite(sctl, "1\n", 2, 0) == 2);
    assert(setsid() > 0);
    if (fork())
    pause();

    kill(getppid(), SIGKILL);
    sleep(1);

    // The child has gone, the grandchild runs with kref == 1
    assert(pwrite(sctl, "0\n", 2, 0) == 2);
    assert(setsid() > 0);

    // runs with the freed ag/tg
    for (;;)
    sleep(1);

    return 0;
    }

    crashes the kernel. It doesn't really need sleep(1), it doesn't matter if
    autogroup_move_group() actually frees the task_group or this happens later.

    Reported-by: Vern Lovejoy
    Signed-off-by: Oleg Nesterov
    Signed-off-by: Peter Zijlstra (Intel)
    Cc: Linus Torvalds
    Cc: Mike Galbraith
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: hartsjc@redhat.com
    Cc: vbendel@redhat.com
    Link: http://lkml.kernel.org/r/20161114184609.GA15965@redhat.com
    Signed-off-by: Ingo Molnar

    Oleg Nesterov
     
  • The aliasing check in map_and_copy is no longer necessary because
    the IPsec ESP code no longer provides an IV that points into the
    actual request data. As this check is now triggering BUG checks
    due to the vmalloced stack code, I'm removing it.

    Reported-by: Eric Biggers
    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • Recently an init call was added to hash_recvmsg so as to reset
    the hash state in case a sendmsg call was never made.

    Unfortunately this ended up clobbering the result if the previous
    sendmsg was done with a MSG_MORE flag. This patch fixes it by
    excluding that case when we make the init call.

    Fixes: a8348bca2944 ("algif_hash - Fix NULL hash crash with shash")
    Reported-by: Patrick Steinhardt
    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • Pull apparmor bugfix from James Morris:
    "This has a fix for a policy replacement bug that is fairly serious for
    apache mod_apparmor users, as it results in the wrong policy being
    applied on an network facing service"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security:
    apparmor: fix change_hat not finding hat after policy replacement

    Linus Torvalds
     
  • Pull sparc fixes from David Miller:

    1) With modern networking cards we can run out of 32-bit DMA space, so
    support 64-bit DMA addressing when possible on sparc64. From Dave
    Tushar.

    2) Some signal frame validation checks are inverted on sparc32, fix
    from Andreas Larsson.

    3) Lockdep tables can get too large in some circumstances on sparc64,
    add a way to adjust the size a bit. From Babu Moger.

    4) Fix NUMA node probing on some sun4v systems, from Thomas Tai.

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc:
    sparc: drop duplicate header scatterlist.h
    lockdep: Limit static allocations if PROVE_LOCKING_SMALL is defined
    config: Adding the new config parameter CONFIG_PROVE_LOCKING_SMALL for sparc
    sunbmac: Fix compiler warning
    sunqe: Fix compiler warnings
    sparc64: Enable 64-bit DMA
    sparc64: Enable sun4v dma ops to use IOMMU v2 APIs
    sparc64: Bind PCIe devices to use IOMMU v2 service
    sparc64: Initialize iommu_map_table and iommu_pool
    sparc64: Add ATU (new IOMMU) support
    sparc64: Add FORCE_MAX_ZONEORDER and default to 13
    sparc64: fix compile warning section mismatch in find_node()
    sparc32: Fix inverted invalid_frame_pointer checks on sigreturns
    sparc64: Fix find_node warning if numa node cannot be found

    Linus Torvalds
     
  • Pull networking fixes from David Miller:

    1) Clear congestion control state when changing algorithms on an
    existing socket, from Florian Westphal.

    2) Fix register bit values in altr_tse_pcs portion of stmmac driver,
    from Jia Jie Ho.

    3) Fix PTP handling in stammc driver for GMAC4, from Giuseppe
    CAVALLARO.

    4) Fix udplite multicast delivery handling, it ignores the udp_table
    parameter passed into the lookups, from Pablo Neira Ayuso.

    5) Synchronize the space estimated by rtnl_vfinfo_size and the space
    actually used by rtnl_fill_vfinfo. From Sabrina Dubroca.

    6) Fix memory leak in fib_info when splitting nodes, from Alexander
    Duyck.

    7) If a driver does a napi_hash_del() explicitily and not via
    netif_napi_del(), it must perform RCU synchronization as needed. Fix
    this in virtio-net and bnxt drivers, from Eric Dumazet.

    8) Likewise, it is not necessary to invoke napi_hash_del() is we are
    also doing neif_napi_del() in the same code path. Remove such calls
    from be2net and cxgb4 drivers, also from Eric Dumazet.

    9) Don't allocate an ID in peernet2id_alloc() if the netns is dead,
    from WANG Cong.

    10) Fix OF node and device struct leaks in of_mdio, from Johan Hovold.

    11) We cannot cache routes in ip6_tunnel when using inherited traffic
    classes, from Paolo Abeni.

    12) Fix several crashes and leaks in cpsw driver, from Johan Hovold.

    13) Splice operations cannot use freezable blocking calls in AF_UNIX,
    from WANG Cong.

    14) Link dump filtering by master device and kind support added an error
    in loop index updates during the dump if we actually do filter, fix
    from Zhang Shengju.

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (59 commits)
    tcp: zero ca_priv area when switching cc algorithms
    net: l2tp: Treat NET_XMIT_CN as success in l2tp_eth_dev_xmit
    ethernet: stmmac: make DWMAC_STM32 depend on it's associated SoC
    tipc: eliminate obsolete socket locking policy description
    rtnl: fix the loop index update error in rtnl_dump_ifinfo()
    l2tp: fix racy SOCK_ZAPPED flag check in l2tp_ip{,6}_bind()
    net: macb: add check for dma mapping error in start_xmit()
    rtnetlink: fix FDB size computation
    netns: fix get_net_ns_by_fd(int pid) typo
    af_unix: conditionally use freezable blocking calls in read
    net: ethernet: ti: cpsw: fix fixed-link phy probe deferral
    net: ethernet: ti: cpsw: add missing sanity check
    net: ethernet: ti: cpsw: fix secondary-emac probe error path
    net: ethernet: ti: cpsw: fix of_node and phydev leaks
    net: ethernet: ti: cpsw: fix deferred probe
    net: ethernet: ti: cpsw: fix mdio device reference leak
    net: ethernet: ti: cpsw: fix bad register access in probe error path
    net: sky2: Fix shutdown crash
    cfg80211: limit scan results cache size
    net sched filters: pass netlink message flags in event notification
    ...

    Linus Torvalds
     
  • We need to zero out the private data area when application switches
    connection to different algorithm (TCP_CONGESTION setsockopt).

    When congestion ops get assigned at connect time everything is already
    zeroed because sk_alloc uses GFP_ZERO flag. But in the setsockopt case
    this contains whatever previous cc placed there.

    Signed-off-by: Florian Westphal
    Signed-off-by: David S. Miller

    Florian Westphal
     
  • The tc could return NET_XMIT_CN as one congestion notification, but
    it does not mean the packe is lost. Other modules like ipvlan,
    macvlan, and others treat NET_XMIT_CN as success too.
    So l2tp_eth_dev_xmit should add the NET_XMIT_CN check.

    Signed-off-by: Gao Feng
    Signed-off-by: David S. Miller

    Gao Feng
     
  • While walking the list of lock_states, keep a reference on each
    nfs4_lock_state to be checked, otherwise the lock state could be removed
    while the check performs TEST_STATEID and possible FREE_STATEID.

    Signed-off-by: Benjamin Coddington
    Signed-off-by: Anna Schumaker

    Benjamin Coddington
     
  • There's not much point, except compile test, enabling the stmmac
    platform drivers unless the STM32 SoC is enabled. It's not
    useful without it.

    Signed-off-by: Peter Robinson
    Signed-off-by: David S. Miller

    Peter Robinson
     

21 Nov, 2016

5 commits

  • Commit 3105f234e0aba43e44e277c20f9b32ee8add43d4 replaced module
    cpu id table with a cpu feature check, which is logically correct.
    But we need the module device table to allow module auto loading.

    Cc: stable@vger.kernel.org # 4.8
    Fixes:3105f234 thermal/powerclamp: correct cpu support check
    Signed-off-by: Jacob Pan
    Signed-off-by: Zhang Rui

    Jacob Pan
     
  • The token table passed into match_token() must be null-terminated, which
    it currently is not in the perf's address filter string parser, as caught
    by Vince's perf_fuzzer and KASAN.

    It doesn't blow up otherwise because of the alignment padding of the table
    to the next element in the .rodata, which is luck.

    Fixing by adding a null-terminator to the token table.

    Reported-by: Vince Weaver
    Tested-by: Vince Weaver
    Signed-off-by: Alexander Shishkin
    Acked-by: Peter Zijlstra (Intel)
    Cc: Arnaldo Carvalho de Melo
    Cc: Linus Torvalds
    Cc: Thomas Gleixner
    Cc: dvyukov@google.com
    Cc: stable@vger.kernel.org # v4.7+
    Fixes: 375637bc524 ("perf/core: Introduce address range filtering")
    Link: http://lkml.kernel.org/r/877f81f264.fsf@ashishki-desk.ger.corp.intel.com
    Signed-off-by: Ingo Molnar

    Alexander Shishkin
     
  • When dma->start is failed,then it has to fall back to PIO mode
    for current transfer.

    But Host controller was already set to bits relevant to DMA operation.
    If needs to use the PIO mode, Host controller has to stop the DMA
    operation. (It's more stable than now.)

    When it occurred error, it's not running any request.

    Fixes: 3fc7eaef44db ("mmc: dw_mmc: Add external dma interface support")
    Reported-by: Marek Szyprowski
    Signed-off-by: Jaehoon Chung
    Reviewed-by: Shawn Lin
    Cc: # v4.3+
    Signed-off-by: Jaehoon Chung
    Signed-off-by: Ulf Hansson

    Jaehoon Chung
     
  • Rename the watchdog platform library file to explicitly show that is used only
    on Intel Merrifield platforms.

    Signed-off-by: Andy Shevchenko
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Link: http://lkml.kernel.org/r/20161118172723.179761-1-andriy.shevchenko@linux.intel.com
    Signed-off-by: Ingo Molnar

    Andy Shevchenko
     
  • Since the bootloader may load the compressed x86 kernel at any address,
    it should always be built as PIE, not just when CONFIG_RELOCATABLE=y.

    Otherwise, linker in binutils 2.27 will optimize GOT load into the
    absolute address when building the compressed x86 kernel as a non-PIE
    executable.

    Signed-off-by: H.J. Lu
    Cc: Andy Lutomirski
    Cc: Borislav Petkov
    Cc: Brian Gerst
    Cc: Denys Vlasenko
    Cc: H. Peter Anvin
    Cc: Josh Poimboeuf
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: linux-kernel@vger.kernel.org
    [ Small wording changes. ]
    Signed-off-by: Ingo Molnar

    H.J. Lu