commit 3f2968010fda1eb82de1ff79c7384e3329f96673
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Sun Apr 8 11:49:49 2018 +0200

    Linux 3.18.103

commit b07a637f9ee352481e90b5452a5213139749697d
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Fri Apr 6 08:44:12 2018 +0200

    Revert "ARM: dts: am335x-pepper: Fix the audio CODEC's reset pin"
    
    This reverts commit 2d8c5aa6dc436f6fc1c8b6c0feaee4b0f60cdf38 which was
    comit e153db03c6b7a035c797bcdf35262586f003ee93 upstream.
    
    It requires a driver that was not merged until 4.16, so remove it from
    this stable tree as it is pointless.
    
    Reported-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
    Cc: Andrew F. Davis <afd@ti.com>
    Cc: Tony Lindgren <tony@atomide.com>
    Cc: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit fd96f5328421f5e815b74c4a7da56fceff7a43d4
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Fri Apr 6 08:57:42 2018 +0200

    Revert "ARM: dts: omap3-n900: Fix the audio CODEC's reset pin"
    
    This reverts commit 9d8df5594467b6c73c3833b462abe5811fe7295b which was
    commit 7be4b5dc7ffa9499ac6ef33a5ffa9ff43f9b7057 upstream.
    
    It requires a driver that was not merged until 4.16, so remove it from
    this stable tree as it is pointless.
    
    Reported-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
    Cc: Andrew F. Davis <afd@ti.com>
    Cc: Tony Lindgren <tony@atomide.com>
    Cc: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2afca42b7fbbff84042c55ef25c8f7911c96194c
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Wed Apr 4 17:26:27 2018 +0200

    Revert "PCI/MSI: Stop disabling MSI/MSI-X in pci_device_shutdown()"
    
    This reverts commit 058645e2f0647c85f2bfd577771546d198739fd2 which was
    commit fda78d7a0ead144f4b2cdb582dcba47911f4952c upstream.
    
    The dependancy tree is just too messy here, just drop it from this
    kernel as it's not really needed here.
    
    Reported-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
    Cc: Prarit Bhargava <prarit@redhat.com>
    Cc: Bjorn Helgaas <bhelgaas@google.com>
    Cc: Alex Williamson <alex.williamson@redhat.com>
    Cc: David Arcari <darcari@redhat.com>
    Cc: Myron Stowe <mstowe@redhat.com>
    Cc: Lukas Wunner <lukas@wunner.de>
    Cc: Keith Busch <keith.busch@intel.com>
    Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
    Cc: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ca240c0e0f3fb1562f676be199b737f8c2b54953
Author: Guoqing Jiang <gqjiang@suse.com>
Date:   Thu Apr 6 09:12:18 2017 +0800

    md/raid10: reset the 'first' at the end of loop
    
    commit 6f287ca6046edd34ed83aafb7f9033c9c2e809e2 upstream.
    
    We need to set "first = 0' at the end of rdev_for_each
    loop, so we can get the array's min_offset_diff correctly
    otherwise min_offset_diff just means the last rdev's
    offset diff.
    
    [only the first chunk, due to b506335e5d2b ("md/raid10: skip spare disk as
    'first' disk") being already applied - gregkh]
    
    Suggested-by: NeilBrown <neilb@suse.com>
    Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
    Reviewed-by: NeilBrown <neilb@suse.com>
    Signed-off-by: Shaohua Li <shli@fb.com>
    Cc: Ben Hutchings <ben.hutchings@codethink.co.uk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a8642e3075fb6d05025e8df2f26750f96555e6c9
Author: Keerthy <j-keerthy@ti.com>
Date:   Thu Apr 13 10:21:21 2017 +0530

    ARM: dts: dra7: Add power hold and power controller properties to palmas
    
    commit 7c62de5f3fc92291decc0dac5f36949bdc3fb575 upstream.
    
    Add power hold and power controller properties to palmas node.
    This is needed to shutdown pmic correctly on boards with
    powerhold set.
    
    Signed-off-by: Keerthy <j-keerthy@ti.com>
    Signed-off-by: Tony Lindgren <tony@atomide.com>
    Cc: Ben Hutchings <ben.hutchings@codethink.co.uk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 047ade50b913d7b29f9980634ed9666829e8039b
Author: Keerthy <j-keerthy@ti.com>
Date:   Mon Nov 28 09:31:58 2016 +0530

    Documentation: pinctrl: palmas: Add ti,palmas-powerhold-override property definition
    
    commit 0ea66f76ba17a4b229caaadd77de694111b21769 upstream.
    
    GPIO7 is configured in POWERHOLD mode which has higher priority
    over DEV_ON bit and keeps the PMIC supplies on even after the DEV_ON
    bit is turned off. This property enables driver to over ride the
    POWERHOLD value to GPIO7 so as to turn off the PMIC in power off
    scenarios.
    
    Signed-off-by: Keerthy <j-keerthy@ti.com>
    Acked-by: Rob Herring <robh@kernel.org>
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Cc: Ben Hutchings <ben.hutchings@codethink.co.uk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3307b7be1ffb3302a865074c4d5b94c2884c2ac8
Author: Mike Frysinger <vapier@chromium.org>
Date:   Mon Jan 29 17:08:21 2018 -0500

    vt: change SGR 21 to follow the standards
    
    commit 65d9982d7e523a1a8e7c9af012da0d166f72fc56 upstream.
    
    ECMA-48 [1] (aka ISO 6429) has defined SGR 21 as "doubly underlined"
    since at least March 1984.  The Linux kernel has treated it as SGR 22
    "normal intensity" since it was added in Linux-0.96b in June 1992.
    Before that, it was simply ignored.  Other terminal emulators have
    either ignored it, or treat it as double underline now.  xterm for
    example added support in its 304 release (May 2014) [2] where it was
    previously ignoring it.
    
    Changing this behavior shouldn't be an issue:
    - It isn't a named capability in ncurses's terminfo database, so no
      script is using libtinfo/libcurses to look this up, or using tput
      to query & output the right sequence.
    - Any script assuming SGR 21 will reset intensity in all terminals
      already do not work correctly on non-Linux VTs (including running
      under screen/tmux/etc...).
    - If someone has written a script that only runs in the Linux VT, and
      they're using SGR 21 (instead of SGR 22), the output should still
      be readable.
    
    imo it's important to change this as the Linux VT's non-conformance
    is sometimes used as an argument for other terminal emulators to not
    implement SGR 21 at all, or do so incorrectly.
    
    [1]: https://www.ecma-international.org/publications/standards/Ecma-048.htm
    [2]: https://github.com/ThomasDickey/xterm-snapshots/commit/2fd29cb98d214cb536bcafbee00bc73b3f1eeb9d
    
    Signed-off-by: Mike Frysinger <vapier@chromium.org>
    Cc: stable <stable@vger.kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9b6f9e6fb7f183f43c6eae5780052d5b2230052d
Author: Ondrej Zary <linux@rainbow-software.org>
Date:   Tue Apr 3 10:24:34 2018 -0700

    Input: i8042 - enable MUX on Sony VAIO VGN-CS series to fix touchpad
    
    commit 04bb1719c4de94700056241d4c0fe3c1413f5aff upstream.
    
    The touch sensor buttons on Sony VAIO VGN-CS series laptops (e.g.
    VGN-CS31S) are a separate PS/2 device. As the MUX is disabled for all
    VAIO machines by the nomux blacklist, the data from touch sensor
    buttons and touchpad are combined. The protocol used by the buttons is
    probably similar to the touchpad protocol (both are Synaptics) so both
    devices get enabled. The controller combines the data, creating a mess
    which results in random button clicks, touchpad stopping working and
    lost sync error messages:
    psmouse serio1: TouchPad at isa0060/serio1/input0 lost sync at byte 4
    psmouse serio1: TouchPad at isa0060/serio1/input0 lost sync at byte 1
    psmouse serio1: TouchPad at isa0060/serio1/input0 lost sync at byte 1
    psmouse serio1: TouchPad at isa0060/serio1/input0 lost sync at byte 1
    psmouse serio1: TouchPad at isa0060/serio1/input0 lost sync at byte 1
    psmouse serio1: issuing reconnect request
    
    Add a new i8042_dmi_forcemux_table whitelist with VGN-CS.
    With MUX enabled, touch sensor buttons are detected as separate device
    (and left disabled as there's currently no driver), fixing all touchpad
    problems.
    
    Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
    Cc: stable@vger.kernel.org
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7cbe0f9b5d862a3caef548977a50b6a2b12445ab
Author: Dennis Wassenberg <dennis.wassenberg@secunet.com>
Date:   Thu Mar 8 15:32:09 2018 -0800

    Input: i8042 - add Lenovo ThinkPad L460 to i8042 reset list
    
    commit b56af54ac78c54a519d82813836f305d7f76ef27 upstream.
    
    Reset i8042 before probing because of insufficient BIOS initialisation of
    the i8042 serial controller. This makes Synaptics touchpad detection
    possible. Without resetting the Synaptics touchpad is not detected because
    there are always NACK messages from AUX port.
    
    Signed-off-by: Dennis Wassenberg <dennis.wassenberg@secunet.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ddc867c1eea220ebd620107e43d0ff73a5a4dd56
Author: Andy Lutomirski <luto@kernel.org>
Date:   Fri Sep 30 10:58:57 2016 -0700

    fs/proc: Stop trying to report thread stacks
    
    commit b18cb64ead400c01bf1580eeba330ace51f8087d upstream.
    
    This reverts more of:
    
      b76437579d13 ("procfs: mark thread stack correctly in proc/<pid>/maps")
    
    ... which was partially reverted by:
    
      65376df58217 ("proc: revert /proc/<pid>/maps [stack:TID] annotation")
    
    Originally, /proc/PID/task/TID/maps was the same as /proc/TID/maps.
    
    In current kernels, /proc/PID/maps (or /proc/TID/maps even for
    threads) shows "[stack]" for VMAs in the mm's stack address range.
    
    In contrast, /proc/PID/task/TID/maps uses KSTK_ESP to guess the
    target thread's stack's VMA.  This is racy, probably returns garbage
    and, on arches with CONFIG_TASK_INFO_IN_THREAD=y, is also crash-prone:
    KSTK_ESP is not safe to use on tasks that aren't known to be running
    ordinary process-context kernel code.
    
    This patch removes the difference and just shows "[stack]" for VMAs
    in the mm's stack range.  This is IMO much more sensible -- the
    actual "stack" address really is treated specially by the VM code,
    and the current thread stack isn't even well-defined for programs
    that frequently switch stacks on their own.
    
    Reported-by: Jann Horn <jann@thejh.net>
    Signed-off-by: Andy Lutomirski <luto@kernel.org>
    Acked-by: Thomas Gleixner <tglx@linutronix.de>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Brian Gerst <brgerst@gmail.com>
    Cc: Johannes Weiner <hannes@cmpxchg.org>
    Cc: Kees Cook <keescook@chromium.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Linux API <linux-api@vger.kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Tycho Andersen <tycho.andersen@canonical.com>
    Link: http://lkml.kernel.org/r/3e678474ec14e0a0ec34c611016753eea2e1b8ba.1475257877.git.luto@kernel.org
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 57b796481cd8fa9883ba3fa1114b74e5736c6afd
Author: Johannes Weiner <hannes@cmpxchg.org>
Date:   Tue Feb 2 16:57:29 2016 -0800

    proc: revert /proc/<pid>/maps [stack:TID] annotation
    
    commit 65376df582174ffcec9e6471bf5b0dd79ba05e4a upstream.
    
    Commit b76437579d13 ("procfs: mark thread stack correctly in
    proc/<pid>/maps") added [stack:TID] annotation to /proc/<pid>/maps.
    
    Finding the task of a stack VMA requires walking the entire thread list,
    turning this into quadratic behavior: a thousand threads means a
    thousand stacks, so the rendering of /proc/<pid>/maps needs to look at a
    million combinations.
    
    The cost is not in proportion to the usefulness as described in the
    patch.
    
    Drop the [stack:TID] annotation to make /proc/<pid>/maps (and
    /proc/<pid>/numa_maps) usable again for higher thread counts.
    
    The [stack] annotation inside /proc/<pid>/task/<tid>/maps is retained, as
    identifying the stack VMA there is an O(1) operation.
    
    Siddesh said:
     "The end users needed a way to identify thread stacks programmatically and
      there wasn't a way to do that.  I'm afraid I no longer remember (or have
      access to the resources that would aid my memory since I changed
      employers) the details of their requirement.  However, I did do this on my
      own time because I thought it was an interesting project for me and nobody
      really gave any feedback then as to its utility, so as far as I am
      concerned you could roll back the main thread maps information since the
      information is available in the thread-specific files"
    
    Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
    Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
    Cc: Siddhesh Poyarekar <siddhesh.poyarekar@gmail.com>
    Cc: Shaohua Li <shli@fb.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Ben Hutchings <ben.hutchings@codethink.co.uk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit fe0111391b214eeffdf6b380341ab0a1b97e6279
Author: Eric Biggers <ebiggers@google.com>
Date:   Mon Feb 19 23:48:12 2018 -0800

    crypto: x86/cast5-avx - fix ECB encryption when long sg follows short one
    
    commit 8f461b1e02ed546fbd0f11611138da67fd85a30f upstream.
    
    With ecb-cast5-avx, if a 128+ byte scatterlist element followed a
    shorter one, then the algorithm accidentally encrypted/decrypted only 8
    bytes instead of the expected 128 bytes.  Fix it by setting the
    encryption/decryption 'fn' correctly.
    
    Fixes: c12ab20b162c ("crypto: cast5/avx - avoid using temporary stack buffers")
    Cc: <stable@vger.kernel.org> # v3.8+
    Signed-off-by: Eric Biggers <ebiggers@google.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 289156b8842c231008f5e979cc94d7b3a9792da8
Author: Herbert Xu <herbert@gondor.apana.org.au>
Date:   Mon Mar 26 08:53:25 2018 +0800

    crypto: ahash - Fix early termination in hash walk
    
    commit 900a081f6912a8985dc15380ec912752cb66025a upstream.
    
    When we have an unaligned SG list entry where there is no leftover
    aligned data, the hash walk code will incorrectly return zero as if
    the entire SG list has been processed.
    
    This patch fixes it by moving onto the next page instead.
    
    Reported-by: Eli Cooper <elicooper@gmx.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit bf6bb814e34c26116d62e467f36c8d282e9bab4d
Author: Alexander Gerasiov <gq@redlab-i.ru>
Date:   Sun Feb 4 02:50:22 2018 +0300

    parport_pc: Add support for WCH CH382L PCI-E single parallel port card.
    
    commit 823f7923833c6cc2b16e601546d607dcfb368004 upstream.
    
    WCH CH382L is a PCI-E adapter with 1 parallel port. It is similair to CH382
    but serial ports are not soldered on board. Detected as
    Serial controller: Device 1c00:3050 (rev 10) (prog-if 05 [16850])
    
    Signed-off-by: Alexander Gerasiov <gq@redlab-i.ru>
    Cc: stable <stable@vger.kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d22df065dae66f6a892af8802961801deaa90356
Author: Oliver Neukum <oneukum@suse.com>
Date:   Mon Jan 8 09:21:07 2018 -0500

    media: usbtv: prevent double free in error case
    
    commit 50e7044535537b2a54c7ab798cd34c7f6d900bd2 upstream.
    
    Quoting the original report:
    
    It looks like there is a double-free vulnerability in Linux usbtv driver
    on an error path of usbtv_probe function. When audio registration fails,
    usbtv_video_free function ends up freeing usbtv data structure, which
    gets freed the second time under usbtv_video_fail label.
    
    usbtv_audio_fail:
    
            usbtv_video_free(usbtv); =>
    
               v4l2_device_put(&usbtv->v4l2_dev);
    
                  => v4l2_device_put
    
                      => kref_put
    
                          => v4l2_device_release
    
      => usbtv_release (CALLBACK)
    
                                 => kfree(usbtv) (1st time)
    
    usbtv_video_fail:
    
            usb_set_intfdata(intf, NULL);
    
            usb_put_dev(usbtv->udev);
    
            kfree(usbtv); (2nd time)
    
    So, as we have refcounting, use it
    
    Reported-by: Yavuz, Tuba <tuba@ece.ufl.edu>
    Signed-off-by: Oliver Neukum <oneukum@suse.com>
    CC: stable@vger.kernel.org
    Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 89b1fb2ce4cf086aee7e67b01ff92ba1b8aeddf1
Author: Colin Ian King <colin.king@canonical.com>
Date:   Tue Feb 27 16:21:05 2018 +0000

    mei: remove dev_err message on an unsupported ioctl
    
    commit bb0829a741792b56c908d7745bc0b2b540293bcc upstream.
    
    Currently the driver spams the kernel log on unsupported ioctls which is
    unnecessary as the ioctl returns -ENOIOCTLCMD to indicate this anyway.
    I suspect this was originally for debugging purposes but it really is not
    required so remove it.
    
    Signed-off-by: Colin Ian King <colin.king@canonical.com>
    Cc: stable <stable@vger.kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit cbd80224e4f4b51d75f0402b1523ae50c1492158
Author: Johan Hovold <johan@kernel.org>
Date:   Tue Mar 6 09:32:43 2018 +0100

    USB: serial: cp210x: add ELDAT Easywave RX09 id
    
    commit 1f1e82f74c0947e40144688c9e36abe4b3999f49 upstream.
    
    Add device id for ELDAT Easywave RX09 tranceiver.
    
    Reported-by: Jan Jansen <nattelip@hotmail.com>
    Cc: stable <stable@vger.kernel.org>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit febce02f048cb31d84f554a5b050d21a47d27846
Author: Clemens Werther <clemens.werther@gmail.com>
Date:   Fri Mar 16 10:20:46 2018 +0100

    USB: serial: ftdi_sio: add support for Harman FirmwareHubEmulator
    
    commit 6555ad13a01952c16485c82a52ad1f3e07e34b3a upstream.
    
    Add device id for Harman FirmwareHubEmulator to make the device
    auto-detectable by the driver.
    
    Signed-off-by: Clemens Werther <clemens.werther@gmail.com>
    Cc: stable <stable@vger.kernel.org>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit fcd722f910a5ccc5f54a6478f736d6e477418ff2
Author: Major Hayden <major@mhtx.net>
Date:   Fri Feb 23 14:29:54 2018 -0600

    USB: serial: ftdi_sio: add RT Systems VX-8 cable
    
    commit 9608e5c0f079390473b484ef92334dfd3431bb89 upstream.
    
    This patch adds a device ID for the RT Systems cable used to
    program Yaesu VX-8R/VX-8DR handheld radios. It uses the main
    FTDI VID instead of the common RT Systems VID.
    
    Signed-off-by: Major Hayden <major@mhtx.net>
    Cc: stable <stable@vger.kernel.org>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 30fb2960e073cc3bf9985b59ca1337ab98d396e9
Author: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Date:   Wed Mar 28 15:12:37 2018 -0300

    media: v4l2-compat-ioctl32: initialize a reserved field
    
    The get_v4l2_create32() function is missing a logic with
    would be cleaning a reserved field, causing v4l2-compliance
    to complain:
    
     Buffer ioctls (Input 0):
                    fail: v4l2-test-buffers.cpp(506): check_0(crbufs.reserved, sizeof(crbufs.reserved))
            test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: FAIL
    
    Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6a2185e29ebfaa760887c5185917bb240f5e983d
Author: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Date:   Wed Mar 28 15:12:36 2018 -0300

    media: v4l2-compat-ioctl32: use compat_u64 for video standard
    
    Instead of using the "v4l2_std_id" typedef, use compat_u64,
    as otherwise it fails to properly handle some ioctls.
    
    Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit fe1d928469cc7fcde4a079f52d6e67dc1445fb52
Author: Ricardo Ribalda <ricardo.ribalda@gmail.com>
Date:   Wed Mar 28 15:12:35 2018 -0300

    media: media/v4l2-ctrls: volatiles should not generate CH_VALUE
    
    Volatile controls should not generate CH_VALUE events.
    
    Set has_changed to false to prevent this happening.
    
    Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
    Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5f5fe19a886db65a5a9a8b4cc27473e0a5ce7916
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date:   Wed Mar 28 15:12:34 2018 -0300

    media: v4l2-ctrls: fix sparse warning
    
    The warning is simple:
    
    drivers/media/v4l2-core/v4l2-ctrls.c:1685:15: warning: incorrect type in assignment (different address spaces)
    
    but the fix isn't.
    
    The core problem was that the conversion from user to kernelspace was
    done at too low a level and that needed to be moved up. That made it possible
    to drop pointers to v4l2_ext_control from set_ctrl and validate_new and
    clean up this sparse warning because those functions now always operate
    on kernelspace pointers.
    
    Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5829f6608f339153d8975d7f69bdbf3ab49167ff
Author: Daniel Mentz <danielmentz@google.com>
Date:   Wed Mar 28 15:12:33 2018 -0300

    media: v4l2-compat-ioctl32.c: refactor compat ioctl32 logic
    
    commit a1dfb4c48cc1e64eeb7800a27c66a6f7e88d075a upstream.
    
    The 32-bit compat v4l2 ioctl handling is implemented based on its 64-bit
    equivalent. It converts 32-bit data structures into its 64-bit
    equivalents and needs to provide the data to the 64-bit ioctl in user
    space memory which is commonly allocated using
    compat_alloc_user_space().
    
    However, due to how that function is implemented, it can only be called
    a single time for every syscall invocation.
    
    Supposedly to avoid this limitation, the existing code uses a mix of
    memory from the kernel stack and memory allocated through
    compat_alloc_user_space().
    
    Under normal circumstances, this would not work, because the 64-bit
    ioctl expects all pointers to point to user space memory. As a
    workaround, set_fs(KERNEL_DS) is called to temporarily disable this
    extra safety check and allow kernel pointers. However, this might
    introduce a security vulnerability: The result of the 32-bit to 64-bit
    conversion is writeable by user space because the output buffer has been
    allocated via compat_alloc_user_space(). A malicious user space process
    could then manipulate pointers inside this output buffer, and due to the
    previous set_fs(KERNEL_DS) call, functions like get_user() or put_user()
    no longer prevent kernel memory access.
    
    The new approach is to pre-calculate the total amount of user space
    memory that is needed, allocate it using compat_alloc_user_space() and
    then divide up the allocated memory to accommodate all data structures
    that need to be converted.
    
    An alternative approach would have been to retain the union type karg
    that they allocated on the kernel stack in do_video_ioctl(), copy all
    data from user space into karg and then back to user space. However, we
    decided against this approach because it does not align with other
    compat syscall implementations. Instead, we tried to replicate the
    get_user/put_user pairs as found in other places in the kernel:
    
        if (get_user(clipcount, &up->clipcount) ||
            put_user(clipcount, &kp->clipcount)) return -EFAULT;
    
    Notes from hans.verkuil@cisco.com:
    
    This patch was taken from:
        https://github.com/LineageOS/android_kernel_samsung_apq8084/commit/97b733953c06e4f0398ade18850f0817778255f7
    
    Clearly nobody could be bothered to upstream this patch or at minimum
    tell us :-( We only heard about this a week ago.
    
    This patch was rebased and cleaned up. Compared to the original I
    also swapped the order of the convert_in_user arguments so that they
    matched copy_in_user. It was hard to review otherwise. I also replaced
    the ALLOC_USER_SPACE/ALLOC_AND_GET by a normal function.
    
    Fixes: 6b5a9492ca ("v4l: introduce string control support.")
    
    Signed-off-by: Daniel Mentz <danielmentz@google.com>
    Co-developed-by: Hans Verkuil <hans.verkuil@cisco.com>
    Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 89ef0f4315e58faea6c26414a00e6c59fb6b3b2e
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date:   Wed Mar 28 15:12:32 2018 -0300

    media: v4l2-compat-ioctl32.c: don't copy back the result for certain errors
    
    commit d83a8243aaefe62ace433e4384a4f077bed86acb upstream.
    
    Some ioctls need to copy back the result even if the ioctl returned
    an error. However, don't do this for the error code -ENOTTY.
    It makes no sense in that cases.
    
    Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
    Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9e73a907c79159a6fc53739dee3dd53e437af962
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date:   Wed Mar 28 15:12:31 2018 -0300

    media: v4l2-compat-ioctl32.c: drop pr_info for unknown buffer type
    
    commit 169f24ca68bf0f247d111aef07af00dd3a02ae88 upstream.
    
    There is nothing wrong with using an unknown buffer type. So
    stop spamming the kernel log whenever this happens. The kernel
    will just return -EINVAL to signal this.
    
    Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
    Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4cbb719aafa20391d10850356ac2c94d080e58f0
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date:   Wed Mar 28 15:12:30 2018 -0300

    media: v4l2-compat-ioctl32.c: copy clip list in put_v4l2_window32
    
    commit a751be5b142ef6bcbbb96d9899516f4d9c8d0ef4 upstream.
    
    put_v4l2_window32() didn't copy back the clip list to userspace.
    Drivers can update the clip rectangles, so this should be done.
    
    Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
    Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2f3b72f4a34cb9638bec185229a1b586566df909
Author: Daniel Mentz <danielmentz@google.com>
Date:   Wed Mar 28 15:12:29 2018 -0300

    media: v4l2-compat-ioctl32: Copy v4l2_window->global_alpha
    
    commit 025a26fa14f8fd55d50ab284a30c016a5be953d0 upstream.
    
    Commit b2787845fb91 ("V4L/DVB (5289): Add support for video output
    overlays.") added the field global_alpha to struct v4l2_window but did
    not update the compat layer accordingly. This change adds global_alpha
    to struct v4l2_window32 and copies the value for global_alpha back and
    forth.
    
    Signed-off-by: Daniel Mentz <danielmentz@google.com>
    Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4de0aa9aa19b1e801e2a72016b0f1e84efb5b17a
Author: Hans Verkuil <hansverk@cisco.com>
Date:   Wed Mar 28 15:12:28 2018 -0300

    media: v4l2-compat-ioctl32.c: make ctrl_is_pointer work for subdevs
    
    commit 273caa260035c03d89ad63d72d8cd3d9e5c5e3f1 upstream.
    
    If the device is of type VFL_TYPE_SUBDEV then vdev->ioctl_ops
    is NULL so the 'if (!ops->vidioc_query_ext_ctrl)' check would crash.
    Add a test for !ops to the condition.
    
    All sub-devices that have controls will use the control framework,
    so they do not have an equivalent to ops->vidioc_query_ext_ctrl.
    Returning false if ops is NULL is the correct thing to do here.
    
    Fixes: b8c601e8af ("v4l2-compat-ioctl32.c: fix ctrl_is_pointer")
    
    Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
    Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Reported-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 72bdd7e09b206bb4f402bbaa3e511e33112222e9
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date:   Wed Mar 28 15:12:27 2018 -0300

    media: v4l2-compat-ioctl32.c: fix ctrl_is_pointer
    
    commit b8c601e8af2d08f733d74defa8465303391bb930 upstream.
    
    ctrl_is_pointer just hardcoded two known string controls, but that
    caused problems when using e.g. custom controls that use a pointer
    for the payload.
    
    Reimplement this function: it now finds the v4l2_ctrl (if the driver
    uses the control framework) or it calls vidioc_query_ext_ctrl (if the
    driver implements that directly).
    
    In both cases it can now check if the control is a pointer control
    or not.
    
    Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
    Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2a13e9ce92c3a4e44d548996577efadc3bedd6a7
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date:   Wed Mar 28 15:12:26 2018 -0300

    media: v4l2-compat-ioctl32.c: copy m.userptr in put_v4l2_plane32
    
    commit 8ed5a59dcb47a6f76034ee760b36e089f3e82529 upstream.
    
    The struct v4l2_plane32 should set m.userptr as well. The same
    happens in v4l2_buffer32 and v4l2-compliance tests for this.
    
    Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
    Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ac35609a8c9690f0efe934e9a019c6de1fc380e7
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date:   Wed Mar 28 15:12:25 2018 -0300

    media: v4l2-compat-ioctl32.c: avoid sizeof(type)
    
    commit 333b1e9f96ce05f7498b581509bb30cde03018bf upstream.
    
    Instead of doing sizeof(struct foo) use sizeof(*up). There even were
    cases where 4 * sizeof(__u32) was used instead of sizeof(kp->reserved),
    which is very dangerous when the size of the reserved array changes.
    
    Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
    Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8d0f174d7938f9ca0127060b10a05adce1fae8db
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date:   Wed Mar 28 15:12:24 2018 -0300

    media: v4l2-compat-ioctl32.c: move 'helper' functions to __get/put_v4l2_format32
    
    commit 486c521510c44a04cd756a9267e7d1e271c8a4ba upstream.
    
    These helper functions do not really help. Move the code to the
    __get/put_v4l2_format32 functions.
    
    Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
    Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6438cbe87cb0e360fd5f52abea6ebf20f6ab500f
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date:   Wed Jan 24 04:35:48 2018 -0500

    media: v4l2-compat-ioctl32.c: fix the indentation
    
    commit b7b957d429f601d6d1942122b339474f31191d75 upstream.
    
    The indentation of this source is all over the place. Fix this.
    This patch only changes whitespace.
    
    Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
    Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Cc: <stable@vger.kernel.org>      # for v4.15 and up
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e4746977e0a60293fa92f6b408116af68f1edbd9
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date:   Wed Jan 24 08:37:04 2018 -0500

    media: v4l2-compat-ioctl32.c: add missing VIDIOC_PREPARE_BUF
    
    commit 3ee6d040719ae09110e5cdf24d5386abe5d1b776 upstream.
    
    The result of the VIDIOC_PREPARE_BUF ioctl was never copied back
    to userspace since it was missing in the switch.
    
    Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
    Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Cc: <stable@vger.kernel.org>      # for v4.15 and up
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1024f43f8e1fae67bd10567c63010b26d8c8cb4c
Author: Ricardo Ribalda <ricardo.ribalda@gmail.com>
Date:   Mon Jun 20 09:47:22 2016 -0300

    vb2: V4L2_BUF_FLAG_DONE is set after DQBUF
    
    commit 3171cc2b4eb9831ab4df1d80d0410a945b8bc84e upstream.
    
    According to the doc, V4L2_BUF_FLAG_DONE is cleared after DQBUF:
    
    V4L2_BUF_FLAG_DONE 0x00000004  ... After calling the VIDIOC_QBUF or
    VIDIOC_DQBUF it is always cleared ...
    
    Unfortunately, it seems that videobuf2 keeps it set after DQBUF. This
    can be tested with vivid and dev_debug:
    
    [257604.338082] video1: VIDIOC_DQBUF: 71:33:25.00260479 index=3,
    type=vid-cap, flags=0x00002004, field=none, sequence=163,
    memory=userptr, bytesused=460800, offset/userptr=0x344b000,
    length=460800
    
    This patch forces FLAG_DONE to 0 after calling DQBUF.
    
    Reported-by: Dimitrios Katsaros <patcherwork@gmail.com>
    Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
    Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d5d86369040432a90e248a30806f596428f854a3
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date:   Tue Jan 30 03:50:01 2018 -0500

    media: v4l2-ioctl.c: don't copy back the result for -ENOTTY
    
    commit 181a4a2d5a0a7b43cab08a70710d727e7764ccdd upstream.
    
    If the ioctl returned -ENOTTY, then don't bother copying
    back the result as there is no point.
    
    Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
    Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Cc: <stable@vger.kernel.org>      # for v4.15 and up
    Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2369620165f6716e4c983dc24eb103970bb9098d
Author: Paolo Bonzini <pbonzini@redhat.com>
Date:   Wed Jul 5 10:30:56 2017 +0200

    scsi: virtio_scsi: always read VPD pages for multiqueue too
    
    commit a680f1d463aeaeb00d22af257a56e111967c2f18 upstream.
    
    Multi-queue virtio-scsi uses a different scsi_host_template struct.  Add
    the .device_alloc field there, too.
    
    Fixes: 25d1d50e23275e141e3a3fe06c25a99f4c4bf4e0
    Cc: stable@vger.kernel.org
    Cc: David Gibson <david@gibson.dropbear.id.au>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Reviewed-by: Fam Zheng <famz@redhat.com>
    Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Cc: Ben Hutchings <ben.hutchings@codethink.co.uk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 39c292e2f63c41ffe783b417260b4d6a0aec78be
Author: Szymon Janc <szymon.janc@codecoup.pl>
Date:   Mon Feb 26 15:41:53 2018 +0100

    Bluetooth: Fix missing encryption refresh on Security Request
    
    commit 64e759f58f128730b97a3c3a26d283c075ad7c86 upstream.
    
    If Security Request is received on connection that is already encrypted
    with sufficient security master should perform encryption key refresh
    procedure instead of just ignoring Slave Security Request
    (Core Spec 5.0 Vol 3 Part H 2.4.6).
    
    > ACL Data RX: Handle 3585 flags 0x02 dlen 6
          SMP: Security Request (0x0b) len 1
            Authentication requirement: Bonding, No MITM, SC, No Keypresses (0x09)
    < HCI Command: LE Start Encryption (0x08|0x0019) plen 28
            Handle: 3585
            Random number: 0x0000000000000000
            Encrypted diversifier: 0x0000
            Long term key: 44264272a5c426a9e868f034cf0e69f3
    > HCI Event: Command Status (0x0f) plen 4
          LE Start Encryption (0x08|0x0019) ncmd 1
            Status: Success (0x00)
    > HCI Event: Encryption Key Refresh Complete (0x30) plen 3
            Status: Success (0x00)
            Handle: 3585
    
    Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
    Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 42b41149e2459edb50d583ac732b4941d898bae8
Author: Florian Westphal <fw@strlen.de>
Date:   Sat Mar 10 01:15:45 2018 +0100

    netfilter: x_tables: add and use xt_check_proc_name
    
    commit b1d0a5d0cba4597c0394997b2d5fced3e3841b4e upstream.
    
    recent and hashlimit both create /proc files, but only check that
    name is 0 terminated.
    
    This can trigger WARN() from procfs when name is "" or "/".
    Add helper for this and then use it for both.
    
    Cc: Eric Dumazet <eric.dumazet@gmail.com>
    Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
    Reported-by: <syzbot+0502b00edac2a0680b61@syzkaller.appspotmail.com>
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 63d1e53df8de96085e423a973bb557d6d6b350f3
Author: Florian Westphal <fw@strlen.de>
Date:   Fri Mar 9 14:27:31 2018 +0100

    netfilter: bridge: ebt_among: add more missing match size checks
    
    commit c8d70a700a5b486bfa8e5a7d33d805389f6e59f9 upstream.
    
    ebt_among is special, it has a dynamic match size and is exempt
    from the central size checks.
    
    commit c4585a2823edf ("bridge: ebt_among: add missing match size checks")
    added validation for pool size, but missed fact that the macros
    ebt_among_wh_src/dst can already return out-of-bound result because
    they do not check value of wh_src/dst_ofs (an offset) vs. the size
    of the match that userspace gave to us.
    
    v2:
    check that offset has correct alignment.
    Paolo Abeni points out that we should also check that src/dst
    wormhash arrays do not overlap, and src + length lines up with
    start of dst (or vice versa).
    v3: compact wormhash_sizes_valid() part
    
    NB: Fixes tag is intentionally wrong, this bug exists from day
    one when match was added for 2.6 kernel. Tag is there so stable
    maintainers will notice this one too.
    
    Tested with same rules from the earlier patch.
    
    Fixes: c4585a2823edf ("bridge: ebt_among: add missing match size checks")
    Reported-by: <syzbot+bdabab6f1983a03fc009@syzkaller.appspotmail.com>
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6be3251dafdc2a75afee5241dc9b2bde91c4ebc2
Author: Steffen Klassert <steffen.klassert@secunet.com>
Date:   Thu Feb 1 08:49:23 2018 +0100

    xfrm: Refuse to insert 32 bit userspace socket policies on 64 bit systems
    
    commit 19d7df69fdb2636856dc8919de72fc1bf8f79598 upstream.
    
    We don't have a compat layer for xfrm, so userspace and kernel
    structures have different sizes in this case. This results in
    a broken configuration, so refuse to configure socket policies
    when trying to insert from 32 bit userspace as we do it already
    with policies inserted via netlink.
    
    Reported-and-tested-by: syzbot+e1a1577ca8bcb47b769a@syzkaller.appspotmail.com
    Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
    [use is_compat_task() - gregkh]
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5ca716eed669601b321c66139d626d5b42a011dd
Author: Greg Hackmann <ghackmann@google.com>
Date:   Wed Mar 7 14:42:53 2018 -0800

    net: xfrm: use preempt-safe this_cpu_read() in ipcomp_alloc_tfms()
    
    commit 0dcd7876029b58770f769cbb7b484e88e4a305e5 upstream.
    
    f7c83bcbfaf5 ("net: xfrm: use __this_cpu_read per-cpu helper") added a
    __this_cpu_read() call inside ipcomp_alloc_tfms().
    
    At the time, __this_cpu_read() required the caller to either not care
    about races or to handle preemption/interrupt issues.  3.15 tightened
    the rules around some per-cpu operations, and now __this_cpu_read()
    should never be used in a preemptible context.  On 3.15 and later, we
    need to use this_cpu_read() instead.
    
    syzkaller reported this leading to the following kernel BUG while
    fuzzing sendmsg:
    
    BUG: using __this_cpu_read() in preemptible [00000000] code: repro/3101
    caller is ipcomp_init_state+0x185/0x990
    CPU: 3 PID: 3101 Comm: repro Not tainted 4.16.0-rc4-00123-g86f84779d8e9 #154
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1 04/01/2014
    Call Trace:
     dump_stack+0xb9/0x115
     check_preemption_disabled+0x1cb/0x1f0
     ipcomp_init_state+0x185/0x990
     ? __xfrm_init_state+0x876/0xc20
     ? lock_downgrade+0x5e0/0x5e0
     ipcomp4_init_state+0xaa/0x7c0
     __xfrm_init_state+0x3eb/0xc20
     xfrm_init_state+0x19/0x60
     pfkey_add+0x20df/0x36f0
     ? pfkey_broadcast+0x3dd/0x600
     ? pfkey_sock_destruct+0x340/0x340
     ? pfkey_seq_stop+0x80/0x80
     ? __skb_clone+0x236/0x750
     ? kmem_cache_alloc+0x1f6/0x260
     ? pfkey_sock_destruct+0x340/0x340
     ? pfkey_process+0x62a/0x6f0
     pfkey_process+0x62a/0x6f0
     ? pfkey_send_new_mapping+0x11c0/0x11c0
     ? mutex_lock_io_nested+0x1390/0x1390
     pfkey_sendmsg+0x383/0x750
     ? dump_sp+0x430/0x430
     sock_sendmsg+0xc0/0x100
     ___sys_sendmsg+0x6c8/0x8b0
     ? copy_msghdr_from_user+0x3b0/0x3b0
     ? pagevec_lru_move_fn+0x144/0x1f0
     ? find_held_lock+0x32/0x1c0
     ? do_huge_pmd_anonymous_page+0xc43/0x11e0
     ? lock_downgrade+0x5e0/0x5e0
     ? get_kernel_page+0xb0/0xb0
     ? _raw_spin_unlock+0x29/0x40
     ? do_huge_pmd_anonymous_page+0x400/0x11e0
     ? __handle_mm_fault+0x553/0x2460
     ? __fget_light+0x163/0x1f0
     ? __sys_sendmsg+0xc7/0x170
     __sys_sendmsg+0xc7/0x170
     ? SyS_shutdown+0x1a0/0x1a0
     ? __do_page_fault+0x5a0/0xca0
     ? lock_downgrade+0x5e0/0x5e0
     SyS_sendmsg+0x27/0x40
     ? __sys_sendmsg+0x170/0x170
     do_syscall_64+0x19f/0x640
     entry_SYSCALL_64_after_hwframe+0x42/0xb7
    RIP: 0033:0x7f0ee73dfb79
    RSP: 002b:00007ffe14fc15a8 EFLAGS: 00000207 ORIG_RAX: 000000000000002e
    RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f0ee73dfb79
    RDX: 0000000000000000 RSI: 00000000208befc8 RDI: 0000000000000004
    RBP: 00007ffe14fc15b0 R08: 00007ffe14fc15c0 R09: 00007ffe14fc15c0
    R10: 0000000000000000 R11: 0000000000000207 R12: 0000000000400440
    R13: 00007ffe14fc16b0 R14: 0000000000000000 R15: 0000000000000000
    
    Signed-off-by: Greg Hackmann <ghackmann@google.com>
    Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5520490d27f410f73014aee6052d44130e2db42c
Author: Florian Westphal <fw@strlen.de>
Date:   Mon Feb 12 14:42:01 2018 +0100

    xfrm_user: uncoditionally validate esn replay attribute struct
    
    commit d97ca5d714a5334aecadadf696875da40f1fbf3e upstream.
    
    The sanity test added in ecd7918745234 can be bypassed, validation
    only occurs if XFRM_STATE_ESN flag is set, but rest of code doesn't care
    and just checks if the attribute itself is present.
    
    So always validate.  Alternative is to reject if we have the attribute
    without the flag but that would change abi.
    
    Reported-by: syzbot+0ab777c27d2bb7588f73@syzkaller.appspotmail.com
    Cc: Mathias Krause <minipli@googlemail.com>
    Fixes: ecd7918745234 ("xfrm_user: ensure user supplied esn replay window is valid")
    Fixes: d8647b79c3b7e ("xfrm: Add user interface for esn and big anti-replay windows")
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 502990185f76a3f3816e3c1e2c130001dc9923cb
Author: Masami Hiramatsu <mhiramat@kernel.org>
Date:   Thu May 25 19:38:17 2017 +0900

    kprobes/x86: Fix to set RWX bits correctly before releasing trampoline
    
    commit c93f5cf571e7795f97d49ef51b766cf25e328545 upstream.
    
    Fix kprobes to set(recover) RWX bits correctly on trampoline
    buffer before releasing it. Releasing readonly page to
    module_memfree() crash the kernel.
    
    Without this fix, if kprobes user register a bunch of kprobes
    in function body (since kprobes on function entry usually
    use ftrace) and unregister it, kernel hits a BUG and crash.
    
    Link: http://lkml.kernel.org/r/149570868652.3518.14120169373590420503.stgit@devbox
    
    Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
    Fixes: d0381c81c2f7 ("kprobes/x86: Set kprobes pages read-only")
    Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
    Cc: Ben Hutchings <ben.hutchings@codethink.co.uk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2883c668105d7829aee746d12ce0407b22c345a4
Author: Ben Hutchings <ben.hutchings@codethink.co.uk>
Date:   Thu Jan 11 17:01:36 2018 +0000

    xhci: Fix ring leak in failure path of xhci_alloc_virt_device()
    
    This is a stable-only fix for the backport of commit 5d9b70f7d52e
    ("xhci: Don't add a virt_dev to the devs array before it's fully
    allocated").
    
    In branches that predate commit c5628a2af83a ("xhci: remove endpoint
    ring cache") there is an additional failure path in
    xhci_alloc_virt_device() where ring cache allocation fails, in
    which case we need to free the ring allocated for endpoint 0.
    
    Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
    Cc: Mathias Nyman <mathias.nyman@intel.com>
    Cc: Wang Han <wanghan1995315@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 15075ddaadee365837c7ae5d00299e6890b8289b
Author: Ben Hutchings <ben.hutchings@codethink.co.uk>
Date:   Thu Mar 8 15:59:07 2018 +0000

    Revert "led: core: Fix brightness setting when setting delay_off=0"
    
    This reverts commit 20f6d9c2af33da892a0e03ffd6249c7ab81edfb7, which
    was commit 2b83ff96f51d0b039c4561b9f95c824d7bddb85c upstream.
    The bug that it should fix was only introduced in Linux 4.7, and
    in 4.4 it causes a regression.
    
    Reported-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
    Cc: Matthieu CASTET <matthieu.castet@parrot.com>
    Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
    Cc: Wang Han <wanghan1995315@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7d14bc73d4d93db22b27493a405996857fb0748f
Author: Krzysztof Opasiak <kopasiak90@gmail.com>
Date:   Thu Jan 19 18:55:28 2017 +0100

    usb: gadget: f_hid: fix: Prevent accessing released memory
    
    commit aa65d11aa008f4de58a9cee7e121666d9d68505e upstream.
    
    When we unlock our spinlock to copy data to user we may get
    disabled by USB host and free the whole list of completed out
    requests including the one from which we are copying the data
    to user memory.
    
    To prevent from this let's remove our working element from
    the list and place it back only if there is sth left when we
    finish with it.
    
    Fixes: 99c515005857 ("usb: gadget: hidg: register OUT INT endpoint for SET_REPORT")
    Cc: stable@vger.kernel.org
    Tested-by: David Lechner <david@lechnology.com>
    Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
    Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
    Cc: Jerry Zhang <zhangjerry@google.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit fee92f39627a0eeb011bcfb90ac34212d5946d5e
Author: Felipe F. Tonello <eu@felipetonello.com>
Date:   Mon Aug 8 21:30:06 2016 +0100

    usb: gadget: align buffer size when allocating for OUT endpoint
    
    commit e0466156ee2e944fb47a3fa00932c3698a6d2c67 upstream.
    
    Using usb_ep_align() makes sure that the buffer size for OUT endpoints is
    always aligned with wMaxPacketSize (512 usually). This makes sure
    that no buffer has the wrong size, which can cause nasty bugs.
    
    Signed-off-by: Felipe F. Tonello <eu@felipetonello.com>
    Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7757f7309913e77ef71f73e58b7ed4807bd51c0c
Author: Felipe F. Tonello <eu@felipetonello.com>
Date:   Mon Aug 8 21:30:04 2016 +0100

    usb: gadget: fix usb_ep_align_maybe endianness and new usb_ep_align
    
    commit 16b114a6d7973cf027e4c2b23eae1076eaf98c25 upstream.
    
    USB spec specifies wMaxPacketSize to be little endian (as other properties),
    so when using this variable in the driver we should convert to the current
    CPU endianness if necessary.
    
    This patch also introduces usb_ep_align() which does always returns the
    aligned buffer size for an endpoint. This is useful to be used by USB requests
    allocator functions.
    
    Signed-off-by: Felipe F. Tonello <eu@felipetonello.com>
    Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ab34ca160fb80df1ea86f64e7690c6d4a5ee045d
Author: Felipe F. Tonello <eu@felipetonello.com>
Date:   Mon Aug 8 21:30:05 2016 +0100

    usb: gadget: change len to size_t on alloc_ep_req()
    
    commit 69bb99738b5c6d56d2b1a75db9cbb4d187453c1a upstream.
    
    Length of buffers should be of type size_t whenever possible. Altough
    recommended, this change has no real practical change, unless a driver has a
    uses a huge or negative buffer size - it might help find these bugs.
    
    Signed-off-by: Felipe F. Tonello <eu@felipetonello.com>
    Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 70fa9b508c19a47110c96f20bac460b90310c847
Author: Felipe F. Tonello <eu@felipetonello.com>
Date:   Tue Nov 10 17:52:05 2015 +0000

    usb: gadget: define free_ep_req as universal function
    
    commit 079fe5a6da616891cca1a26e803e1df2a87e9ae5 upstream.
    
    This function is shared between gadget functions, so this avoid unnecessary
    duplicated code and potentially avoid memory leaks.
    
    Reviewed-by: Robert Baldyga <r.baldyga@samsung.com>
    Signed-off-by: Felipe F. Tonello <eu@felipetonello.com>
    Signed-off-by: Felipe Balbi <balbi@ti.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 25eac84ca257885a52aab0338005f76235c93d10
Author: Richard Narron <comet.berkeley@gmail.com>
Date:   Wed Jan 10 09:12:16 2018 -0700

    partitions/msdos: Unable to mount UFS 44bsd partitions
    
    commit 5f15684bd5e5ef39d4337988864fec8012471dda upstream.
    
    UFS partitions from newer versions of FreeBSD 10 and 11 use relative
    addressing for their subpartitions. But older versions of FreeBSD still
    use absolute addressing just like OpenBSD and NetBSD.
    
    Instead of simply testing for a FreeBSD partition, the code needs to
    also test if the starting offset of the C subpartition is zero.
    
    https://bugzilla.kernel.org/show_bug.cgi?id=197733
    
    Signed-off-by: Richard Narron <comet.berkeley@gmail.com>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8f7db030a6398638515c645184ad261d9ea58559
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date:   Mon Mar 26 15:39:07 2018 -1000

    perf/hwbp: Simplify the perf-hwbp code, fix documentation
    
    commit f67b15037a7a50c57f72e69a6d59941ad90a0f0f upstream.
    
    Annoyingly, modify_user_hw_breakpoint() unnecessarily complicates the
    modification of a breakpoint - simplify it and remove the pointless
    local variables.
    
    Also update the stale Docbook while at it.
    
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Acked-by: Thomas Gleixner <tglx@linutronix.de>
    Cc: <stable@vger.kernel.org>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Andy Lutomirski <luto@kernel.org>
    Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Frederic Weisbecker <fweisbec@gmail.com>
    Cc: Jiri Olsa <jolsa@redhat.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Stephane Eranian <eranian@google.com>
    Cc: Vince Weaver <vincent.weaver@maine.edu>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 46b7dc0470bcec486d7514a427478e1761add0c1
Author: Dan Carpenter <dan.carpenter@oracle.com>
Date:   Tue Mar 27 16:07:52 2018 +0300

    ALSA: pcm: potential uninitialized return values
    
    commit 5607dddbfca774fb38bffadcb077fe03aa4ac5c6 upstream.
    
    Smatch complains that "tmp" can be uninitialized if we do a zero size
    write.
    
    Fixes: 02a5d6925cd3 ("ALSA: pcm: Avoid potential races between OSS ioctls and read/write")
    Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a61083601e592212022640da7a9ce2d787cdd6b8
Author: Stefan Roese <sr@denx.de>
Date:   Mon Mar 26 16:10:21 2018 +0200

    ALSA: pcm: Use dma_bytes as size parameter in dma_mmap_coherent()
    
    commit 9066ae7ff5d89c0b5daa271e2d573540097a94fa upstream.
    
    When trying to use the driver (e.g. aplay *.wav), the 4MiB DMA buffer
    will get mmapp'ed in 16KiB chunks. But this fails with the 2nd 16KiB
    area, as the page offset is outside of the VMA range (size), which is
    currently used as size parameter in snd_pcm_lib_default_mmap(). By
    using the DMA buffer size (dma_bytes) instead, the complete DMA buffer
    can be mmapp'ed and the issue is fixed.
    
    This issue was detected on an ARM platform (TI AM57xx) using the RME
    HDSP MADI PCIe soundcard.
    
    Fixes: 657b1989dacf ("ALSA: pcm - Use dma_mmap_coherent() if available")
    Signed-off-by: Stefan Roese <sr@denx.de>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4c4921fcfa75bba08344fc2dae1c01fb1b8eabd3
Author: Linus Walleij <linus.walleij@linaro.org>
Date:   Sat Mar 3 23:29:03 2018 +0100

    mtd: jedec_probe: Fix crash in jedec_read_mfr()
    
    commit 87a73eb5b56fd6e07c8e499fe8608ef2d8912b82 upstream.
    
    It turns out that the loop where we read manufacturer
    jedec_read_mfd() can under some circumstances get a
    CFI_MFR_CONTINUATION repeatedly, making the loop go
    over all banks and eventually hit the end of the
    map and crash because of an access violation:
    
    Unable to handle kernel paging request at virtual address c4980000
    pgd = (ptrval)
    [c4980000] *pgd=03808811, *pte=00000000, *ppte=00000000
    Internal error: Oops: 7 [#1] PREEMPT ARM
    CPU: 0 PID: 1 Comm: swapper Not tainted 4.16.0-rc1+ #150
    Hardware name: Gemini (Device Tree)
    PC is at jedec_probe_chip+0x6ec/0xcd0
    LR is at 0x4
    pc : [<c03a2bf4>]    lr : [<00000004>]    psr: 60000013
    sp : c382dd18  ip : 0000ffff  fp : 00000000
    r10: c0626388  r9 : 00020000  r8 : c0626340
    r7 : 00000000  r6 : 00000001  r5 : c3a71afc  r4 : c382dd70
    r3 : 00000001  r2 : c4900000  r1 : 00000002  r0 : 00080000
    Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
    Control: 0000397f  Table: 00004000  DAC: 00000053
    Process swapper (pid: 1, stack limit = 0x(ptrval))
    
    Fix this by breaking the loop with a return 0 if
    the offset exceeds the map size.
    
    Fixes: 5c9c11e1c47c ("[MTD] [NOR] Add support for flash chips with ID in bank other than 0")
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f4d8124a4ade232cae1161a6aca86e0c0a1fa4f6
Author: Florian Fainelli <f.fainelli@gmail.com>
Date:   Sun Mar 18 12:49:51 2018 -0700

    net: fec: Fix unbalanced PM runtime calls
    
    
    [ Upstream commit a069215cf5985f3aa1bba550264907d6bd05c5f7 ]
    
    When unbinding/removing the driver, we will run into the following warnings:
    
    [  259.655198] fec 400d1000.ethernet: 400d1000.ethernet supply phy not found, using dummy regulator
    [  259.665065] fec 400d1000.ethernet: Unbalanced pm_runtime_enable!
    [  259.672770] fec 400d1000.ethernet (unnamed net_device) (uninitialized): Invalid MAC address: 00:00:00:00:00:00
    [  259.683062] fec 400d1000.ethernet (unnamed net_device) (uninitialized): Using random MAC address: f2:3e:93:b7:29:c1
    [  259.696239] libphy: fec_enet_mii_bus: probed
    
    Avoid these warnings by balancing the runtime PM calls during fec_drv_remove().
    
    Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 60aa3ac5c1480283691b2663201f2bc1888d8b5f
Author: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Date:   Tue Mar 20 07:59:15 2018 +0100

    s390/qeth: on channel error, reject further cmd requests
    
    
    [ Upstream commit a6c3d93963e4b333c764fde69802c3ea9eaa9d5c ]
    
    When the IRQ handler determines that one of the cmd IO channels has
    failed and schedules recovery, block any further cmd requests from
    being submitted. The request would inevitably stall, and prevent the
    recovery from making progress until the request times out.
    
    This sort of error was observed after Live Guest Relocation, where
    the pending IO on the READ channel intentionally gets terminated to
    kick-start recovery. Simultaneously the guest executed SIOCETHTOOL,
    triggering qeth to issue a QUERY CARD INFO command. The command
    then stalled in the inoperabel WRITE channel.
    
    Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 61a3becbba4f0a70f0a11d638015a972302ba501
Author: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Date:   Tue Mar 20 07:59:14 2018 +0100

    s390/qeth: lock read device while queueing next buffer
    
    
    [ Upstream commit 17bf8c9b3d499d5168537c98b61eb7a1fcbca6c2 ]
    
    For calling ccw_device_start(), issue_next_read() needs to hold the
    device's ccwlock.
    This is satisfied for the IRQ handler path (where qeth_irq() gets called
    under the ccwlock), but we need explicit locking for the initial call by
    the MPC initialization.
    
    Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6bec10f3e96a1583d30cb204ed4b49b04eb2c9a0
Author: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Date:   Tue Mar 20 07:59:13 2018 +0100

    s390/qeth: when thread completes, wake up all waiters
    
    
    [ Upstream commit 1063e432bb45be209427ed3f1ca3908e4aa3c7d7 ]
    
    qeth_wait_for_threads() is potentially called by multiple users, make
    sure to notify all of them after qeth_clear_thread_running_bit()
    adjusted the thread_running_mask. With no timeout, callers would
    otherwise stall.
    
    Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c6050863bb2414753d6e0999c03d293733061277
Author: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Date:   Tue Mar 20 07:59:12 2018 +0100

    s390/qeth: free netdevice when removing a card
    
    
    [ Upstream commit 6be687395b3124f002a653c1a50b3260222b3cd7 ]
    
    On removal, a qeth card's netdevice is currently not properly freed
    because the call chain looks as follows:
    
    qeth_core_remove_device(card)
            lx_remove_device(card)
                    unregister_netdev(card->dev)
                    card->dev = NULL                        !!!
            qeth_core_free_card(card)
                    if (card->dev)                          !!!
                            free_netdev(card->dev)
    
    Fix it by free'ing the netdev straight after unregistering. This also
    fixes the sysfs-driven layer switch case (qeth_dev_layer2_store()),
    where the need to free the current netdevice was not considered at all.
    
    Note that free_netdev() takes care of the netif_napi_del() for us too.
    
    Fixes: 4a71df50047f ("qeth: new qeth device driver")
    Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
    Reviewed-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 08c5adee2ec696be253486340a60e2216e52ec4b
Author: Arkadi Sharshevsky <arkadis@mellanox.com>
Date:   Thu Mar 8 12:42:10 2018 +0200

    team: Fix double free in error path
    
    
    [ Upstream commit cbcc607e18422555db569b593608aec26111cb0b ]
    
    The __send_and_alloc_skb() receives a skb ptr as a parameter but in
    case it fails the skb is not valid:
    - Send failed and released the skb internally.
    - Allocation failed.
    
    The current code tries to release the skb in case of failure which
    causes redundant freeing.
    
    Fixes: 9b00cf2d1024 ("team: implement multipart netlink messages for options transfers")
    Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
    Acked-by: Jiri Pirko <jiri@mellanox.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 112517ee806cf8a0614c60d86e7786c0df0fa396
Author: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Date:   Wed Mar 14 13:32:09 2018 -0700

    skbuff: Fix not waking applications when errors are enqueued
    
    
    [ Upstream commit 6e5d58fdc9bedd0255a8781b258f10bbdc63e975 ]
    
    When errors are enqueued to the error queue via sock_queue_err_skb()
    function, it is possible that the waiting application is not notified.
    
    Calling 'sk->sk_data_ready()' would not notify applications that
    selected only POLLERR events in poll() (for example).
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Reported-by: Randy E. Witt <randy.e.witt@intel.com>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4544f23db6149301fbd6596d2e670f471fbc4f78
Author: David Ahern <dsahern@gmail.com>
Date:   Fri Feb 16 11:03:03 2018 -0800

    net: Only honor ifindex in IP_PKTINFO if non-0
    
    
    [ Upstream commit 2cbb4ea7de167b02ffa63e9cdfdb07a7e7094615 ]
    
    Only allow ifindex from IP_PKTINFO to override SO_BINDTODEVICE settings
    if the index is actually set in the message.
    
    Signed-off-by: David Ahern <dsahern@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b22ad56cce33e45dbfa19b41c4d7368a5bf34bde
Author: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Date:   Wed Mar 14 21:10:23 2018 +0100

    netlink: avoid a double skb free in genlmsg_mcast()
    
    
    [ Upstream commit 02a2385f37a7c6594c9d89b64c4a1451276f08eb ]
    
    nlmsg_multicast() consumes always the skb, thus the original skb must be
    freed only when this function is called with a clone.
    
    Fixes: cb9f7a9a5c96 ("netlink: ensure to loop over all netns in genlmsg_multicast_allns()")
    Reported-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
    Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a6ca1eddd279cb9bebf83f4473e347a540f3b442
Author: Arvind Yadav <arvind.yadav.cs@gmail.com>
Date:   Tue Mar 13 16:50:06 2018 +0100

    net/iucv: Free memory obtained by kzalloc
    
    
    [ Upstream commit fa6a91e9b907231d2e38ea5ed89c537b3525df3d ]
    
    Free memory by calling put_device(), if afiucv_iucv_init is not
    successful.
    
    Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
    Reviewed-by: Cornelia Huck <cohuck@redhat.com>
    Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com>
    Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit aab60f194f488d9598067919e38e0c8633117b02
Author: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Date:   Sun Mar 18 23:59:36 2018 +0100

    net: ethernet: arc: Fix a potential memory leak if an optional regulator is deferred
    
    
    [ Upstream commit 00777fac28ba3e126b9e63e789a613e8bd2cab25 ]
    
    If the optional regulator is deferred, we must release some resources.
    They will be re-allocated when the probe function will be called again.
    
    Fixes: 6eacf31139bf ("ethernet: arc: Add support for Rockchip SoC layer device tree bindings")
    Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2e017ead9b03445338877e951334cda71ac84b65
Author: Eric Dumazet <edumazet@google.com>
Date:   Tue Mar 6 07:54:53 2018 -0800

    l2tp: do not accept arbitrary sockets
    
    
    [ Upstream commit 17cfe79a65f98abe535261856c5aef14f306dff7 ]
    
    syzkaller found an issue caused by lack of sufficient checks
    in l2tp_tunnel_create()
    
    RAW sockets can not be considered as UDP ones for instance.
    
    In another patch, we shall replace all pr_err() by less intrusive
    pr_debug() so that syzkaller can find other bugs faster.
    Acked-by: Guillaume Nault <g.nault@alphalink.fr>
    Acked-by: James Chapman <jchapman@katalix.com>
    
    ==================================================================
    BUG: KASAN: slab-out-of-bounds in setup_udp_tunnel_sock+0x3ee/0x5f0 net/ipv4/udp_tunnel.c:69
    dst_release: dst:00000000d53d0d0f refcnt:-1
    Write of size 1 at addr ffff8801d013b798 by task syz-executor3/6242
    
    CPU: 1 PID: 6242 Comm: syz-executor3 Not tainted 4.16.0-rc2+ #253
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
    Call Trace:
     __dump_stack lib/dump_stack.c:17 [inline]
     dump_stack+0x194/0x24d lib/dump_stack.c:53
     print_address_description+0x73/0x250 mm/kasan/report.c:256
     kasan_report_error mm/kasan/report.c:354 [inline]
     kasan_report+0x23b/0x360 mm/kasan/report.c:412
     __asan_report_store1_noabort+0x17/0x20 mm/kasan/report.c:435
     setup_udp_tunnel_sock+0x3ee/0x5f0 net/ipv4/udp_tunnel.c:69
     l2tp_tunnel_create+0x1354/0x17f0 net/l2tp/l2tp_core.c:1596
     pppol2tp_connect+0x14b1/0x1dd0 net/l2tp/l2tp_ppp.c:707
     SYSC_connect+0x213/0x4a0 net/socket.c:1640
     SyS_connect+0x24/0x30 net/socket.c:1621
     do_syscall_64+0x280/0x940 arch/x86/entry/common.c:287
     entry_SYSCALL_64_after_hwframe+0x42/0xb7
    
    Fixes: fd558d186df2 ("l2tp: Split pppol2tp patch into separate l2tp and ppp parts")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Reported-by: syzbot <syzkaller@googlegroups.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c2b32840e2f62938662ae102a4fe5043b92cdcb6
Author: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Date:   Thu Mar 8 17:00:02 2018 +0100

    ipv6: fix access to non-linear packet in ndisc_fill_redirect_hdr_option()
    
    
    [ Upstream commit 9f62c15f28b0d1d746734666d88a79f08ba1e43e ]
    
    Fix the following slab-out-of-bounds kasan report in
    ndisc_fill_redirect_hdr_option when the incoming ipv6 packet is not
    linear and the accessed data are not in the linear data region of orig_skb.
    
    [ 1503.122508] ==================================================================
    [ 1503.122832] BUG: KASAN: slab-out-of-bounds in ndisc_send_redirect+0x94e/0x990
    [ 1503.123036] Read of size 1184 at addr ffff8800298ab6b0 by task netperf/1932
    
    [ 1503.123220] CPU: 0 PID: 1932 Comm: netperf Not tainted 4.16.0-rc2+ #124
    [ 1503.123347] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.10.2-2.fc27 04/01/2014
    [ 1503.123527] Call Trace:
    [ 1503.123579]  <IRQ>
    [ 1503.123638]  print_address_description+0x6e/0x280
    [ 1503.123849]  kasan_report+0x233/0x350
    [ 1503.123946]  memcpy+0x1f/0x50
    [ 1503.124037]  ndisc_send_redirect+0x94e/0x990
    [ 1503.125150]  ip6_forward+0x1242/0x13b0
    [...]
    [ 1503.153890] Allocated by task 1932:
    [ 1503.153982]  kasan_kmalloc+0x9f/0xd0
    [ 1503.154074]  __kmalloc_track_caller+0xb5/0x160
    [ 1503.154198]  __kmalloc_reserve.isra.41+0x24/0x70
    [ 1503.154324]  __alloc_skb+0x130/0x3e0
    [ 1503.154415]  sctp_packet_transmit+0x21a/0x1810
    [ 1503.154533]  sctp_outq_flush+0xc14/0x1db0
    [ 1503.154624]  sctp_do_sm+0x34e/0x2740
    [ 1503.154715]  sctp_primitive_SEND+0x57/0x70
    [ 1503.154807]  sctp_sendmsg+0xaa6/0x1b10
    [ 1503.154897]  sock_sendmsg+0x68/0x80
    [ 1503.154987]  ___sys_sendmsg+0x431/0x4b0
    [ 1503.155078]  __sys_sendmsg+0xa4/0x130
    [ 1503.155168]  do_syscall_64+0x171/0x3f0
    [ 1503.155259]  entry_SYSCALL_64_after_hwframe+0x42/0xb7
    
    [ 1503.155436] Freed by task 1932:
    [ 1503.155527]  __kasan_slab_free+0x134/0x180
    [ 1503.155618]  kfree+0xbc/0x180
    [ 1503.155709]  skb_release_data+0x27f/0x2c0
    [ 1503.155800]  consume_skb+0x94/0xe0
    [ 1503.155889]  sctp_chunk_put+0x1aa/0x1f0
    [ 1503.155979]  sctp_inq_pop+0x2f8/0x6e0
    [ 1503.156070]  sctp_assoc_bh_rcv+0x6a/0x230
    [ 1503.156164]  sctp_inq_push+0x117/0x150
    [ 1503.156255]  sctp_backlog_rcv+0xdf/0x4a0
    [ 1503.156346]  __release_sock+0x142/0x250
    [ 1503.156436]  release_sock+0x80/0x180
    [ 1503.156526]  sctp_sendmsg+0xbb0/0x1b10
    [ 1503.156617]  sock_sendmsg+0x68/0x80
    [ 1503.156708]  ___sys_sendmsg+0x431/0x4b0
    [ 1503.156799]  __sys_sendmsg+0xa4/0x130
    [ 1503.156889]  do_syscall_64+0x171/0x3f0
    [ 1503.156980]  entry_SYSCALL_64_after_hwframe+0x42/0xb7
    
    [ 1503.157158] The buggy address belongs to the object at ffff8800298ab600
                    which belongs to the cache kmalloc-1024 of size 1024
    [ 1503.157444] The buggy address is located 176 bytes inside of
                    1024-byte region [ffff8800298ab600, ffff8800298aba00)
    [ 1503.157702] The buggy address belongs to the page:
    [ 1503.157820] page:ffffea0000a62a00 count:1 mapcount:0 mapping:0000000000000000 index:0x0 compound_mapcount: 0
    [ 1503.158053] flags: 0x4000000000008100(slab|head)
    [ 1503.158171] raw: 4000000000008100 0000000000000000 0000000000000000 00000001800e000e
    [ 1503.158350] raw: dead000000000100 dead000000000200 ffff880036002600 0000000000000000
    [ 1503.158523] page dumped because: kasan: bad access detected
    
    [ 1503.158698] Memory state around the buggy address:
    [ 1503.158816]  ffff8800298ab900: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    [ 1503.158988]  ffff8800298ab980: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    [ 1503.159165] >ffff8800298aba00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
    [ 1503.159338]                    ^
    [ 1503.159436]  ffff8800298aba80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    [ 1503.159610]  ffff8800298abb00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    [ 1503.159785] ==================================================================
    [ 1503.159964] Disabling lock debugging due to kernel taint
    
    The test scenario to trigger the issue consists of 4 devices:
    - H0: data sender, connected to LAN0
    - H1: data receiver, connected to LAN1
    - GW0 and GW1: routers between LAN0 and LAN1. Both of them have an
      ethernet connection on LAN0 and LAN1
    On H{0,1} set GW0 as default gateway while on GW0 set GW1 as next hop for
    data from LAN0 to LAN1.
    Moreover create an ip6ip6 tunnel between H0 and H1 and send 3 concurrent
    data streams (TCP/UDP/SCTP) from H0 to H1 through ip6ip6 tunnel (send
    buffer size is set to 16K). While data streams are active flush the route
    cache on HA multiple times.
    I have not been able to identify a given commit that introduced the issue
    since, using the reproducer described above, the kasan report has been
    triggered from 4.14 and I have not gone back further.
    
    Reported-by: Jianlin Shi <jishi@redhat.com>
    Reviewed-by: Stefano Brivio <sbrivio@redhat.com>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e717aef0e7ed299b43812cd1a2bcf5888eafad9b
Author: Alexey Kodanev <alexey.kodanev@oracle.com>
Date:   Tue Mar 6 22:57:01 2018 +0300

    dccp: check sk for closed state in dccp_sendmsg()
    
    
    [ Upstream commit 67f93df79aeefc3add4e4b31a752600f834236e2 ]
    
    dccp_disconnect() sets 'dp->dccps_hc_tx_ccid' tx handler to NULL,
    therefore if DCCP socket is disconnected and dccp_sendmsg() is
    called after it, it will cause a NULL pointer dereference in
    dccp_write_xmit().
    
    This crash and the reproducer was reported by syzbot. Looks like
    it is reproduced if commit 69c64866ce07 ("dccp: CVE-2017-8824:
    use-after-free in DCCP code") is applied.
    
    Reported-by: syzbot+f99ab3887ab65d70f816@syzkaller.appspotmail.com
    Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6ab380698a5301fa8ccf995d946351cf4047ee52
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Fri Mar 30 10:56:51 2018 +0200

    Revert "genirq: Use irqd_get_trigger_type to compare the trigger type for shared IRQs"
    
    This reverts commit 093c265afffb0a91a7611c3bb74d0883731a807b which is
    commit 382bd4de61827dbaaf5fb4fb7b1f4be4a86505e7 upstream.
    
    It causes too many problems with the stable tree, and would require too
    many other things to be backported, so just revert it.
    
    Reported-by: Guenter Roeck <linux@roeck-us.net>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Hans de Goede <hdegoede@redhat.com>
    Cc: Marc Zyngier <marc.zyngier@arm.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d9a6055e21f5f8452d77cbee0d6461b079268bca
Author: Johannes Thumshirn <jthumshirn@suse.de>
Date:   Wed May 10 09:53:40 2017 +0200

    scsi: sg: don't return bogus Sg_requests
    
    commit 48ae8484e9fc324b4968d33c585e54bc98e44d61 upstream.
    
    If the list search in sg_get_rq_mark() fails to find a valid request, we
    return a bogus element. This then can later lead to a GPF in
    sg_remove_scat().
    
    So don't return bogus Sg_requests in sg_get_rq_mark() but NULL in case
    the list search doesn't find a valid request.
    
    Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
    Reported-by: Andrey Konovalov <andreyknvl@google.com>
    Cc: Hannes Reinecke <hare@suse.de>
    Cc: Christoph Hellwig <hch@lst.de>
    Cc: Doug Gilbert <dgilbert@interlog.com>
    Reviewed-by: Hannes Reinecke <hare@suse.de>
    Acked-by: Doug Gilbert <dgilbert@interlog.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Cc: Tony Battersby <tonyb@cybernetics.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e7dc809e8042cf3d2c48ffa616941a8b11d3beba
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date:   Tue Mar 20 12:16:59 2018 -0700

    kvm/x86: fix icebp instruction handling
    
    commit 32d43cd391bacb5f0814c2624399a5dad3501d09 upstream.
    
    The undocumented 'icebp' instruction (aka 'int1') works pretty much like
    'int3' in the absense of in-circuit probing equipment (except,
    obviously, that it raises #DB instead of raising #BP), and is used by
    some validation test-suites as such.
    
    But Andy Lutomirski noticed that his test suite acted differently in kvm
    than on bare hardware.
    
    The reason is that kvm used an inexact test for the icebp instruction:
    it just assumed that an all-zero VM exit qualification value meant that
    the VM exit was due to icebp.
    
    That is not unlike the guess that do_debug() does for the actual
    exception handling case, but it's purely a heuristic, not an absolute
    rule.  do_debug() does it because it wants to ascribe _some_ reasons to
    the #DB that happened, and an empty %dr6 value means that 'icebp' is the
    most likely casue and we have no better information.
    
    But kvm can just do it right, because unlike the do_debug() case, kvm
    actually sees the real reason for the #DB in the VM-exit interruption
    information field.
    
    So instead of relying on an inexact heuristic, just use the actual VM
    exit information that says "it was 'icebp'".
    
    Right now the 'icebp' instruction isn't technically documented by Intel,
    but that will hopefully change.  The special "privileged software
    exception" information _is_ actually mentioned in the Intel SDM, even
    though the cause of it isn't enumerated.
    
    Reported-by: Andy Lutomirski <luto@kernel.org>
    Tested-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b1da147c2749874c348f6afdf67ce404a47cfe7c
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date:   Sat Mar 24 10:43:26 2018 +0100

    tty: vt: fix up tabstops properly
    
    commit f1869a890cdedb92a3fab969db5d0fd982850273 upstream.
    
    Tabs on a console with long lines do not wrap properly, so correctly
    account for the line length when computing the tab placement location.
    
    Reported-by: James Holderness <j4_james@hotmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Cc: stable <stable@vger.kernel.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 49636e34157a189e9c7f0673fe641152be6b3aa8
Author: Andri Yngvason <andri.yngvason@marel.com>
Date:   Thu Mar 15 18:23:17 2018 +0000

    can: cc770: Fix use after free in cc770_tx_interrupt()
    
    commit 9ffd7503944ec7c0ef41c3245d1306c221aef2be upstream.
    
    This fixes use after free introduced by the last cc770 patch.
    
    Signed-off-by: Andri Yngvason <andri.yngvason@marel.com>
    Fixes: 746201235b3f ("can: cc770: Fix queue stall & dropped RTR reply")
    Cc: linux-stable <stable@vger.kernel.org>
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit be889c45a879e08f1624c7fd81facf9fcb172c72
Author: Andri Yngvason <andri.yngvason@marel.com>
Date:   Wed Mar 14 11:52:57 2018 +0000

    can: cc770: Fix queue stall & dropped RTR reply
    
    commit 746201235b3f876792099079f4c6fea941d76183 upstream.
    
    While waiting for the TX object to send an RTR, an external message with a
    matching id can overwrite the TX data. In this case we must call the rx
    routine and then try transmitting the message that was overwritten again.
    
    The queue was being stalled because the RX event did not generate an
    interrupt to wake up the queue again and the TX event did not happen
    because the TXRQST flag is reset by the chip when new data is received.
    
    According to the CC770 datasheet the id of a message object should not be
    changed while the MSGVAL bit is set. This has been fixed by resetting the
    MSGVAL bit before modifying the object in the transmit function and setting
    it after. It is not enough to set & reset CPUUPD.
    
    It is important to keep the MSGVAL bit reset while the message object is
    being modified. Otherwise, during RTR transmission, a frame with matching
    id could trigger an rx-interrupt, which would cause a race condition
    between the interrupt routine and the transmit function.
    
    Signed-off-by: Andri Yngvason <andri.yngvason@marel.com>
    Tested-by: Richard Weinberger <richard@nod.at>
    Cc: linux-stable <stable@vger.kernel.org>
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit bcddd27ebfd3cb68ed306e67ed2f33d6d6175d9a
Author: Andri Yngvason <andri.yngvason@marel.com>
Date:   Wed Mar 14 11:52:56 2018 +0000

    can: cc770: Fix stalls on rt-linux, remove redundant IRQ ack
    
    commit f4353daf4905c0099fd25fa742e2ffd4a4bab26a upstream.
    
    This has been reported to cause stalls on rt-linux.
    
    Suggested-by: Richard Weinberger <richard@nod.at>
    Tested-by: Richard Weinberger <richard@nod.at>
    Signed-off-by: Andri Yngvason <andri.yngvason@marel.com>
    Cc: linux-stable <stable@vger.kernel.org>
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 43f8ff29c37bf96b918a8fa1a9a2c13d28603044
Author: Dan Carpenter <dan.carpenter@oracle.com>
Date:   Mon Mar 19 14:07:45 2018 +0300

    staging: ncpfs: memory corruption in ncp_read_kernel()
    
    commit 4c41aa24baa4ed338241d05494f2c595c885af8f upstream.
    
    If the server is malicious then *bytes_read could be larger than the
    size of the "target" buffer.  It would lead to memory corruption when we
    do the memcpy().
    
    Reported-by: Dr Silvio Cesare of InfoSect <Silvio Cesare <silvio.cesare@gmail.com>
    Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
    Cc: stable <stable@vger.kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 23c8c15439f66ed7453e6490acf7c8b86ca21557
Author: Masami Hiramatsu <mhiramat@kernel.org>
Date:   Sat Mar 17 21:38:10 2018 +0900

    tracing: probeevent: Fix to support minus offset from symbol
    
    commit c5d343b6b7badd1f5fe0873eff2e8d63a193e732 upstream.
    
    In Documentation/trace/kprobetrace.txt, it says
    
     @SYM[+|-offs] : Fetch memory at SYM +|- offs (SYM should be a data symbol)
    
    However, the parser doesn't parse minus offset correctly, since
    commit 2fba0c8867af ("tracing/kprobes: Fix probe offset to be
    unsigned") drops minus ("-") offset support for kprobe probe
    address usage.
    
    This fixes the traceprobe_split_symbol_offset() to parse minus
    offset again with checking the offset range, and add a minus
    offset check in kprobe probe address usage.
    
    Link: http://lkml.kernel.org/r/152129028983.31874.13419301530285775521.stgit@devbox
    
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Tom Zanussi <tom.zanussi@linux.intel.com>
    Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
    Cc: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
    Cc: stable@vger.kernel.org
    Fixes: 2fba0c8867af ("tracing/kprobes: Fix probe offset to be unsigned")
    Acked-by: Namhyung Kim <namhyung@kernel.org>
    Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
    Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 33a155b5e0f89cdc7105fbaa4667ffbf22bb37fe
Author: Arend Van Spriel <arend.vanspriel@broadcom.com>
Date:   Wed Feb 28 21:15:20 2018 +0100

    brcmfmac: fix P2P_DEVICE ethernet address generation
    
    commit 455f3e76cfc0d893585a5f358b9ddbe9c1e1e53b upstream.
    
    The firmware has a requirement that the P2P_DEVICE address should
    be different from the address of the primary interface. When not
    specified by user-space, the driver generates the MAC address for
    the P2P_DEVICE interface using the MAC address of the primary
    interface and setting the locally administered bit. However, the MAC
    address of the primary interface may already have that bit set causing
    the creation of the P2P_DEVICE interface to fail with -EBUSY. Fix this
    by using a random address instead to determine the P2P_DEVICE address.
    
    Cc: stable@vger.kernel.org # 3.10.y
    Reported-by: Hans de Goede <hdegoede@redhat.com>
    Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
    Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
    Reviewed-by: Franky Lin <franky.lin@broadcom.com>
    Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6949153ccb2fde17fb76e1ebcfdb8f5727dc58d1
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Wed Mar 21 16:45:53 2018 +0100

    drm: udl: Properly check framebuffer mmap offsets
    
    commit 3b82a4db8eaccce735dffd50b4d4e1578099b8e8 upstream.
    
    The memmap options sent to the udl framebuffer driver were not being
    checked for all sets of possible crazy values.  Fix this up by properly
    bounding the allowed values.
    
    Reported-by: Eyal Itkin <eyalit@checkpoint.com>
    Cc: stable <stable@vger.kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
    Link: https://patchwork.freedesktop.org/patch/msgid/20180321154553.GA18454@kroah.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 897e06d03877c2f330111be98b59a6c8b3b693dc
Author: Hans de Goede <hdegoede@redhat.com>
Date:   Mon Mar 19 16:34:00 2018 +0100

    libata: Modify quirks for MX100 to limit NCQ_TRIM quirk to MU01 version
    
    commit d418ff56b8f2d2b296daafa8da151fe27689b757 upstream.
    
    When commit 9c7be59fc519af ("libata: Apply NOLPM quirk to Crucial MX100
    512GB SSDs") was added it inherited the ATA_HORKAGE_NO_NCQ_TRIM quirk
    from the existing "Crucial_CT*MX100*" entry, but that entry sets model_rev
    to "MU01", where as the entry adding the NOLPM quirk sets it to NULL.
    
    This means that after this commit we no apply the NO_NCQ_TRIM quirk to
    all "Crucial_CT512MX100*" SSDs even if they have the fixed "MU02"
    firmware. This commit splits the "Crucial_CT512MX100*" quirk into 2
    quirks, one for the "MU01" firmware and one for all other firmware
    versions, so that we once again only apply the NO_NCQ_TRIM quirk to the
    "MU01" firmware version.
    
    Fixes: 9c7be59fc519af ("libata: Apply NOLPM quirk to ... MX100 512GB SSDs")
    Cc: stable@vger.kernel.org
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Tejun Heo <tj@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c77c783b532daf469b45a7cf1d0684d9031db3e1
Author: Hans de Goede <hdegoede@redhat.com>
Date:   Mon Mar 19 16:33:59 2018 +0100

    libata: Make Crucial BX100 500GB LPM quirk apply to all firmware versions
    
    commit 3bf7b5d6d017c27e0d3b160aafb35a8e7cfeda1f upstream.
    
    Commit b17e5729a630 ("libata: disable LPM for Crucial BX100 SSD 500GB
    drive"), introduced a ATA_HORKAGE_NOLPM quirk for Crucial BX100 500GB SSDs
    but limited this to the MU02 firmware version, according to:
    http://www.crucial.com/usa/en/support-ssd-firmware
    
    MU02 is the last version, so there are no newer possibly fixed versions
    and if the MU02 version has broken LPM then the MU01 almost certainly
    also has broken LPM, so this commit changes the quirk to apply to all
    firmware versions.
    
    Fixes: b17e5729a630 ("libata: disable LPM for Crucial BX100 SSD 500GB...")
    Cc: stable@vger.kernel.org
    Cc: Kai-Heng Feng <kai.heng.feng@canonical.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Tejun Heo <tj@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 34b98861806eba4d20694a72ceee084794c7146b
Author: Hans de Goede <hdegoede@redhat.com>
Date:   Mon Mar 19 16:33:58 2018 +0100

    libata: Apply NOLPM quirk to Crucial M500 480 and 960GB SSDs
    
    commit 62ac3f7305470e3f52f159de448bc1a771717e88 upstream.
    
    There have been reports of the Crucial M500 480GB model not working
    with LPM set to min_power / med_power_with_dipm level.
    
    It has not been tested with medium_power, but that typically has no
    measurable power-savings.
    
    Note the reporters Crucial_CT480M500SSD3 has a firmware version of MU03
    and there is a MU05 update available, but that update does not mention any
    LPM fixes in its changelog, so the quirk matches all firmware versions.
    
    In my experience the LPM problems with (older) Crucial SSDs seem to be
    limited to higher capacity versions of the SSDs (different firmware?),
    so this commit adds a NOLPM quirk for the 480 and 960GB versions of the
    M500, to avoid LPM causing issues with these SSDs.
    
    Cc: stable@vger.kernel.org
    Reported-and-tested-by: Martin Steigerwald <martin@lichtvoll.de>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Tejun Heo <tj@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d829e3ad277a9fa8f1aede7d1619b3a0b00ef81f
Author: Ju Hyung Park <qkrwngud825@gmail.com>
Date:   Sun Mar 11 02:28:35 2018 +0900

    libata: Enable queued TRIM for Samsung SSD 860
    
    commit ca6bfcb2f6d9deab3924bf901e73622a94900473 upstream.
    
    Samsung explicitly states that queued TRIM is supported for Linux with
    860 PRO and 860 EVO.
    
    Make the previous blacklist to cover only 840 and 850 series.
    
    Signed-off-by: Park Ju Hyung <qkrwngud825@gmail.com>
    Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Tejun Heo <tj@kernel.org>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3fcf9215889144f5b89164b62ad286ec4d353704
Author: Kai-Heng Feng <kai.heng.feng@canonical.com>
Date:   Sun Feb 18 22:17:09 2018 +0800

    libata: disable LPM for Crucial BX100 SSD 500GB drive
    
    commit b17e5729a630d8326a48ec34ef02e6b4464a6aef upstream.
    
    After Laptop Mode Tools starts to use min_power for LPM, a user found
    out Crucial BX100 SSD can't get mounted.
    
    Crucial BX100 SSD 500GB drive don't work well with min_power. This also
    happens to med_power_with_dipm.
    
    So let's disable LPM for Crucial BX100 SSD 500GB drive.
    
    BugLink: https://bugs.launchpad.net/bugs/1726930
    Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
    Signed-off-by: Tejun Heo <tj@kernel.org>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ec5a70a81cd28bf3428611f16e004633291c4dce
Author: Hans de Goede <hdegoede@redhat.com>
Date:   Fri Feb 16 10:48:20 2018 +0100

    libata: Apply NOLPM quirk to Crucial MX100 512GB SSDs
    
    commit 9c7be59fc519af9081c46c48f06f2b8fadf55ad8 upstream.
    
    Various people have reported the Crucial MX100 512GB model not working
    with LPM set to min_power. I've now received a report that it also does
    not work with the new med_power_with_dipm level.
    
    It does work with medium_power, but that has no measurable power-savings
    and given the amount of people being bitten by the other levels not
    working, this commit just disables LPM altogether.
    
    Note all reporters of this have either the 512GB model (max capacity), or
    are not specifying their SSD's size. So for now this quirk assumes this is
    a problem with the 512GB model only.
    
    Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=89261
    Buglink: https://github.com/linrunner/TLP/issues/84
    Cc: stable@vger.kernel.org
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Tejun Heo <tj@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 83c164363b8a891cc8d3a3abdfce79ba3956059e
Author: Eric Biggers <ebiggers@google.com>
Date:   Sat Feb 3 20:33:27 2018 -0800

    libata: remove WARN() for DMA or PIO command without data
    
    commit 9173e5e80729c8434b8d27531527c5245f4a5594 upstream.
    
    syzkaller hit a WARN() in ata_qc_issue() when writing to /dev/sg0.  This
    happened because it issued a READ_6 command with no data buffer.
    
    Just remove the WARN(), as it doesn't appear indicate a kernel bug.  The
    expected behavior is to fail the command, which the code does.
    
    Here's a reproducer that works in QEMU when /dev/sg0 refers to a disk of
    the default type ("82371SB PIIX3 IDE"):
    
        #include <fcntl.h>
        #include <unistd.h>
    
        int main()
        {
                char buf[42] = { [36] = 0x8 /* READ_6 */ };
    
                write(open("/dev/sg0", O_RDWR), buf, sizeof(buf));
        }
    
    Fixes: f92a26365a72 ("libata: change ATA_QCFLAG_DMAMAP semantics")
    Reported-by: syzbot+f7b556d1766502a69d85071d2ff08bd87be53d0f@syzkaller.appspotmail.com
    Cc: <stable@vger.kernel.org> # v2.6.25+
    Signed-off-by: Eric Biggers <ebiggers@google.com>
    Signed-off-by: Tejun Heo <tj@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 72e377fb1b0b42016abe1f923e7a6ccbdc81cc60
Author: Eric Biggers <ebiggers@google.com>
Date:   Sat Feb 3 20:30:56 2018 -0800

    libata: fix length validation of ATAPI-relayed SCSI commands
    
    commit 058f58e235cbe03e923b30ea7c49995a46a8725f upstream.
    
    syzkaller reported a crash in ata_bmdma_fill_sg() when writing to
    /dev/sg1.  The immediate cause was that the ATA command's scatterlist
    was not DMA-mapped, which causes 'pi - 1' to underflow, resulting in a
    write to 'qc->ap->bmdma_prd[0xffffffff]'.
    
    Strangely though, the flag ATA_QCFLAG_DMAMAP was set in qc->flags.  The
    root cause is that when __ata_scsi_queuecmd() is preparing to relay a
    SCSI command to an ATAPI device, it doesn't correctly validate the CDB
    length before copying it into the 16-byte buffer 'cdb' in 'struct
    ata_queued_cmd'.  Namely, it validates the fixed CDB length expected
    based on the SCSI opcode but not the actual CDB length, which can be
    larger due to the use of the SG_NEXT_CMD_LEN ioctl.  Since 'flags' is
    the next member in ata_queued_cmd, a buffer overflow corrupts it.
    
    Fix it by requiring that the actual CDB length be <= 16 (ATAPI_CDB_LEN).
    
    [Really it seems the length should be required to be <= dev->cdb_len,
    but the current behavior seems to have been intentionally introduced by
    commit 607126c2a21c ("libata-scsi: be tolerant of 12-byte ATAPI commands
    in 16-byte CDBs") to work around a userspace bug in mplayer.  Probably
    the workaround is no longer needed (mplayer was fixed in 2007), but
    continuing to allow lengths to up 16 appears harmless for now.]
    
    Here's a reproducer that works in QEMU when /dev/sg1 refers to the
    CD-ROM drive that qemu-system-x86_64 creates by default:
    
        #include <fcntl.h>
        #include <sys/ioctl.h>
        #include <unistd.h>
    
        #define SG_NEXT_CMD_LEN 0x2283
    
        int main()
        {
                char buf[53] = { [36] = 0x7e, [52] = 0x02 };
                int fd = open("/dev/sg1", O_RDWR);
                ioctl(fd, SG_NEXT_CMD_LEN, &(int){ 17 });
                write(fd, buf, sizeof(buf));
        }
    
    The crash was:
    
        BUG: unable to handle kernel paging request at ffff8cb97db37ffc
        IP: ata_bmdma_fill_sg drivers/ata/libata-sff.c:2623 [inline]
        IP: ata_bmdma_qc_prep+0xa4/0xc0 drivers/ata/libata-sff.c:2727
        PGD fb6c067 P4D fb6c067 PUD 0
        Oops: 0002 [#1] SMP
        CPU: 1 PID: 150 Comm: syz_ata_bmdma_q Not tainted 4.15.0-next-20180202 #99
        Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.11.0-20171110_100015-anatol 04/01/2014
        [...]
        Call Trace:
         ata_qc_issue+0x100/0x1d0 drivers/ata/libata-core.c:5421
         ata_scsi_translate+0xc9/0x1a0 drivers/ata/libata-scsi.c:2024
         __ata_scsi_queuecmd drivers/ata/libata-scsi.c:4326 [inline]
         ata_scsi_queuecmd+0x8c/0x210 drivers/ata/libata-scsi.c:4375
         scsi_dispatch_cmd+0xa2/0xe0 drivers/scsi/scsi_lib.c:1727
         scsi_request_fn+0x24c/0x530 drivers/scsi/scsi_lib.c:1865
         __blk_run_queue_uncond block/blk-core.c:412 [inline]
         __blk_run_queue+0x3a/0x60 block/blk-core.c:432
         blk_execute_rq_nowait+0x93/0xc0 block/blk-exec.c:78
         sg_common_write.isra.7+0x272/0x5a0 drivers/scsi/sg.c:806
         sg_write+0x1ef/0x340 drivers/scsi/sg.c:677
         __vfs_write+0x31/0x160 fs/read_write.c:480
         vfs_write+0xa7/0x160 fs/read_write.c:544
         SYSC_write fs/read_write.c:589 [inline]
         SyS_write+0x4d/0xc0 fs/read_write.c:581
         do_syscall_64+0x5e/0x110 arch/x86/entry/common.c:287
         entry_SYSCALL_64_after_hwframe+0x21/0x86
    
    Fixes: 607126c2a21c ("libata-scsi: be tolerant of 12-byte ATAPI commands in 16-byte CDBs")
    Reported-by: syzbot+1ff6f9fcc3c35f1c72a95e26528c8e7e3276e4da@syzkaller.appspotmail.com
    Cc: <stable@vger.kernel.org> # v2.6.24+
    Signed-off-by: Eric Biggers <ebiggers@google.com>
    Signed-off-by: Tejun Heo <tj@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d850931005ff6e5dde77b1375ff8ce0a332cb24d
Author: Takashi Iwai <tiwai@suse.de>
Date:   Thu Mar 22 10:40:27 2018 +0100

    ALSA: aloop: Fix access to not-yet-ready substream via cable
    
    commit 8e6b1a72a75bb5067ccb6b56d8ca4aa3a300a64e upstream.
    
    In loopback_open() and loopback_close(), we assign and release the
    substream object to the corresponding cable in a racy way.  It's
    neither locked nor done in the right position.  The open callback
    assigns the substream before its preparation finishes, hence the other
    side of the cable may pick it up, which may lead to the invalid memory
    access.
    
    This patch addresses these: move the assignment to the end of the open
    callback, and wrap with cable->lock for avoiding concurrent accesses.
    
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e88d13e367f26bd2623ff428fcfbf5d3d15e3ad6
Author: Takashi Iwai <tiwai@suse.de>
Date:   Thu Mar 22 08:56:06 2018 +0100

    ALSA: aloop: Sync stale timer before release
    
    commit 67a01afaf3d34893cf7d2ea19b34555d6abb7cb0 upstream.
    
    The aloop driver tries to stop the pending timer via timer_del() in
    the trigger callback and in the close callback.  The former is
    correct, as it's an atomic operation, while the latter expects that
    the timer gets really removed and proceeds the resource releases after
    that.  But timer_del() doesn't synchronize, hence the running timer
    may still access the released resources.
    
    A similar situation can be also seen in the prepare callback after
    trigger(STOP) where the prepare tries to re-initialize the things
    while a timer is still running.
    
    The problems like the above are seen indirectly in some syzkaller
    reports (although it's not 100% clear whether this is the only cause,
    as the race condition is quite narrow and not always easy to
    trigger).
    
    For addressing these issues, this patch adds the explicit alls of
    timer_del_sync() in some places, so that the pending timer is properly
    killed / synced.
    
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 02dd9876ab94bc045c115c14177088ae3bdfb152
Author: Kirill Marinushkin <k.marinushkin@gmail.com>
Date:   Mon Mar 19 07:11:08 2018 +0100

    ALSA: usb-audio: Fix parsing descriptor of UAC2 processing unit
    
    commit a6618f4aedb2b60932d766bd82ae7ce866e842aa upstream.
    
    Currently, the offsets in the UAC2 processing unit descriptor are
    calculated incorrectly. It causes an issue when connecting the device which
    provides such a feature:
    
    ~~~~
    [84126.724420] usb 1-1.3.1: invalid Processing Unit descriptor (id 18)
    ~~~~
    
    After this patch is applied, the UAC2 processing unit inits w/o this error.
    
    Fixes: 23caaf19b11e ("ALSA: usb-mixer: Add support for Audio Class v2.0")
    Signed-off-by: Kirill Marinushkin <k.marinushkin@gmail.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>