25 Feb, 2018

40 commits

  • [ Upstream commit 58d0d19a204604ca0da26058828a53558b265da3 ]

    Since it is perfectly legal to run the kernel at EL1, it is not
    actually an error if HYP mode is not available when attempting to
    initialize KVM, given that KVM support cannot be built as a module.
    So demote the kvm_err() to kvm_info(), which prevents the error from
    appearing on an otherwise 'quiet' console.

    Acked-by: Marc Zyngier
    Acked-by: Christoffer Dall
    Signed-off-by: Ard Biesheuvel
    Signed-off-by: Christoffer Dall
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Ard Biesheuvel
     
  • [ Upstream commit 4bd6683da2e64590bdc27ecf7e61ad8376861768 ]

    UART2 RTS is mode 2 of the pin.

    Signed-off-by: Andy Shevchenko
    Acked-by: Mika Westerberg
    Signed-off-by: Linus Walleij
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Andy Shevchenko
     
  • [ Upstream commit 996548499df61babae5306544c7daf5fd39db31c ]

    Test case 21 (Number of exit events of a simple workload) fails on
    s390x. The reason is the invalid sample frequency supplied for this
    test. On s390x the minimum sample frequency is much higher (see output
    of /proc/service_levels).

    Supply a save sample frequency value for s390x to fix this. The value
    will be adjusted by the s390x CPUMF frequency convertion function to a
    value well below the sysctl kernel.perf_event_max_sample_rate value.

    Signed-off-by: Thomas Richter
    Reviewed-by: Hendrik Brueckner
    Cc: Martin Schwidefsky
    LPU-Reference: 20171123114611.93397-1-tmricht@linux.vnet.ibm.com
    Link: https://lkml.kernel.org/n/tip-1ynblyhi1n81idpido59nt1y@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Thomas Richter
     
  • [ Upstream commit 321a7c35c90cc834851ceda18a8ee18f1d032b92 ]

    Certain systems are designed to have sparse/discontiguous nodes. On
    such systems, 'perf bench numa' hangs, shows wrong number of nodes and
    shows values for non-existent nodes. Handle this by only taking nodes
    that are exposed by kernel to userspace.

    Signed-off-by: Satheesh Rajendran
    Reviewed-by: Srikar Dronamraju
    Acked-by: Naveen N. Rao
    Link: http://lkml.kernel.org/r/1edbcd353c009e109e93d78f2f46381930c340fe.1511368645.git.sathnaga@linux.vnet.ibm.com
    Signed-off-by: Balamuruhan S
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Satheesh Rajendran
     
  • [ Upstream commit 89d0aeab4252adc2a7ea693637dd21c588bfa2d1 ]

    The stdio perf top crashes when we change the terminal
    window size. The reason is that we assumed we get the
    perf_top pointer as a signal handler argument which is
    not the case.

    Changing the SIGWINCH handler logic to change global
    resize variable, which is checked in the main thread
    loop.

    Signed-off-by: Jiri Olsa
    Tested-by: Arnaldo Carvalho de Melo
    Tested-by: Ravi Bangoria
    Cc: Adrian Hunter
    Cc: Andi Kleen
    Cc: David Ahern
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-ysuzwz77oev1ftgvdscn9bpu@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Jiri Olsa
     
  • [ Upstream commit 34900ec5c9577cc1b0f22887ac7349f458ba8ac2 ]

    Reset header size for namespace events, otherwise it only gets bigger in
    ctx iterations.

    Signed-off-by: Jiri Olsa
    Acked-by: Peter Zijlstra (Intel)
    Fixes: e422267322cd ("perf: Add PERF_RECORD_NAMESPACES to include namespaces related info")
    Link: http://lkml.kernel.org/n/tip-nlo4gonz9d4guyb8153ukzt0@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Jiri Olsa
     
  • [ Upstream commit ccafc38f1c778847ab6d53dd7933260426731cf3 ]

    This 'perf test' case fails on s390x. The 'touch' command on s390x uses
    the 'openat' system call to open the file named on the command line:

    [root@s35lp76 perf]# perf probe -l
    probe:vfs_getname (on getname_flags:72@fs/namei.c with pathname)
    [root@s35lp76 perf]# perf trace -e open touch /tmp/abc
    0.400 ( 0.015 ms): touch/27542 open(filename:
    /usr/lib/locale/locale-archive, flags: CLOEXEC) = 3
    [root@s35lp76 perf]#

    There is no 'open' system call for file '/tmp/abc'. Instead the 'openat'
    system call is used:

    [root@s35lp76 perf]# strace touch /tmp/abc
    execve("/usr/bin/touch", ["touch", "/tmp/abc"], 0x3ffd547ec98
    /* 30 vars */) = 0
    [...]
    openat(AT_FDCWD, "/tmp/abc", O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK, 0666) = 3
    [...]

    On s390x the 'egrep' command does not find a matching pattern and
    returns an error.

    Fix this for s390x create a platform dependent command line to enable
    the 'perf probe' call to listen to the 'openat' system call and get the
    expected output.

    Signed-off-by: Thomas-Mich Richter
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Hendrik Brueckner
    Cc: Thomas-Mich Richter
    LPU-Reference: 20171114071847.2381-1-tmricht@linux.vnet.ibm.com
    Link: http://lkml.kernel.org/n/tip-3qf38jk0prz54rhmhyu871my@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Thomas Richter
     
  • [ Upstream commit 05d0e62d9fa0f1002cf82009ef31b36174da5472 ]

    There are many instructions, esp on PowerPC, whose mnemonics are longer
    than 6 characters. Using precision limit causes truncation of such
    mnemonics.

    Fix this by removing precision limit. Note that, 'width' is still 6, so
    alignment won't get affected for length
    Signed-off-by: Ravi Bangoria
    Cc: Alexander Shishkin
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Taeung Song
    Link: http://lkml.kernel.org/r/20171114032540.4564-1-ravi.bangoria@linux.vnet.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Ravi Bangoria
     
  • [ Upstream commit af98f2273fd0af31ce327cd1406b67c7be0b6734 ]

    The commit 8e99b6d4533c changed prefixcmp() to strstart() but missed to
    change the return value in some place. It makes perf help print
    annoying output even for sane config items like below:

    $ perf help
    '.root': unsupported man viewer sub key.
    ...

    Reported-by: Arnaldo Carvalho de Melo
    Signed-off-by: Namhyung Kim
    Tested-by: Arnaldo Carvalho de Melo
    Tested-by: Taeung Song
    Cc: Jiri Olsa
    Cc: Sihyeon Jang
    Cc: kernel-team@lge.com
    Link: http://lkml.kernel.org/r/20171114001542.GA16464@sejong
    Fixes: 8e99b6d4533c ("tools include: Adopt strstarts() from the kernel")
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Namhyung Kim
     
  • [ Upstream commit 59622fd496a3175c7bf549046e091d81c303ecff ]

    The Intel PMU event aliases have a implicit period= specifier to set the
    default period.

    Unfortunately this breaks overriding these periods with -c or -F,
    because the alias terms look like they are user specified to the
    internal parser, and user specified event qualifiers override the
    command line options.

    Track that they are coming from aliases by adding a "weak" state to the
    term. Any weak terms don't override command line options.

    I only did it for -c/-F for now, I think that's the only case that's
    broken currently.

    Before:

    $ perf record -c 1000 -vv -e uops_issued.any
    ...
    { sample_period, sample_freq } 2000003

    After:

    $ perf record -c 1000 -vv -e uops_issued.any
    ...
    { sample_period, sample_freq } 1000

    Signed-off-by: Andi Kleen
    Acked-by: Jiri Olsa
    Link: http://lkml.kernel.org/r/20171020202755.21410-2-andi@firstfloor.org
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Andi Kleen
     
  • [ Upstream commit ca41e244517d6d3f1600c229ff7ca615049c1e9c ]

    The DMA binding for eDMA needs 2 parameters, not 1.
    The second, missing parameter is the tptc to be used for the channel.

    Signed-off-by: Peter Ujfalusi
    Signed-off-by: Tony Lindgren
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Peter Ujfalusi
     
  • [ Upstream commit 627395a6f8091c0aa18f49dca7df59ba3ec147ef ]

    Fixes the following warnings:

    arch/arm/boot/dts/am437x-cm-t43.dtb: Warning (interrupts_property):
    interrupts size is (8), expected multiple of 12 in
    /ocp@44000000/mcasp@48038000

    arch/arm/boot/dts/am437x-cm-t43.dtb: Warning (interrupts_property):
    interrupts size is (8), expected multiple of 12 in
    /ocp@44000000/mcasp@4803C000

    Signed-off-by: Peter Ujfalusi
    Signed-off-by: Tony Lindgren
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Peter Ujfalusi
     
  • [ Upstream commit cd7594ac3281722cb8f10d6f6c7e4287747c7a9d ]

    The pin assignment for the wl127x interrupt was incorrect. I am
    not sure how this every worked. This also eliminates a conflict with
    the SMC911x ethernet driver and properly moves pinmuxes for the
    related gpio to omap3_pmx_wkup from omap3_pmx_core.

    Fixes: ab8dd3aed011 ("ARM: DTS: Add minimal Support for Logic PD
    DM3730 SOM-LV")

    Signed-off-by: Adam Ford
    Signed-off-by: Tony Lindgren
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Adam Ford
     
  • [ Upstream commit 3c18bbf3d11d2005da08b57ff26f44ff1c2b12d0 ]

    This patch fixes and issue where the NAND and GPMC based ethernet
    controller stopped working. This also updates the GPMC settings
    to be consistent with the Logic PD Torpedo development from the
    commit listed above.

    Fixes: 44e4716499b8 ("ARM: dts: omap3: Fix NAND device nodes")

    Signed-off-by: Adam Ford
    Signed-off-by: Tony Lindgren
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Adam Ford
     
  • [ Upstream commit cf87634c8b24e24bf379b8c6807c8b0fb5f23567 ]

    There's been a reproducable USB OHCI/EHCI cpuidle related hang on omap4
    for a while that happens after about 20 - 40 minutes on an idle system
    with some data feeding device being connected, like a USB GPS device or
    a cellular modem.

    This issue happens in cpuidle states C2 and C3 and does not happen if
    cpuidle is limited to C1 state only. The symptoms are that the whole
    system hangs and never wakes up from idle, and if a watchdog is
    configured the system reboots after a while.

    Turns out that OHCI/EHCI devices on omap4 are trying to use the GIC
    interrupt controller directly as a parent instead of the WUGEN. We
    need to pass the interrupts through WUGEN to GIC to provide the wakeup
    events for the processor.

    Let's fix the issue by removing the gic interrupt-parent and use the
    default interrupt-parent wakeupgen instead. Note that omap5.dtsi had
    this already fixes earlier by commit 7136d457f365 ("ARM: omap: convert
    wakeupgen to stacked domains") but we somehow missed omap4 at that
    point.

    Fixes: 7136d457f365 ("ARM: omap: convert wakeupgen to stacked domains")
    Cc: Dave Gerlach
    Cc: Nishanth Menon
    Cc: Marc Zyngier
    Cc: Sebastian Reichel
    Reviewed-by: Roger Quadros
    Signed-off-by: Tony Lindgren
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Tony Lindgren
     
  • [ Upstream commit b6d6af7226465b6d11eac09d0be2ab78a4a9eb62 ]

    Referring TRM Am335X series:
    http://www.ti.com/lit/ug/spruh73p/spruh73p.pdf

    The LastPowerStateEntered bitfield is present only for PM_CEFUSE
    domain. This is not present in any of the other power domains. Hence
    remove the generic am33xx_pwrdm_read_prev_pwrst hook which wrongly
    reads the reserved bit fields for all the other power domains.

    Reading the reserved bits leads to wrongly interpreting the low
    power transitions for various power domains that do not have the
    LastPowerStateEntered field. The pm debug counters values are wrong
    currently as we are incrementing them based on the reserved bits.

    Signed-off-by: Keerthy
    Signed-off-by: Tony Lindgren
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Keerthy
     
  • [ Upstream commit d09220a887f70368afa79e850c95e74890c0a32d ]

    With the CMA changes from Joonsoo Kim , it
    was noticed that n900 stopped booting. After investigating it turned
    out that n900 save_secure_ram_context does some whacky virtual to
    physical address translation for the SRAM data address.

    As we now only have minimal parts of omap3 idle code copied to SRAM,
    running save_secure_ram_context() in SRAM is not needed. It only gets
    called on PM init. And it seems there's no need to ever call this from
    SRAM idle code.

    So let's just keep save_secure_ram_context() in DDR, and pass it the
    physical address of the parameters. We can do everything else in
    omap-secure.c like we already do for other secure code.

    And since we don't have any documentation, I still have no clue what
    the values for 0, 1 and 1 for the parameters might be. If somebody has
    figured it out, please do send a patch to add some comments.

    Debugged-by: Joonsoo Kim
    Signed-off-by: Tony Lindgren
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Tony Lindgren
     
  • [ Upstream commit fd00cf81a9a84776ba58e56bd042c726dcf75cf3 ]

    The receive_buf callback is supposed to return the number of bytes
    processed and should specifically not return a negative errno.

    Due to missing sanity checks in the serdev tty-port controller, a driver
    not providing a receive_buf callback could cause the flush_to_ldisc()
    worker to spin in a tight loop when the tty buffer pointers are
    incremented with -EINVAL (-22).

    The missing sanity checks have now been added to the tty-port
    controller, but let's fix up the serdev-controller helper as well.

    Signed-off-by: Johan Hovold
    Signed-off-by: Greg Kroah-Hartman
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Johan Hovold
     
  • [ Upstream commit c9d24f78268be444e803fb2bb138a2f598de9c23 ]

    PHY drivers can use ULPI interfaces when CONFIG_USB (which is host side
    support) is not enabled, so also build drivers/usb/ when CONFIG_USB_SUPPORT
    is enabled so that drivers/usb/common/ is built.

    ERROR: "ulpi_unregister_driver" [drivers/phy/ti/phy-tusb1210.ko] undefined!
    ERROR: "__ulpi_register_driver" [drivers/phy/ti/phy-tusb1210.ko] undefined!
    ERROR: "ulpi_read" [drivers/phy/ti/phy-tusb1210.ko] undefined!
    ERROR: "ulpi_write" [drivers/phy/ti/phy-tusb1210.ko] undefined!
    ERROR: "ulpi_unregister_driver" [drivers/phy/qualcomm/phy-qcom-usb-hs.ko] undefined!
    ERROR: "__ulpi_register_driver" [drivers/phy/qualcomm/phy-qcom-usb-hs.ko] undefined!
    ERROR: "ulpi_write" [drivers/phy/qualcomm/phy-qcom-usb-hs.ko] undefined!

    Signed-off-by: Randy Dunlap
    Signed-off-by: Greg Kroah-Hartman
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Randy Dunlap
     
  • commit 009f41aed4b3e11e6dc1e3c07377a10c20f1a5ed upstream.

    Keep usbip_device sockfd state in sync with tcp_socket. When tcp_socket
    is reset to null, reset sockfd to -1 to keep it in sync.

    Signed-off-by: Shuah Khan
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman

    Shuah Khan
     
  • commit 7d2b8e6aaf9ee87910c2337e1c59bb5d3e3ba8c5 upstream.

    Since commit 152a6a884ae1 ("staging:iio:accel:sca3000 move
    to hybrid hard / soft buffer design.")
    the buffer mechanism has changed and the
    INDIO_BUFFER_HARDWARE flag has been unused.

    Since commit 2d6ca60f3284 ("iio: Add a DMAengine framework
    based buffer")
    the INDIO_BUFFER_HARDWARE flag has been re-purposed for
    DMA buffers.

    This driver has lagged behind these changes, and
    in order for buffers to work, the INDIO_BUFFER_SOFTWARE
    needs to be used.

    Signed-off-by: Alexandru Ardelean
    Fixes: 2d6ca60f3284 ("iio: Add a DMAengine framework based buffer")
    Cc:
    Signed-off-by: Jonathan Cameron
    Signed-off-by: Greg Kroah-Hartman

    Alexandru Ardelean
     
  • commit e31b617d0a63c6558485aaa730fd162faa95a766 upstream.

    The external clock frequency was set only when selecting
    the internal clock, which is fixed at 4.9152 Mhz.

    This is incorrect, since it should be set when any of
    the external clock or crystal settings is selected.

    Added range validation for the external (crystal/clock)
    frequency setting.
    Valid values are between 2.4576 and 5.12 Mhz.

    Signed-off-by: Alexandru Ardelean
    Cc:
    Signed-off-by: Jonathan Cameron
    Signed-off-by: Greg Kroah-Hartman

    Alexandru Ardelean
     
  • commit 02b7b2844c2ffd3b614ec2b9293e8c7f041d60da upstream.

    Selecting GENERIC_MSI_IRQ_DOMAIN on x86 causes a compile-time error in
    some configurations:

    drivers/base/platform-msi.c:37:19: error: field 'arg' has incomplete type

    On the other architectures, we are fine, but here we should have an additional
    dependency on X86_LOCAL_APIC so we can get the PCI_MSI_IRQ_DOMAIN symbol.

    Cc: stable@vger.kernel.org
    Signed-off-by: Arnd Bergmann
    Signed-off-by: Greg Kroah-Hartman

    Arnd Bergmann
     
  • commit 8ca86f1639ec5890d400fff9211aca22d0a392eb upstream.

    The format specifier "%p" can leak kernel addresses. Use
    "%pK" instead. There were 4 remaining cases in binder.c.

    Signed-off-by: Todd Kjos
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Todd Kjos
     
  • commit f88982679f54f75daa5b8eff3da72508f1e7422f upstream.

    If the kzalloc() in binder_get_thread() fails, binder_poll()
    dereferences the resulting NULL pointer.

    Fix it by returning POLLERR if the memory allocation failed.

    This bug was found by syzkaller using fault injection.

    Reported-by: syzbot
    Fixes: 457b9a6f09f0 ("Staging: android: add binder driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Eric Biggers
    Signed-off-by: Greg Kroah-Hartman

    Eric Biggers
     
  • commit ce8a3a9e76d0193e2e8d74a06d275b3c324ca652 upstream.

    ashmem_pin_unpin() reads asma->file and asma->size before taking the
    ashmem_mutex, so it can race with other operations that modify them.

    Build-tested only.

    Signed-off-by: Ben Hutchings
    Signed-off-by: Greg Kroah-Hartman

    Ben Hutchings
     
  • commit 5eeb2ca02a2f6084fc57ae5c244a38baab07033a upstream.

    To prevent races with ep_remove_waitqueue() removing the
    waitqueue at the same time.

    Reported-by: syzbot+a2a3c4909716e271487e@syzkaller.appspotmail.com
    Signed-off-by: Martijn Coenen
    Cc: stable # 4.14+
    Signed-off-by: Greg Kroah-Hartman

    Martijn Coenen
     
  • commit e46a3b3ba7509cb7fda0e07bc7c63a2cd90f579b upstream.

    binder_send_failed_reply() is called when a synchronous
    transaction fails. It reports an error to the thread that
    is waiting for the completion. Given that the transaction
    is synchronous, there should never be more than 1 error
    response to that thread -- this was being asserted with
    a WARN().

    However, when exercising the driver with syzbot tests, cases
    were observed where multiple "synchronous" requests were
    sent without waiting for responses, so it is possible that
    multiple errors would be reported to the thread. This testing
    was conducted with panic_on_warn set which forced the crash.

    This is easily reproduced by sending back-to-back
    "synchronous" transactions without checking for any
    response (eg, set read_size to 0):

    bwr.write_buffer = (uintptr_t)&bc1;
    bwr.write_size = sizeof(bc1);
    bwr.read_buffer = (uintptr_t)&br;
    bwr.read_size = 0;
    ioctl(fd, BINDER_WRITE_READ, &bwr);
    sleep(1);
    bwr2.write_buffer = (uintptr_t)&bc2;
    bwr2.write_size = sizeof(bc2);
    bwr2.read_buffer = (uintptr_t)&br;
    bwr2.read_size = 0;
    ioctl(fd, BINDER_WRITE_READ, &bwr2);
    sleep(1);

    The first transaction is sent to the servicemanager and the reply
    fails because no VMA is set up by this client. After
    binder_send_failed_reply() is called, the BINDER_WORK_RETURN_ERROR
    is sitting on the thread's todo list since the read_size was 0 and
    the client is not waiting for a response.

    The 2nd transaction is sent and the BINDER_WORK_RETURN_ERROR has not
    been consumed, so the thread's reply_error.cmd is still set (normally
    cleared when the BINDER_WORK_RETURN_ERROR is handled). Therefore
    when the servicemanager attempts to reply to the 2nd failed
    transaction, the error is already set and it triggers this warning.

    This is a user error since it is not waiting for the synchronous
    transaction to complete. If it ever does check, it will see an
    error.

    Changed the WARN() to a pr_warn().

    Signed-off-by: Todd Kjos
    Reported-by: syzbot
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Todd Kjos
     
  • commit dfec091439bb2acf763497cfc58f2bdfc67c56b7 upstream.

    After commit 3f34cfae1238 ("netfilter: on sockopt() acquire sock lock
    only in the required scope"), the caller of nf_{get/set}sockopt() must
    not hold any lock, but, in such changeset, I forgot to cope with DECnet.

    This commit addresses the issue moving the nf call outside the lock,
    in the dn_{get,set}sockopt() with the same schema currently used by
    ipv4 and ipv6. Also moves the unhandled sockopts of the end of the main
    switch statements, to improve code readability.

    Reported-by: Petr Vandrovec
    BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=198791#c2
    Fixes: 3f34cfae1238 ("netfilter: on sockopt() acquire sock lock only in the required scope")
    Signed-off-by: Paolo Abeni
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Paolo Abeni
     
  • commit acbf76ee05067c3942852019993f7beb69a0f45f upstream.

    dtc complains about the lack of #coolin-cells properties for the
    CPU nodes that are referred to as "cooling-device":

    arch/arm64/boot/dts/mediatek/mt8173-evb.dtb: Warning (cooling_device_property): Missing property '#cooling-cells' in node /cpus/cpu@0 or bad phandle (referred from /thermal-zones/cpu_thermal/cooling-maps/map@0:cooling-device[0])
    arch/arm64/boot/dts/mediatek/mt8173-evb.dtb: Warning (cooling_device_property): Missing property '#cooling-cells' in node /cpus/cpu@100 or bad phandle (referred from /thermal-zones/cpu_thermal/cooling-maps/map@1:cooling-device[0])

    Apparently this property must be '' to match the binding.

    Signed-off-by: Arnd Bergmann
    Tested-by: Chunfeng Yun
    Signed-off-by: Olof Johansson
    [arnd: backported to 4.15]
    Signed-off-by: Arnd Bergmann
    Signed-off-by: Greg Kroah-Hartman

    Arnd Bergmann
     
  • commit a21b4c10c7bf5b58112afa20d6fa829e8d74e3e6 upstream.

    Without this tag, we get a build warning:

    WARNING: modpost: missing MODULE_LICENSE() in arch/arm/common/bL_switcher_dummy_if.o

    For completeness, I'm also adding author and description fields.

    Signed-off-by: Arnd Bergmann
    Signed-off-by: Russell King
    Signed-off-by: Greg Kroah-Hartman

    Arnd Bergmann
     
  • commit c1530ac5a3ce93a1f02adabc4508b5fbf862dfe2 upstream.

    Kbuild complains about the lack of a license tag in this driver:

    WARNING: modpost: missing MODULE_LICENSE() in drivers/video/fbdev/mmp/mmp_disp.o

    This adds the license, author and description tags.

    Signed-off-by: Arnd Bergmann
    Signed-off-by: Bartlomiej Zolnierkiewicz
    Signed-off-by: Greg Kroah-Hartman

    Arnd Bergmann
     
  • commit 1783c9d7cb7bc3181b9271665959b87280d98d8e upstream.

    This adds MODULE_LICENSE/AUTHOR/DESCRIPTION tags to the ux500
    platform drivers, to avoid these build warnings:

    WARNING: modpost: missing MODULE_LICENSE() in sound/soc/ux500/snd-soc-ux500-plat-dma.o
    WARNING: modpost: missing MODULE_LICENSE() in sound/soc/ux500/snd-soc-ux500-mach-mop500.o

    The company no longer exists, so the email addresses of the authors
    don't work any more, but I've added them anyway for consistency.

    Signed-off-by: Arnd Bergmann
    Signed-off-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Arnd Bergmann
     
  • commit 40ca54e3a686f13117f3de0c443f8026dadf7c44 upstream.

    syzbot reported a lockdep splat in gen_new_estimator() /
    est_fetch_counters() when attempting to lock est->stats_lock.

    Since est_fetch_counters() is called from BH context from timer
    interrupt, we need to block BH as well when calling it from process
    context.

    Most qdiscs use per cpu counters and are immune to the problem,
    but net/sched/act_api.c and net/netfilter/xt_RATEEST.c are using
    a spinlock to protect their data. They both call gen_new_estimator()
    while object is created and not yet alive, so this bug could
    not trigger a deadlock, only a lockdep splat.

    Fixes: 1c0d32fde5bd ("net_sched: gen_estimator: complete rewrite of rate estimators")
    Signed-off-by: Eric Dumazet
    Reported-by: syzbot
    Acked-by: Cong Wang
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Eric Dumazet
     
  • commit 8d74e9f88d65af8bb2e095aff506aa6eac755ada upstream.

    skb_warn_bad_offload warns when packets enter the GSO stack that
    require skb_checksum_help or vice versa. Do not warn on arbitrary
    bad packets. Packet sockets can craft many. Syzkaller was able to
    demonstrate another one with eth_type games.

    In particular, suppress the warning when segmentation returns an
    error, which is for reasons other than checksum offload.

    See also commit 36c92474498a ("net: WARN if skb_checksum_help() is
    called on skb requiring segmentation") for context on this warning.

    Signed-off-by: Willem de Bruijn
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Willem de Bruijn
     
  • commit f10b4cff98c6977668434fbf5dd58695eeca2897 upstream.

    The rds_tcp_kill_sock() function parses the rds_tcp_conn_list
    to find the rds_connection entries marked for deletion as part
    of the netns deletion under the protection of the rds_tcp_conn_lock.
    Since the rds_tcp_conn_list tracks rds_tcp_connections (which
    have a 1:1 mapping with rds_conn_path), multiple tc entries in
    the rds_tcp_conn_list will map to a single rds_connection, and will
    be deleted as part of the rds_conn_destroy() operation that is
    done outside the rds_tcp_conn_lock.

    The rds_tcp_conn_list traversal done under the protection of
    rds_tcp_conn_lock should not leave any doomed tc entries in
    the list after the rds_tcp_conn_lock is released, else another
    concurrently executiong netns delete (for a differnt netns) thread
    may trip on these entries.

    Reported-by: syzbot
    Signed-off-by: Sowmini Varadhan
    Acked-by: Santosh Shilimkar
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Sowmini Varadhan
     
  • commit 681648e67d43cf269c5590ecf021ed481f4551fc upstream.

    Commit 8edc3affc077 ("rds: tcp: Take explicit refcounts on struct net")
    introduces a regression in rds-tcp netns cleanup. The cleanup_net(),
    (and thus rds_tcp_dev_event notification) is only called from put_net()
    when all netns refcounts go to 0, but this cannot happen if the
    rds_connection itself is holding a c_net ref that it expects to
    release in rds_tcp_kill_sock.

    Instead, the rds_tcp_kill_sock callback should make sure to
    tear down state carefully, ensuring that the socket teardown
    is only done after all data-structures and workqs that depend
    on it are quiesced.

    The original motivation for commit 8edc3affc077 ("rds: tcp: Take explicit
    refcounts on struct net") was to resolve a race condition reported by
    syzkaller where workqs for tx/rx/connect were triggered after the
    namespace was deleted. Those worker threads should have been
    cancelled/flushed before socket tear-down and indeed,
    rds_conn_path_destroy() does try to sequence this by doing
    /* cancel cp_send_w */
    /* cancel cp_recv_w */
    /* flush cp_down_w */
    /* free data structures */
    Here the "flush cp_down_w" will trigger rds_conn_shutdown and thus
    invoke rds_tcp_conn_path_shutdown() to close the tcp socket, so that
    we ought to have satisfied the requirement that "socket-close is
    done after all other dependent state is quiesced". However,
    rds_conn_shutdown has a bug in that it *always* triggers the reconnect
    workq (and if connection is successful, we always restart tx/rx
    workqs so with the right timing, we risk the race conditions reported
    by syzkaller).

    Netns deletion is like module teardown- no need to restart a
    reconnect in this case. We can use the c_destroy_in_prog bit
    to avoid restarting the reconnect.

    Fixes: 8edc3affc077 ("rds: tcp: Take explicit refcounts on struct net")
    Signed-off-by: Sowmini Varadhan
    Acked-by: Santosh Shilimkar
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Sowmini Varadhan
     
  • commit 7dc68e98757a8eccf8ca7a53a29b896f1eef1f76 upstream.

    rateest_hash is supposed to be protected by xt_rateest_mutex,
    and, as suggested by Eric, lookup and insert should be atomic,
    so we should acquire the xt_rateest_mutex once for both.

    So introduce a non-locking helper for internal use and keep the
    locking one for external.

    Reported-by:
    Fixes: 5859034d7eb8 ("[NETFILTER]: x_tables: add RATEEST target")
    Signed-off-by: Cong Wang
    Reviewed-by: Florian Westphal
    Reviewed-by: Eric Dumazet
    Signed-off-by: Pablo Neira Ayuso
    Signed-off-by: Greg Kroah-Hartman

    Cong Wang
     
  • commit ba7cd5d95f25cc6005f687dabdb4e7a6063adda9 upstream.

    xt_cgroup_info_v1->priv is an internal pointer only used for kernel,
    we should not trust what user-space provides.

    Reported-by:
    Fixes: c38c4597e4bf ("netfilter: implement xt_cgroup cgroup2 path match")
    Cc: Pablo Neira Ayuso
    Signed-off-by: Cong Wang
    Signed-off-by: Pablo Neira Ayuso
    Signed-off-by: Greg Kroah-Hartman

    Cong Wang
     
  • commit 3f34cfae1238848fd53f25e5c8fd59da57901f4b upstream.

    Syzbot reported several deadlocks in the netfilter area caused by
    rtnl lock and socket lock being acquired with a different order on
    different code paths, leading to backtraces like the following one:

    ======================================================
    WARNING: possible circular locking dependency detected
    4.15.0-rc9+ #212 Not tainted
    ------------------------------------------------------
    syzkaller041579/3682 is trying to acquire lock:
    (sk_lock-AF_INET6){+.+.}, at: [] lock_sock
    include/net/sock.h:1463 [inline]
    (sk_lock-AF_INET6){+.+.}, at: []
    do_ipv6_setsockopt.isra.8+0x3c5/0x39d0 net/ipv6/ipv6_sockglue.c:167

    but task is already holding lock:
    (rtnl_mutex){+.+.}, at: [] rtnl_lock+0x17/0x20
    net/core/rtnetlink.c:74

    which lock already depends on the new lock.

    the existing dependency chain (in reverse order) is:

    -> #1 (rtnl_mutex){+.+.}:
    __mutex_lock_common kernel/locking/mutex.c:756 [inline]
    __mutex_lock+0x16f/0x1a80 kernel/locking/mutex.c:893
    mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:908
    rtnl_lock+0x17/0x20 net/core/rtnetlink.c:74
    register_netdevice_notifier+0xad/0x860 net/core/dev.c:1607
    tee_tg_check+0x1a0/0x280 net/netfilter/xt_TEE.c:106
    xt_check_target+0x22c/0x7d0 net/netfilter/x_tables.c:845
    check_target net/ipv6/netfilter/ip6_tables.c:538 [inline]
    find_check_entry.isra.7+0x935/0xcf0
    net/ipv6/netfilter/ip6_tables.c:580
    translate_table+0xf52/0x1690 net/ipv6/netfilter/ip6_tables.c:749
    do_replace net/ipv6/netfilter/ip6_tables.c:1165 [inline]
    do_ip6t_set_ctl+0x370/0x5f0 net/ipv6/netfilter/ip6_tables.c:1691
    nf_sockopt net/netfilter/nf_sockopt.c:106 [inline]
    nf_setsockopt+0x67/0xc0 net/netfilter/nf_sockopt.c:115
    ipv6_setsockopt+0x115/0x150 net/ipv6/ipv6_sockglue.c:928
    udpv6_setsockopt+0x45/0x80 net/ipv6/udp.c:1422
    sock_common_setsockopt+0x95/0xd0 net/core/sock.c:2978
    SYSC_setsockopt net/socket.c:1849 [inline]
    SyS_setsockopt+0x189/0x360 net/socket.c:1828
    entry_SYSCALL_64_fastpath+0x29/0xa0

    -> #0 (sk_lock-AF_INET6){+.+.}:
    lock_acquire+0x1d5/0x580 kernel/locking/lockdep.c:3914
    lock_sock_nested+0xc2/0x110 net/core/sock.c:2780
    lock_sock include/net/sock.h:1463 [inline]
    do_ipv6_setsockopt.isra.8+0x3c5/0x39d0 net/ipv6/ipv6_sockglue.c:167
    ipv6_setsockopt+0xd7/0x150 net/ipv6/ipv6_sockglue.c:922
    udpv6_setsockopt+0x45/0x80 net/ipv6/udp.c:1422
    sock_common_setsockopt+0x95/0xd0 net/core/sock.c:2978
    SYSC_setsockopt net/socket.c:1849 [inline]
    SyS_setsockopt+0x189/0x360 net/socket.c:1828
    entry_SYSCALL_64_fastpath+0x29/0xa0

    other info that might help us debug this:

    Possible unsafe locking scenario:

    CPU0 CPU1
    ---- ----
    lock(rtnl_mutex);
    lock(sk_lock-AF_INET6);
    lock(rtnl_mutex);
    lock(sk_lock-AF_INET6);

    *** DEADLOCK ***

    1 lock held by syzkaller041579/3682:
    #0: (rtnl_mutex){+.+.}, at: [] rtnl_lock+0x17/0x20
    net/core/rtnetlink.c:74

    The problem, as Florian noted, is that nf_setsockopt() is always
    called with the socket held, even if the lock itself is required only
    for very tight scopes and only for some operation.

    This patch addresses the issues moving the lock_sock() call only
    where really needed, namely in ipv*_getorigdst(), so that nf_setsockopt()
    does not need anymore to acquire both locks.

    Fixes: 22265a5c3c10 ("netfilter: xt_TEE: resolve oif using netdevice notifiers")
    Reported-by: syzbot+a4c2dc980ac1af699b36@syzkaller.appspotmail.com
    Suggested-by: Florian Westphal
    Signed-off-by: Paolo Abeni
    Signed-off-by: Pablo Neira Ayuso
    Signed-off-by: Greg Kroah-Hartman

    Paolo Abeni