commit 8eb1ef076bab4bd4975922a06bdffa3d40c4197c
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Wed May 30 07:47:45 2018 +0200

    Linux 3.18.111

commit 96239f4958ec255e9014eec5d1751d9526334ff3
Author: Randy Dunlap <rdunlap@infradead.org>
Date:   Fri Dec 8 10:19:19 2017 -0800

    kdb: make "mdr" command repeat
    
    [ Upstream commit 1e0ce03bf142454f38a5fc050bf4fd698d2d36d8 ]
    
    The "mdr" command should repeat (continue) when only Enter/Return
    is pressed, so make it do so.
    
    Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
    Cc: Daniel Thompson <daniel.thompson@linaro.org>
    Cc: Jason Wessel <jason.wessel@windriver.com>
    Cc: kgdb-bugreport@lists.sourceforge.net
    Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4543d30f548425ea6d334c56d0bcbe2db27470d3
Author: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Date:   Fri Jan 26 23:13:44 2018 +0100

    regulator: of: Add a missing 'of_node_put()' in an error handling path of 'of_regulator_match()'
    
    [ Upstream commit 30966861a7a2051457be8c49466887d78cc47e97 ]
    
    If an unlikely failure in 'of_get_regulator_init_data()' occurs, we must
    release the reference on the current 'child' node before returning.
    
    Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2c5716056c062806467289d360296a6dfc556446
Author: James Smart <jsmart2021@gmail.com>
Date:   Tue Jan 30 15:58:45 2018 -0800

    scsi: lpfc: Fix frequency of Release WQE CQEs
    
    [ Upstream commit 04673e38f56b30cd39b1fa0f386137d818b17781 ]
    
    The driver controls when the hardware sends completions that communicate
    consumption of elements from the WQ. This is done by setting a WQEC bit
    on a WQE.
    
    The current driver sets it on every Nth WQE posting. However, the driver
    isn't clearing the bit if the WQE is reused. Thus, if the queue depth
    isn't evenly divisible by N, with enough time, it can be set on every
    element, creating a lot of overhead and risking CQ full conditions.
    
    Correct by clearing the bit when not setting it on an Nth element.
    
    Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
    Signed-off-by: James Smart <james.smart@broadcom.com>
    Reviewed-by: Hannes Reinecke <hare@suse.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 093feb209e7a26ad09332f71ace59fb7169890dd
Author: James Smart <jsmart2021@gmail.com>
Date:   Tue Jan 30 15:58:54 2018 -0800

    scsi: lpfc: Fix soft lockup in lpfc worker thread during LIP testing
    
    [ Upstream commit 161df4f09987ae2e9f0f97f0b38eee298b4a39ff ]
    
    During link bounce testing in a point-to-point topology, the host may
    enter a soft lockup on the lpfc_worker thread:
    
        Call Trace:
         lpfc_work_done+0x1f3/0x1390 [lpfc]
         lpfc_do_work+0x16f/0x180 [lpfc]
         kthread+0xc7/0xe0
         ret_from_fork+0x3f/0x70
    
    The driver was simultaneously setting a combination of flags that caused
    lpfc_do_work()to effectively spin between slow path work and new event
    data, causing the lockup.
    
    Ensure in the typical wq completions, that new event data flags are set
    if the slow path flag is running. The slow path will eventually
    reschedule the wq handling.
    
    Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
    Signed-off-by: James Smart <james.smart@broadcom.com>
    Reviewed-by: Hannes Reinecke <hare@suse.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 26faa84a26dcfe3c118f54092792e437d9de52b3
Author: James Smart <jsmart2021@gmail.com>
Date:   Tue Jan 30 15:58:55 2018 -0800

    scsi: lpfc: Fix issue_lip if link is disabled
    
    [ Upstream commit 2289e9598dde9705400559ca2606fb8c145c34f0 ]
    
    The driver ignored checks on whether the link should be kept
    administratively down after a link bounce. Correct the checks.
    
    Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
    Signed-off-by: James Smart <james.smart@broadcom.com>
    Reviewed-by: Hannes Reinecke <hare@suse.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 90059d0cdbc49b8ac95bae53407a25b2588a45aa
Author: Richard Haines <richard_c_haines@btinternet.com>
Date:   Mon Nov 13 20:54:22 2017 +0000

    netlabel: If PF_INET6, check sk_buff ip header version
    
    [ Upstream commit 213d7f94775322ba44e0bbb55ec6946e9de88cea ]
    
    When resolving a fallback label, check the sk_buff version as it
    is possible (e.g. SCTP) to have family = PF_INET6 while
    receiving ip_hdr(skb)->version = 4.
    
    Signed-off-by: Richard Haines <richard_c_haines@btinternet.com>
    Acked-by: Paul Moore <paul@paul-moore.com>
    Signed-off-by: Paul Moore <paul@paul-moore.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ba0c7ae12dac69184c867c683be40025ce613429
Author: Richard Guy Briggs <rgb@redhat.com>
Date:   Wed Feb 21 04:30:07 2018 -0500

    audit: return on memory error to avoid null pointer dereference
    
    [ Upstream commit 23138ead270045f1b3e912e667967b6094244999 ]
    
    If there is a memory allocation error when trying to change an audit
    kernel feature value, the ignored allocation error will trigger a NULL
    pointer dereference oops on subsequent use of that pointer.  Return
    instead.
    
    Passes audit-testsuite.
    See: https://github.com/linux-audit/audit-kernel/issues/76
    
    Signed-off-by: Richard Guy Briggs <rgb@redhat.com>
    [PM: not necessary (other funcs check for NULL), but a good practice]
    Signed-off-by: Paul Moore <paul@paul-moore.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 11d549e721f118a86bef1d49309a0599b1080e8e
Author: Andrzej Hajda <a.hajda@samsung.com>
Date:   Fri Feb 16 15:57:48 2018 +0100

    clk: samsung: exynos3250: Fix PLL rates
    
    [ Upstream commit a8321e7887410a2b2e80ab89d1ef7b30562658ea ]
    
    Rates declared in PLL rate tables should match exactly rates calculated
    from PLL coefficients. If that is not the case, rate of the PLL's child clock
    might be set not as expected. For instance, if in the PLL rates table we have
    a 393216000 Hz entry and the real value as returned by the PLL's recalc_rate
    callback is 393216003, after setting PLL's clk rate to 393216000 clk_get_rate
    will return 393216003. If we now attempt to set rate of a PLL's child divider
    clock to 393216000/2 its rate will be 131072001, rather than 196608000.
    That is, the divider will be set to 3 instead of 2, because 393216003/2 is
    greater than 196608000.
    
    To fix this issue declared rates are changed to exactly match rates generated
    by the PLL, as calculated from the P, M, S, K coefficients.
    
    In this patch an erroneous P value for 74176002 output frequency is also
    corrected.
    
    Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
    Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
    Acked-by: Tomasz Figa <tomasz.figa@gmail.com>
    Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f114cce5badacfba7c84a1f786d2a61e8052ce7a
Author: Andrzej Hajda <a.hajda@samsung.com>
Date:   Fri Feb 16 15:57:49 2018 +0100

    clk: samsung: exynos5250: Fix PLL rates
    
    [ Upstream commit 2ac051eeabaa411ef89ae7cd5bb8e60cb41ad780 ]
    
    Rates declared in PLL rate tables should match exactly rates calculated
    from PLL coefficients. If that is not the case, rate of the PLL's child clock
    might be set not as expected. For instance, if in the PLL rates table we have
    a 393216000 Hz entry and the real value as returned by the PLL's recalc_rate
    callback is 393216003, after setting PLL's clk rate to 393216000 clk_get_rate
    will return 393216003. If we now attempt to set rate of a PLL's child divider
    clock to 393216000/2 its rate will be 131072001, rather than 196608000.
    That is, the divider will be set to 3 instead of 2, because 393216003/2 is
    greater than 196608000.
    
    To fix this issue declared rates are changed to exactly match rates generated
    by the PLL, as calculated from the P, M, S, K coefficients.
    
    Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
    Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
    Acked-by: Tomasz Figa <tomasz.figa@gmail.com>
    Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a5314e0de5380dd7625c64e10d7cae7086109990
Author: Andrzej Hajda <a.hajda@samsung.com>
Date:   Fri Feb 16 15:57:50 2018 +0100

    clk: samsung: exynos5260: Fix PLL rates
    
    [ Upstream commit cdb68fbd4e7962be742c4f29475220c5bf28d8a5 ]
    
    Rates declared in PLL rate tables should match exactly rates calculated from
    the PLL coefficients. If that is not the case, rate of the PLL's child clock
    might be set not as expected. For instance, if in the PLL rates table we have
    a 393216000 Hz entry and the real value as returned by the PLL's recalc_rate
    callback is 393216003, after setting PLL's clk rate to 393216000 clk_get_rate
    will return 393216003. If we now attempt to set rate of a PLL's child divider
    clock to 393216000/2 its rate will be 131072001, rather than 196608000.
    That is, the divider will be set to 3 instead of 2, because 393216003/2 is
    greater than 196608000.
    
    To fix this issue declared rates are changed to exactly match rates generated
    by the PLL, as calculated from the P, M, S, K coefficients.
    
    Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
    Acked-by: Tomasz Figa <tomasz.figa@gmail.com>
    Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
    Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 531722228a23234b459e1b7de176f82f129f05d2
Author: Andrzej Hajda <a.hajda@samsung.com>
Date:   Fri Feb 16 15:57:53 2018 +0100

    clk: samsung: s3c2410: Fix PLL rates
    
    [ Upstream commit 179db533c08431f509a3823077549773d519358b ]
    
    Rates declared in PLL rate tables should match exactly rates calculated from
    the PLL coefficients. If that is not the case, rate of the PLL's child clock
    might be set not as expected. For instance, if in the PLL rates table we have
    a 393216000 Hz entry and the real value as returned by the PLL's recalc_rate
    callback is 393216003, after setting PLL's clk rate to 393216000 clk_get_rate
    will return 393216003. If we now attempt to set rate of a PLL's child divider
    clock to 393216000/2 its rate will be 131072001, rather than 196608000.
    That is, the divider will be set to 3 instead of 2, because 393216003/2 is
    greater than 196608000.
    
    To fix this issue declared rates are changed to exactly match rates generated
    by the PLL, as calculated from the P, M, S, K coefficients.
    
    Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
    Acked-by: Tomasz Figa <tomasz.figa@gmail.com>
    Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
    Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 225f6c4c7a53fdbf4c3df1a9c0167b6159075fff
Author: Colin Ian King <colin.king@canonical.com>
Date:   Wed Jan 31 12:33:09 2018 -0500

    media: cx25821: prevent out-of-bounds read on array card
    
    [ Upstream commit 67300abdbe9f1717532aaf4e037222762716d0f6 ]
    
    Currently an out of range dev->nr is detected by just reporting the
    issue and later on an out-of-bounds read on array card occurs because
    of this. Fix this by checking the upper range of dev->nr with the size
    of array card (removes the hard coded size), move this check earlier
    and also exit with the error -ENOSYS to avoid the later out-of-bounds
    array read.
    
    Detected by CoverityScan, CID#711191 ("Out-of-bounds-read")
    
    Fixes: commit 02b20b0b4cde ("V4L/DVB (12730): Add conexant cx25821 driver")
    
    Signed-off-by: Colin Ian King <colin.king@canonical.com>
    Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
    [hans.verkuil@cisco.com: %ld -> %zd]
    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 e9973931f57a8f8490d654124f26a95ba8ae78aa
Author: Jan Kara <jack@suse.cz>
Date:   Thu Feb 22 10:39:52 2018 +0100

    udf: Provide saner default for invalid uid / gid
    
    [ Upstream commit 116e5258e4115aca0c64ac0bf40ded3b353ed626 ]
    
    Currently when UDF filesystem is recorded without uid / gid (ids are set
    to -1), we will assign INVALID_[UG]ID to vfs inode unless user uses uid=
    and gid= mount options. In such case filesystem could not be modified in
    any way as VFS refuses to modify files with invalid ids (even by root).
    This is confusing to users and not very useful default since such media
    mode is generally used for removable media. Use overflow[ug]id instead
    so that at least root can modify the filesystem.
    
    Reported-by: Steve Kenton <skenton@ou.edu>
    Reviewed-by: Pali Rohár <pali.rohar@gmail.com>
    Signed-off-by: Jan Kara <jack@suse.cz>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5771618d5c851811736b18ceaea7cb24ec1316d7
Author: Thomas Vincent-Cross <me@tvc.id.au>
Date:   Tue Feb 27 20:20:36 2018 +1100

    PCI: Add function 1 DMA alias quirk for Marvell 88SE9220
    
    [ Upstream commit 832e4e1f76b8a84991e9db56fdcef1ebce839b8b ]
    
    Add Marvell 88SE9220 DMA quirk as found and tested on bug 42679.
    
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=42679
    Signed-off-by: Thomas Vincent-Cross <me@tvc.id.au>
    Signed-off-by: Bjorn Helgaas <helgaas@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8bdc529a73b72b7c2b6844d7eeb731b6369548e3
Author: Geert Uytterhoeven <geert+renesas@glider.be>
Date:   Fri Feb 23 14:38:29 2018 +0100

    serial: arc_uart: Fix out-of-bounds access through DT alias
    
    [ Upstream commit f9f5786987e81d166c60833edcb7d1836aa16944 ]
    
    The arc_uart_ports[] array is indexed using a value derived from the
    "serialN" alias in DT, which may lead to an out-of-bounds access.
    
    Fix this by adding a range check.
    
    Note that the array size is defined by a Kconfig symbol
    (CONFIG_SERIAL_ARC_NR_PORTS), so this can even be triggered using a
    legitimate DTB.
    
    Fixes: ea28fd56fcde69af ("serial/arc-uart: switch to devicetree based probing")
    Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e70f6af6d7dd1fc2d4c9d7a0e58f69a216faeb0e
Author: Geert Uytterhoeven <geert+renesas@glider.be>
Date:   Fri Feb 23 14:38:30 2018 +0100

    serial: fsl_lpuart: Fix out-of-bounds access through DT alias
    
    [ Upstream commit ffab87fdecc655cc676f8be8dd1a2c5e22bd6d47 ]
    
    The lpuart_ports[] array is indexed using a value derived from the
    "serialN" alias in DT, which may lead to an out-of-bounds access.
    
    Fix this by adding a range check.
    
    Fixes: c9e2e946fb0ba5d2 ("tty: serial: add Freescale lpuart driver support")
    Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3f7945cbd3b5585842e66deda18f8e927fff66d2
Author: Geert Uytterhoeven <geert+renesas@glider.be>
Date:   Fri Feb 23 14:38:31 2018 +0100

    serial: imx: Fix out-of-bounds access through serial port index
    
    [ Upstream commit 5673444821406dda5fc25e4b52aca419f8065a19 ]
    
    The imx_ports[] array is indexed using a value derived from the
    "serialN" alias in DT, or from platform data, which may lead to an
    out-of-bounds access.
    
    Fix this by adding a range check.
    
    Fixes: ff05967a07225ab6 ("serial/imx: add of_alias_get_id() reference back")
    Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
    Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 580bcda86523d6384ffc596e2cf3c13aad233361
Author: Geert Uytterhoeven <geert+renesas@glider.be>
Date:   Fri Feb 23 14:38:34 2018 +0100

    serial: samsung: Fix out-of-bounds access through serial port index
    
    [ Upstream commit 49ee23b71877831ac087d6083f6f397dc19c9664 ]
    
    The s3c24xx_serial_ports[] array is indexed using a value derived from
    the "serialN" alias in DT, or from an incrementing probe index, which
    may lead to an out-of-bounds access.
    
    Fix this by adding a range check.
    
    Note that the array size is defined by a Kconfig symbol
    (CONFIG_SERIAL_SAMSUNG_UARTS), so this can even be triggered using
    a legitimate DTB or legitimate board code.
    
    Fixes: 13a9f6c64fdc55eb ("serial: samsung: Consider DT alias when probing ports")
    Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8984c7441dc8f1c3ea0ea182a861f8e7f4d704e8
Author: Geert Uytterhoeven <geert+renesas@glider.be>
Date:   Fri Feb 23 14:38:37 2018 +0100

    serial: xuartps: Fix out-of-bounds access through DT alias
    
    [ Upstream commit e7d75e18d0fc3f7193b65282b651f980c778d935 ]
    
    The cdns_uart_port[] array is indexed using a value derived from the
    "serialN" alias in DT, which may lead to an out-of-bounds access.
    
    Fix this by adding a range check.
    
    Fixes: 928e9263492069ee ("tty: xuartps: Initialize ports according to aliases")
    Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
    Reviewed-by: Michal Simek <michal.simek@xilinx.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 75d852e568ed75f214d80ff0abc3e80cdb118625
Author: Colin Ian King <colin.king@canonical.com>
Date:   Thu Feb 15 19:36:14 2018 +0000

    rtc: tx4939: avoid unintended sign extension on a 24 bit shift
    
    [ Upstream commit 347876ad47b9923ce26e686173bbf46581802ffa ]
    
    The shifting of buf[5] by 24 bits to the left will be promoted to
    a 32 bit signed int and then sign-extended to an unsigned long. If
    the top bit of buf[5] is set then all then all the upper bits sec
    end up as also being set because of the sign-extension. Fix this by
    casting buf[5] to an unsigned long before the shift.
    
    Detected by CoverityScan, CID#1465292 ("Unintended sign extension")
    
    Fixes: 0e1492330cd2 ("rtc: add rtc-tx4939 driver")
    Signed-off-by: Colin Ian King <colin.king@canonical.com>
    Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3c31faa6d40e1deec0289d8535075ff701adba2b
Author: Colin Ian King <colin.king@canonical.com>
Date:   Wed Feb 28 11:28:49 2018 +0000

    staging: rtl8192u: return -ENOMEM on failed allocation of priv->oldaddr
    
    [ Upstream commit e1a7418529e33bc4efc346324557251a16a3e79b ]
    
    Currently the allocation of priv->oldaddr is not null checked which will
    lead to subsequent errors when accessing priv->oldaddr.  Fix this with
    a null pointer check and a return of -ENOMEM on allocation failure.
    
    Detected with Coccinelle:
    drivers/staging/rtl8192u/r8192U_core.c:1708:2-15: alloc with no test,
    possible model on line 1723
    
    Fixes: 8fc8598e61f6 ("Staging: Added Realtek rtl8192u driver to staging")
    Signed-off-by: Colin Ian King <colin.king@canonical.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9215e5a5af24a0e979f30faea9cf229fc8bbc4f1
Author: Brad Love <brad@nextdimension.cc>
Date:   Thu Jan 4 19:04:13 2018 -0500

    media: em28xx: USB bulk packet size fix
    
    [ Upstream commit c7c7e8d7803406daa21e96d00c357de8b77b6764 ]
    
    Hauppauge em28xx bulk devices exhibit continuity errors and corrupted
    packets, when run in VMWare virtual machines. Unknown if other
    manufacturers bulk models exhibit the same issue. KVM/Qemu is unaffected.
    
    According to documentation the maximum packet multiplier for em28xx in bulk
    transfer mode is 256 * 188 bytes. This changes the size of bulk transfers
    to maximum supported value and have a bonus beneficial alignment.
    
    Before:
    
    After:
    
    This sets up USB to expect just as many bytes as the em28xx is set to emit.
    
    Successful usage under load afterwards natively and in both VMWare
    and KVM/Qemu virtual machines.
    
    Signed-off-by: Brad Love <brad@nextdimension.cc>
    Reviewed-by: Michael Ira Krufky <mkrufky@linuxtv.org>
    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 f8c61fea834591cdb887b8ca2b60f761d42982b7
Author: Qi Hou <qi.hou@windriver.com>
Date:   Tue Mar 6 09:13:37 2018 +0800

    dmaengine: pl330: fix a race condition in case of threaded irqs
    
    [ Upstream commit a3ca831249ca8c4c226e4ceafee04e280152e59d ]
    
    When booting up with "threadirqs" in command line, all irq handlers of the DMA
    controller pl330 will be threaded forcedly. These threads will race for the same
    list, pl330->req_done.
    
    Before the callback, the spinlock was released. And after it, the spinlock was
    taken. This opened an race window where another threaded irq handler could steal
    the spinlock and be permitted to delete entries of the list, pl330->req_done.
    
    If the later deleted an entry that was still referred to by the former, there would
    be a kernel panic when the former was scheduled and tried to get the next sibling
    of the deleted entry.
    
    The scenario could be depicted as below:
    
      Thread: T1  pl330->req_done  Thread: T2
          |             |              |
          |          -A-B-C-D-         |
        Locked          |              |
          |             |           Waiting
        Del A           |              |
          |          -B-C-D-           |
        Unlocked        |              |
          |             |           Locked
        Waiting         |              |
          |             |            Del B
          |             |              |
          |           -C-D-         Unlocked
        Waiting         |              |
          |
        Locked
          |
       get C via B
          \
           - Kernel panic
    
    The kernel panic looked like as below:
    
    Unable to handle kernel paging request at virtual address dead000000000108
    pgd = ffffff8008c9e000
    [dead000000000108] *pgd=000000027fffe003, *pud=000000027fffe003, *pmd=0000000000000000
    Internal error: Oops: 96000044 [#1] PREEMPT SMP
    Modules linked in:
    CPU: 0 PID: 85 Comm: irq/59-66330000 Not tainted 4.8.24-WR9.0.0.12_standard #2
    Hardware name: Broadcom NS2 SVK (DT)
    task: ffffffc1f5cc3c00 task.stack: ffffffc1f5ce0000
    PC is at pl330_irq_handler+0x27c/0x390
    LR is at pl330_irq_handler+0x2a8/0x390
    pc : [<ffffff80084cb694>] lr : [<ffffff80084cb6c0>] pstate: 800001c5
    sp : ffffffc1f5ce3d00
    x29: ffffffc1f5ce3d00 x28: 0000000000000140
    x27: ffffffc1f5c530b0 x26: dead000000000100
    x25: dead000000000200 x24: 0000000000418958
    x23: 0000000000000001 x22: ffffffc1f5ccd668
    x21: ffffffc1f5ccd590 x20: ffffffc1f5ccd418
    x19: dead000000000060 x18: 0000000000000001
    x17: 0000000000000007 x16: 0000000000000001
    x15: ffffffffffffffff x14: ffffffffffffffff
    x13: ffffffffffffffff x12: 0000000000000000
    x11: 0000000000000001 x10: 0000000000000840
    x9 : ffffffc1f5ce0000 x8 : ffffffc1f5cc3338
    x7 : ffffff8008ce2020 x6 : 0000000000000000
    x5 : 0000000000000000 x4 : 0000000000000001
    x3 : dead000000000200 x2 : dead000000000100
    x1 : 0000000000000140 x0 : ffffffc1f5ccd590
    
    Process irq/59-66330000 (pid: 85, stack limit = 0xffffffc1f5ce0020)
    Stack: (0xffffffc1f5ce3d00 to 0xffffffc1f5ce4000)
    3d00: ffffffc1f5ce3d80 ffffff80080f09d0 ffffffc1f5ca0c00 ffffffc1f6f7c600
    3d20: ffffffc1f5ce0000 ffffffc1f6f7c600 ffffffc1f5ca0c00 ffffff80080f0998
    3d40: ffffffc1f5ce0000 ffffff80080f0000 0000000000000000 0000000000000000
    3d60: ffffff8008ce202c ffffff8008ce2020 ffffffc1f5ccd668 ffffffc1f5c530b0
    3d80: ffffffc1f5ce3db0 ffffff80080f0d70 ffffffc1f5ca0c40 0000000000000001
    3da0: ffffffc1f5ce0000 ffffff80080f0cfc ffffffc1f5ce3e20 ffffff80080bf4f8
    3dc0: ffffffc1f5ca0c80 ffffff8008bf3798 ffffff8008955528 ffffffc1f5ca0c00
    3de0: ffffff80080f0c30 0000000000000000 0000000000000000 0000000000000000
    3e00: 0000000000000000 0000000000000000 0000000000000000 ffffff80080f0b68
    3e20: 0000000000000000 ffffff8008083690 ffffff80080bf420 ffffffc1f5ca0c80
    3e40: 0000000000000000 0000000000000000 0000000000000000 ffffff80080cb648
    3e60: ffffff8008b1c780 0000000000000000 0000000000000000 ffffffc1f5ca0c00
    3e80: ffffffc100000000 ffffff8000000000 ffffffc1f5ce3e90 ffffffc1f5ce3e90
    3ea0: 0000000000000000 ffffff8000000000 ffffffc1f5ce3eb0 ffffffc1f5ce3eb0
    3ec0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
    3ee0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
    3f00: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
    3f20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
    3f40: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
    3f60: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
    3f80: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
    3fa0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
    3fc0: 0000000000000000 0000000000000005 0000000000000000 0000000000000000
    3fe0: 0000000000000000 0000000000000000 0000000275ce3ff0 0000000275ce3ff8
    Call trace:
    Exception stack(0xffffffc1f5ce3b30 to 0xffffffc1f5ce3c60)
    3b20:                                   dead000000000060 0000008000000000
    3b40: ffffffc1f5ce3d00 ffffff80084cb694 0000000000000008 0000000000000e88
    3b60: ffffffc1f5ce3bb0 ffffff80080dac68 ffffffc1f5ce3b90 ffffff8008826fe4
    3b80: 00000000000001c0 00000000000001c0 ffffffc1f5ce3bb0 ffffff800848dfcc
    3ba0: 0000000000020000 ffffff8008b15ae4 ffffffc1f5ce3c00 ffffff800808f000
    3bc0: 0000000000000010 ffffff80088377f0 ffffffc1f5ccd590 0000000000000140
    3be0: dead000000000100 dead000000000200 0000000000000001 0000000000000000
    3c00: 0000000000000000 ffffff8008ce2020 ffffffc1f5cc3338 ffffffc1f5ce0000
    3c20: 0000000000000840 0000000000000001 0000000000000000 ffffffffffffffff
    3c40: ffffffffffffffff ffffffffffffffff 0000000000000001 0000000000000007
    [<ffffff80084cb694>] pl330_irq_handler+0x27c/0x390
    [<ffffff80080f09d0>] irq_forced_thread_fn+0x38/0x88
    [<ffffff80080f0d70>] irq_thread+0x140/0x200
    [<ffffff80080bf4f8>] kthread+0xd8/0xf0
    [<ffffff8008083690>] ret_from_fork+0x10/0x40
    Code: f2a00838 f9405763 aa1c03e1 aa1503e0 (f9000443)
    ---[ end trace f50005726d31199c ]---
    Kernel panic - not syncing: Fatal exception in interrupt
    SMP: stopping secondary CPUs
    SMP: failed to stop secondary CPUs 0-1
    Kernel Offset: disabled
    Memory Limit: none
    ---[ end Kernel panic - not syncing: Fatal exception in interrupt
    
    To fix this, re-start with the list-head after dropping the lock then
    re-takeing it.
    
    Reviewed-by: Frank Mori Hess <fmh6jj@gmail.com>
    Tested-by: Frank Mori Hess <fmh6jj@gmail.com>
    Signed-off-by: Qi Hou <qi.hou@windriver.com>
    Signed-off-by: Vinod Koul <vinod.koul@intel.com>
    
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0256494d842b6cfb5e399e86395820cece35e4d2
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Tue Jan 16 16:52:15 2018 -0500

    media: s3c-camif: fix out-of-bounds array access
    
    [ Upstream commit a398e043637a4819a0e96467bfecaabf3224dd62 ]
    
    While experimenting with older compiler versions, I ran
    into a warning that no longer shows up on gcc-4.8 or newer:
    
    drivers/media/platform/s3c-camif/camif-capture.c: In function '__camif_subdev_try_format':
    drivers/media/platform/s3c-camif/camif-capture.c:1265:25: error: array subscript is below array bounds
    
    This is an off-by-one bug, leading to an access before the start of the
    array, while newer compilers silently assume this undefined behavior
    cannot happen and leave the loop at index 0 if no other entry matches.
    
    As Sylvester explains, we actually need to ensure that the
    value is within the range, so this reworks the loop to be
    easier to parse correctly, and an additional check to fall
    back on the first format value for any unexpected input.
    
    I found an existing gcc bug for it and added a reduced version
    of the function there.
    
    Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69249#c3
    Fixes: babde1c243b2 ("[media] V4L: Add driver for S3C24XX/S3C64XX SoC series camera interface")
    
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.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 fdf0b926460043d0fea69c4167812e985d442494
Author: Brad Love <brad@nextdimension.cc>
Date:   Tue Mar 6 14:15:36 2018 -0500

    media: cx23885: Set subdev host data to clk_freq pointer
    
    [ Upstream commit 5ceade1d97fc6687e050c44c257382c192f56276 ]
    
    Currently clk_freq is ignored entirely, because the cx235840 driver
    configures the xtal at the chip defaults. This is an issue if a
    board is produced with a non-default frequency crystal. If clk_freq
    is not zero the cx25840 will attempt to use the setting provided,
    or fall back to defaults otherwise.
    
    Signed-off-by: Brad Love <brad@nextdimension.cc>
    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 681e8cc46bbfeadc5229d276d66f26231ea38b30
Author: Brad Love <brad@nextdimension.cc>
Date:   Tue Mar 6 14:15:37 2018 -0500

    media: cx23885: Override 888 ImpactVCBe crystal frequency
    
    [ Upstream commit 779c79d4b833ec646b0aed878da38edb45bbe156 ]
    
    Hauppauge produced a revision of ImpactVCBe using an 888,
    with a 25MHz crystal, instead of using the default third
    overtone 50Mhz crystal. This overrides that frequency so
    that the cx25840 is properly configured. Without the proper
    crystal setup the cx25840 cannot load the firmware or
    decode video.
    
    Signed-off-by: Brad Love <brad@nextdimension.cc>
    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 a5f46bbec1e790e5648a6f3010a296393b5c466d
Author: Takashi Iwai <tiwai@suse.de>
Date:   Thu Mar 8 08:26:48 2018 +0100

    ALSA: vmaster: Propagate slave error
    
    [ Upstream commit 2e2c177ca84aff092c3c96714b0f6a12900f3946 ]
    
    In slave_update() of vmaster code ignores the error from the slave
    get() callback and copies the values.  It's not only about the missing
    error code but also that this may potentially lead to a leak of
    uninitialized variables when the slave get() don't clear them.
    
    This patch fixes slave_update() not to copy the potentially
    uninitialized values when an error is returned from the slave get()
    callback, and to propagate the error value properly.
    
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 40c1020f0ef83fc07b0d746bc71ff88151508fe3
Author: Chris Dickens <christopher.a.dickens@gmail.com>
Date:   Sun Dec 31 18:59:42 2017 -0800

    usb: gadget: composite: fix incorrect handling of OS desc requests
    
    [ Upstream commit 5d6ae4f0da8a64a185074dabb1b2f8c148efa741 ]
    
    When handling an OS descriptor request, one of the first operations is
    to zero out the request buffer using the wLength from the setup packet.
    There is no bounds checking, so a wLength > 4096 would clobber memory
    adjacent to the request buffer. Fix this by taking the min of wLength
    and the request buffer length prior to the memset. While at it, define
    the buffer length in a header file so that magic numbers don't appear
    throughout the code.
    
    When returning data to the host, the data length should be the min of
    the wLength and the valid data we have to return. Currently we are
    returning wLength, thus requests for a wLength greater than the amount
    of data in the OS descriptor buffer would return invalid (albeit zero'd)
    data following the valid descriptor data. Fix this by counting the
    number of bytes when constructing the data and using this when
    determining the length of the request.
    
    Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
    Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 10bedea0174a764bc5608890a161e619b1eb1870
Author: Wolfram Sang <wsa+renesas@sang-engineering.com>
Date:   Tue Feb 6 09:50:40 2018 +0100

    usb: gadget: udc: change comparison to bitshift when dealing with a mask
    
    [ Upstream commit ac87e560f7c0f91b62012e9a159c0681a373b922 ]
    
    Due to a typo, the mask was destroyed by a comparison instead of a bit
    shift.
    
    Reported-by: Geert Uytterhoeven <geert+renesas@glider.be>
    Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
    Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0fdfc3f543261cd112b84b1085e1378c396de302
Author: Maurizio Lombardi <mlombard@redhat.com>
Date:   Fri Mar 9 13:59:06 2018 +0100

    cdrom: do not call check_disk_change() inside cdrom_open()
    
    [ Upstream commit 2bbea6e117357d17842114c65e9a9cf2d13ae8a3 ]
    
    when mounting an ISO filesystem sometimes (very rarely)
    the system hangs because of a race condition between two tasks.
    
    PID: 6766   TASK: ffff88007b2a6dd0  CPU: 0   COMMAND: "mount"
     #0 [ffff880078447ae0] __schedule at ffffffff8168d605
     #1 [ffff880078447b48] schedule_preempt_disabled at ffffffff8168ed49
     #2 [ffff880078447b58] __mutex_lock_slowpath at ffffffff8168c995
     #3 [ffff880078447bb8] mutex_lock at ffffffff8168bdef
     #4 [ffff880078447bd0] sr_block_ioctl at ffffffffa00b6818 [sr_mod]
     #5 [ffff880078447c10] blkdev_ioctl at ffffffff812fea50
     #6 [ffff880078447c70] ioctl_by_bdev at ffffffff8123a8b3
     #7 [ffff880078447c90] isofs_fill_super at ffffffffa04fb1e1 [isofs]
     #8 [ffff880078447da8] mount_bdev at ffffffff81202570
     #9 [ffff880078447e18] isofs_mount at ffffffffa04f9828 [isofs]
    #10 [ffff880078447e28] mount_fs at ffffffff81202d09
    #11 [ffff880078447e70] vfs_kern_mount at ffffffff8121ea8f
    #12 [ffff880078447ea8] do_mount at ffffffff81220fee
    #13 [ffff880078447f28] sys_mount at ffffffff812218d6
    #14 [ffff880078447f80] system_call_fastpath at ffffffff81698c49
        RIP: 00007fd9ea914e9a  RSP: 00007ffd5d9bf648  RFLAGS: 00010246
        RAX: 00000000000000a5  RBX: ffffffff81698c49  RCX: 0000000000000010
        RDX: 00007fd9ec2bc210  RSI: 00007fd9ec2bc290  RDI: 00007fd9ec2bcf30
        RBP: 0000000000000000   R8: 0000000000000000   R9: 0000000000000010
        R10: 00000000c0ed0001  R11: 0000000000000206  R12: 00007fd9ec2bc040
        R13: 00007fd9eb6b2380  R14: 00007fd9ec2bc210  R15: 00007fd9ec2bcf30
        ORIG_RAX: 00000000000000a5  CS: 0033  SS: 002b
    
    This task was trying to mount the cdrom.  It allocated and configured a
    super_block struct and owned the write-lock for the super_block->s_umount
    rwsem. While exclusively owning the s_umount lock, it called
    sr_block_ioctl and waited to acquire the global sr_mutex lock.
    
    PID: 6785   TASK: ffff880078720fb0  CPU: 0   COMMAND: "systemd-udevd"
     #0 [ffff880078417898] __schedule at ffffffff8168d605
     #1 [ffff880078417900] schedule at ffffffff8168dc59
     #2 [ffff880078417910] rwsem_down_read_failed at ffffffff8168f605
     #3 [ffff880078417980] call_rwsem_down_read_failed at ffffffff81328838
     #4 [ffff8800784179d0] down_read at ffffffff8168cde0
     #5 [ffff8800784179e8] get_super at ffffffff81201cc7
     #6 [ffff880078417a10] __invalidate_device at ffffffff8123a8de
     #7 [ffff880078417a40] flush_disk at ffffffff8123a94b
     #8 [ffff880078417a88] check_disk_change at ffffffff8123ab50
     #9 [ffff880078417ab0] cdrom_open at ffffffffa00a29e1 [cdrom]
    #10 [ffff880078417b68] sr_block_open at ffffffffa00b6f9b [sr_mod]
    #11 [ffff880078417b98] __blkdev_get at ffffffff8123ba86
    #12 [ffff880078417bf0] blkdev_get at ffffffff8123bd65
    #13 [ffff880078417c78] blkdev_open at ffffffff8123bf9b
    #14 [ffff880078417c90] do_dentry_open at ffffffff811fc7f7
    #15 [ffff880078417cd8] vfs_open at ffffffff811fc9cf
    #16 [ffff880078417d00] do_last at ffffffff8120d53d
    #17 [ffff880078417db0] path_openat at ffffffff8120e6b2
    #18 [ffff880078417e48] do_filp_open at ffffffff8121082b
    #19 [ffff880078417f18] do_sys_open at ffffffff811fdd33
    #20 [ffff880078417f70] sys_open at ffffffff811fde4e
    #21 [ffff880078417f80] system_call_fastpath at ffffffff81698c49
        RIP: 00007f29438b0c20  RSP: 00007ffc76624b78  RFLAGS: 00010246
        RAX: 0000000000000002  RBX: ffffffff81698c49  RCX: 0000000000000000
        RDX: 00007f2944a5fa70  RSI: 00000000000a0800  RDI: 00007f2944a5fa70
        RBP: 00007f2944a5f540   R8: 0000000000000000   R9: 0000000000000020
        R10: 00007f2943614c40  R11: 0000000000000246  R12: ffffffff811fde4e
        R13: ffff880078417f78  R14: 000000000000000c  R15: 00007f2944a4b010
        ORIG_RAX: 0000000000000002  CS: 0033  SS: 002b
    
    This task tried to open the cdrom device, the sr_block_open function
    acquired the global sr_mutex lock. The call to check_disk_change()
    then saw an event flag indicating a possible media change and tried
    to flush any cached data for the device.
    As part of the flush, it tried to acquire the super_block->s_umount
    lock associated with the cdrom device.
    This was the same super_block as created and locked by the previous task.
    
    The first task acquires the s_umount lock and then the sr_mutex_lock;
    the second task acquires the sr_mutex_lock and then the s_umount lock.
    
    This patch fixes the issue by moving check_disk_change() out of
    cdrom_open() and let the caller take care of it.
    
    Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 67fa45618e2b92d092eace452c71e69624ca187c
Author: Guenter Roeck <linux@roeck-us.net>
Date:   Sat Mar 10 17:55:47 2018 -0800

    hwmon: (pmbus/adm1275) Accept negative page register values
    
    [ Upstream commit ecb29abd4cb0670c616fb563a078f25d777ce530 ]
    
    A negative page register value means that no page needs to be
    selected. This is used by status register read operations and needs
    to be accepted. The failure to do so so results in missed status
    and limit registers.
    
    Fixes: da8e48ab483e1 ("hwmon: (pmbus) Always call _pmbus_read_byte in core driver")
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 68f70a8a9ffa7dfd397027bfbe767810def1937f
Author: Guenter Roeck <linux@roeck-us.net>
Date:   Sat Mar 10 17:49:47 2018 -0800

    hwmon: (pmbus/max8688) Accept negative page register values
    
    [ Upstream commit a46f8cd696624ef757be0311eb28f119c36778e8 ]
    
    A negative page register value means that no page needs to be
    selected. This is used by status register evaluations and needs
    to be accepted.
    
    Fixes: da8e48ab483e1 ("hwmon: (pmbus) Always call _pmbus_read_byte in core driver")
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 92a1e6abe27539cd08263c81242bec2e8f4eeca7
Author: Peter Zijlstra <peterz@infradead.org>
Date:   Fri Mar 9 12:52:04 2018 +0100

    perf/core: Fix perf_output_read_group()
    
    [ Upstream commit 9e5b127d6f33468143d90c8a45ca12410e4c3fa7 ]
    
    Mark reported his arm64 perf fuzzer runs sometimes splat like:
    
      armv8pmu_read_counter+0x1e8/0x2d8
      armpmu_event_update+0x8c/0x188
      armpmu_read+0xc/0x18
      perf_output_read+0x550/0x11e8
      perf_event_read_event+0x1d0/0x248
      perf_event_exit_task+0x468/0xbb8
      do_exit+0x690/0x1310
      do_group_exit+0xd0/0x2b0
      get_signal+0x2e8/0x17a8
      do_signal+0x144/0x4f8
      do_notify_resume+0x148/0x1e8
      work_pending+0x8/0x14
    
    which asserts that we only call pmu::read() on ACTIVE events.
    
    The above callchain does:
    
      perf_event_exit_task()
        perf_event_exit_task_context()
          task_ctx_sched_out() // INACTIVE
          perf_event_exit_event()
            perf_event_set_state(EXIT) // EXIT
            sync_child_event()
              perf_event_read_event()
                perf_output_read()
                  perf_output_read_group()
                    leader->pmu->read()
    
    Which results in doing a pmu::read() on an !ACTIVE event.
    
    I _think_ this is 'new' since we added attr.inherit_stat, which added
    the perf_event_read_event() to the exit path, without that
    perf_event_read_output() would only trigger from samples and for
    @event to trigger a sample, it's leader _must_ be ACTIVE too.
    
    Still, adding this check makes it consistent with the @sub case for
    the siblings.
    
    Reported-and-Tested-by: Mark Rutland <mark.rutland@arm.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Jiri Olsa <jolsa@redhat.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Stephane Eranian <eranian@google.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Vince Weaver <vincent.weaver@maine.edu>
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e1acc9f8bfe26c1ad0805f32f66f170b3caf554e
Author: Mathieu Malaterre <malat@debian.org>
Date:   Sun Feb 25 18:22:29 2018 +0100

    powerpc: Add missing prototype for arch_irq_work_raise()
    
    [ Upstream commit f5246862f82f1e16bbf84cda4cddf287672b30fe ]
    
    In commit 4f8b50bbbe63 ("irq_work, ppc: Fix up arch hooks") a new
    function arch_irq_work_raise() was added without a prototype in header
    irq_work.h.
    
    Fix the following warning (treated as error in W=1):
      arch/powerpc/kernel/time.c:523:6: error: no previous prototype for ‘arch_irq_work_raise’
    
    Signed-off-by: Mathieu Malaterre <malat@debian.org>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a7289f6f3a33c231908c193cd4a9a3ba7de975d6
Author: Lars-Peter Clausen <lars@metafoo.de>
Date:   Fri Jan 12 11:26:16 2018 +0100

    usb: gadget: ffs: Let setup() return USB_GADGET_DELAYED_STATUS
    
    [ Upstream commit 946ef68ad4e45aa048a5fb41ce8823ed29da866a ]
    
    Some UDC drivers (like the DWC3) expect that the response to a setup()
    request is queued from within the setup function itself so that it is
    available as soon as setup() has completed.
    
    Upon receiving a setup request the function fs driver creates an event that
    is made available to userspace. And only once userspace has acknowledged
    that event the response to the setup request is queued.
    
    So it violates the requirement of those UDC drivers and random failures can
    be observed. This is basically a race condition and if userspace is able to
    read the event and queue the response fast enough all is good. But if it is
    not, for example because other processes are currently scheduled to run,
    the USB host that sent the setup request will observe an error.
    
    To avoid this the gadget framework provides the USB_GADGET_DELAYED_STATUS
    return code. If a setup() callback returns this value the UDC driver is
    aware that response is not yet available and can uses the appropriate
    methods to handle this case.
    
    Since in the case of function fs the response will never be available when
    the setup() function returns make sure that this status code is used.
    
    This fixed random occasional failures that were previously observed on a
    DWC3 based system under high system load.
    
    Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
    Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6858abef22289fea2495292e3d458c00923e9d0d
Author: Grigor Tovmasyan <Grigor.Tovmasyan@synopsys.com>
Date:   Tue Feb 6 19:07:38 2018 +0400

    usb: dwc2: Fix interval type issue
    
    [ Upstream commit 12814a3f8f9b247531d7863170cc82b3fe4218fd ]
    
    The maximum value that unsigned char can hold is 255, meanwhile
    the maximum value of interval is  2^(bIntervalMax-1)=2^15.
    
    Signed-off-by: Grigor Tovmasyan <tovmasya@synopsys.com>
    Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d36edd46526c261b5ce3f7c67ea73d0694f3ff67
Author: Rafael J. Wysocki <rjw@rjwysocki.net>
Date:   Sat Mar 3 10:53:24 2018 +0100

    PCI: Restore config space on runtime resume despite being unbound
    
    [ Upstream commit 5775b843a619b3c93f946e2b55a208d9f0f48b59 ]
    
    We leave PCI devices not bound to a driver in D0 during runtime suspend.
    But they may have a parent which is bound and can be transitioned to
    D3cold at runtime.  Once the parent goes to D3cold, the unbound child
    may go to D3cold as well.  When the child goes to D3cold, its internal
    state, including configuration of BARs, MSI, ASPM, MPS, etc., is lost.
    
    One example are recent hybrid graphics laptops which cut power to the
    discrete GPU when the root port above it goes to ACPI power state D3.
    Users may provoke this by unbinding the GPU driver and allowing runtime
    PM on the GPU via sysfs:  The PM core will then treat the GPU as
    "suspended", which in turn allows the root port to runtime suspend,
    causing the power resources listed in its _PR3 object to be powered off.
    The GPU's BARs will be uninitialized when a driver later probes it.
    
    Another example are hybrid graphics laptops where the GPU itself (rather
    than the root port) is capable of runtime suspending to D3cold.  If the
    GPU's integrated HDA controller is not bound and the GPU's driver
    decides to runtime suspend to D3cold, the HDA controller's BARs will be
    uninitialized when a driver later probes it.
    
    Fix by saving and restoring config space over a runtime suspend cycle
    even if the device is not bound.
    
    Acked-by: Bjorn Helgaas <bhelgaas@google.com>
    Tested-by: Peter Wu <peter@lekensteyn.nl>              # Nvidia Optimus
    Tested-by: Lukas Wunner <lukas@wunner.de>              # MacBook Pro
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    [lukas: add commit message, bikeshed code comments for clarity]
    Signed-off-by: Lukas Wunner <lukas@wunner.de>
    Link: https://patchwork.freedesktop.org/patch/msgid/92fb6e6ae2730915eb733c08e2f76c6a313e3860.1520068884.git.lukas@wunner.de
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a1ff9f1524ad547c97372894e27ae6e020c69047
Author: Mathias Kresin <dev@kresin.me>
Date:   Thu May 11 08:18:24 2017 +0200

    MIPS: ath79: Fix AR724X_PLL_REG_PCIE_CONFIG offset
    
    [ Upstream commit 05454c1bde91fb013c0431801001da82947e6b5a ]
    
    According to the QCA u-boot source the "PCIE Phase Lock Loop
    Configuration (PCIE_PLL_CONFIG)" register is for all SoCs except the
    QCA955X and QCA956X at offset 0x10.
    
    Since the PCIE PLL config register is only defined for the AR724x fix
    only this value. The value is wrong since the day it was added and isn't
    used by any driver yet.
    
    Signed-off-by: Mathias Kresin <dev@kresin.me>
    Cc: Ralf Baechle <ralf@linux-mips.org>
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/16048/
    Signed-off-by: James Hogan <jhogan@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7b989448319d4524f62f69967714d351d620db19
Author: Mathias Nyman <mathias.nyman@linux.intel.com>
Date:   Fri Mar 16 16:33:01 2018 +0200

    xhci: zero usb device slot_id member when disabling and freeing a xhci slot
    
    [ Upstream commit a400efe455f7b61ac9a801ac8d0d01f8c8d82dd5 ]
    
    set udev->slot_id to zero when disabling and freeing the xhci slot.
    Prevents usb core from calling xhci with a stale slot id.
    
    xHC controller may be reset during resume to recover from some error.
    All slots are unusable as they are disabled and freed.
    xhci driver starts slot enumeration again from 1 in the order they are
    enabled. In the worst case a stale udev->slot_id for one device matches
    a newly enabled slot_id for a different device, causing us to
    perform a action on the wrong device.
    
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 87f5b4f4b4a2c478f08fc532ffc16238ee37e1a2
Author: Gregory CLEMENT <gregory.clement@bootlin.com>
Date:   Wed Mar 14 18:03:40 2018 +0100

    i2c: mv64xxx: Apply errata delay only in standard mode
    
    [ Upstream commit 31184d8c6ea49ea0676d100cdd7e1f102ad025b5 ]
    
    The errata FE-8471889 description has been updated. There is still a
    timing violation for repeated start. But the errata now states that it
    was only the case for the Standard mode (100 kHz), in Fast mode (400 kHz)
    there is no issue.
    
    This patch limit the errata fix to the Standard mode.
    
    It has been tesed successfully on the clearfog (Aramda 388 based board).
    
    Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c81492260a2202dcea658087b5dd1b319f59bbf0
Author: Seunghun Han <kkamagui@gmail.com>
Date:   Wed Mar 14 16:12:56 2018 -0700

    ACPICA: acpi: acpica: fix acpi operand cache leak in nseval.c
    
    [ Upstream commit 97f3c0a4b0579b646b6b10ae5a3d59f0441cc12c ]
    
    I found an ACPI cache leak in ACPI early termination and boot continuing case.
    
    When early termination occurs due to malicious ACPI table, Linux kernel
    terminates ACPI function and continues to boot process. While kernel terminates
    ACPI function, kmem_cache_destroy() reports Acpi-Operand cache leak.
    
    Boot log of ACPI operand cache leak is as follows:
    >[    0.464168] ACPI: Added _OSI(Module Device)
    >[    0.467022] ACPI: Added _OSI(Processor Device)
    >[    0.469376] ACPI: Added _OSI(3.0 _SCP Extensions)
    >[    0.471647] ACPI: Added _OSI(Processor Aggregator Device)
    >[    0.477997] ACPI Error: Null stack entry at ffff880215c0aad8 (20170303/exresop-174)
    >[    0.482706] ACPI Exception: AE_AML_INTERNAL, While resolving operands for [opcode_name unavailable] (20170303/dswexec-461)
    >[    0.487503] ACPI Error: Method parse/execution failed [\DBG] (Node ffff88021710ab40), AE_AML_INTERNAL (20170303/psparse-543)
    >[    0.492136] ACPI Error: Method parse/execution failed [\_SB._INI] (Node ffff88021710a618), AE_AML_INTERNAL (20170303/psparse-543)
    >[    0.497683] ACPI: Interpreter enabled
    >[    0.499385] ACPI: (supports S0)
    >[    0.501151] ACPI: Using IOAPIC for interrupt routing
    >[    0.503342] ACPI Error: Null stack entry at ffff880215c0aad8 (20170303/exresop-174)
    >[    0.506522] ACPI Exception: AE_AML_INTERNAL, While resolving operands for [opcode_name unavailable] (20170303/dswexec-461)
    >[    0.510463] ACPI Error: Method parse/execution failed [\DBG] (Node ffff88021710ab40), AE_AML_INTERNAL (20170303/psparse-543)
    >[    0.514477] ACPI Error: Method parse/execution failed [\_PIC] (Node ffff88021710ab18), AE_AML_INTERNAL (20170303/psparse-543)
    >[    0.518867] ACPI Exception: AE_AML_INTERNAL, Evaluating _PIC (20170303/bus-991)
    >[    0.522384] kmem_cache_destroy Acpi-Operand: Slab cache still has objects
    >[    0.524597] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.12.0-rc5 #26
    >[    0.526795] Hardware name: innotek gmb_h virtual_box/virtual_box, BIOS virtual_box 12/01/2006
    >[    0.529668] Call Trace:
    >[    0.530811]  ? dump_stack+0x5c/0x81
    >[    0.532240]  ? kmem_cache_destroy+0x1aa/0x1c0
    >[    0.533905]  ? acpi_os_delete_cache+0xa/0x10
    >[    0.535497]  ? acpi_ut_delete_caches+0x3f/0x7b
    >[    0.537237]  ? acpi_terminate+0xa/0x14
    >[    0.538701]  ? acpi_init+0x2af/0x34f
    >[    0.540008]  ? acpi_sleep_proc_init+0x27/0x27
    >[    0.541593]  ? do_one_initcall+0x4e/0x1a0
    >[    0.543008]  ? kernel_init_freeable+0x19e/0x21f
    >[    0.546202]  ? rest_init+0x80/0x80
    >[    0.547513]  ? kernel_init+0xa/0x100
    >[    0.548817]  ? ret_from_fork+0x25/0x30
    >[    0.550587] vgaarb: loaded
    >[    0.551716] EDAC MC: Ver: 3.0.0
    >[    0.553744] PCI: Probing PCI hardware
    >[    0.555038] PCI host bridge to bus 0000:00
    > ... Continue to boot and log is omitted ...
    
    I analyzed this memory leak in detail and found acpi_ns_evaluate() function
    only removes Info->return_object in AE_CTRL_RETURN_VALUE case. But, when errors
    occur, the status value is not AE_CTRL_RETURN_VALUE, and Info->return_object is
    also not null. Therefore, this causes acpi operand memory leak.
    
    This cache leak causes a security threat because an old kernel (<= 4.9) shows
    memory locations of kernel functions in stack dump. Some malicious users
    could use this information to neutralize kernel ASLR.
    
    I made a patch to fix ACPI operand cache leak.
    
    Signed-off-by: Seunghun Han <kkamagui@gmail.com>
    Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 43f9785ba5eb5100f879cdcfd7bb5dccd6057d2d
Author: Erik Schmauss <erik.schmauss@intel.com>
Date:   Wed Mar 14 16:13:08 2018 -0700

    ACPICA: Events: add a return on failure from acpi_hw_register_read
    
    [ Upstream commit b4c0de312613ca676db5bd7e696a44b56795612a ]
    
    This ensures that acpi_ev_fixed_event_detect() does not use fixed_status
    and and fixed_enable as uninitialized variables.
    
    Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7afa3b1137f4043dc7773ce3b7c20f2b276be802
Author: Coly Li <colyli@suse.de>
Date:   Sun Mar 18 17:36:15 2018 -0700

    bcache: quit dc->writeback_thread when BCACHE_DEV_DETACHING is set
    
    [ Upstream commit fadd94e05c02afec7b70b0b14915624f1782f578 ]
    
    In patch "bcache: fix cached_dev->count usage for bch_cache_set_error()",
    cached_dev_get() is called when creating dc->writeback_thread, and
    cached_dev_put() is called when exiting dc->writeback_thread. This
    modification works well unless people detach the bcache device manually by
        'echo 1 > /sys/block/bcache<N>/bcache/detach'
    Because this sysfs interface only calls bch_cached_dev_detach() which wakes
    up dc->writeback_thread but does not stop it. The reason is, before patch
    "bcache: fix cached_dev->count usage for bch_cache_set_error()", inside
    bch_writeback_thread(), if cache is not dirty after writeback,
    cached_dev_put() will be called here. And in cached_dev_make_request() when
    a new write request makes cache from clean to dirty, cached_dev_get() will
    be called there. Since we don't operate dc->count in these locations,
    refcount d->count cannot be dropped after cache becomes clean, and
    cached_dev_detach_finish() won't be called to detach bcache device.
    
    This patch fixes the issue by checking whether BCACHE_DEV_DETACHING is
    set inside bch_writeback_thread(). If this bit is set and cache is clean
    (no existing writeback_keys), break the while-loop, call cached_dev_put()
    and quit the writeback thread.
    
    Please note if cache is still dirty, even BCACHE_DEV_DETACHING is set the
    writeback thread should continue to perform writeback, this is the original
    design of manually detach.
    
    It is safe to do the following check without locking, let me explain why,
    +       if (!test_bit(BCACHE_DEV_DETACHING, &dc->disk.flags) &&
    +           (!atomic_read(&dc->has_dirty) || !dc->writeback_running)) {
    
    If the kenrel thread does not sleep and continue to run due to conditions
    are not updated in time on the running CPU core, it just consumes more CPU
    cycles and has no hurt. This should-sleep-but-run is safe here. We just
    focus on the should-run-but-sleep condition, which means the writeback
    thread goes to sleep in mistake while it should continue to run.
    1, First of all, no matter the writeback thread is hung or not,
       kthread_stop() from cached_dev_detach_finish() will wake up it and
       terminate by making kthread_should_stop() return true. And in normal
       run time, bit on index BCACHE_DEV_DETACHING is always cleared, the
       condition
            !test_bit(BCACHE_DEV_DETACHING, &dc->disk.flags)
       is always true and can be ignored as constant value.
    2, If one of the following conditions is true, the writeback thread should
       go to sleep,
       "!atomic_read(&dc->has_dirty)" or "!dc->writeback_running)"
       each of them independently controls the writeback thread should sleep or
       not, let's analyse them one by one.
    2.1 condition "!atomic_read(&dc->has_dirty)"
       If dc->has_dirty is set from 0 to 1 on another CPU core, bcache will
       call bch_writeback_queue() immediately or call bch_writeback_add() which
       indirectly calls bch_writeback_queue() too. In bch_writeback_queue(),
       wake_up_process(dc->writeback_thread) is called. It sets writeback
       thread's task state to TASK_RUNNING and following an implicit memory
       barrier, then tries to wake up the writeback thread.
       In writeback thread, its task state is set to TASK_INTERRUPTIBLE before
       doing the condition check. If other CPU core sets the TASK_RUNNING state
       after writeback thread setting TASK_INTERRUPTIBLE, the writeback thread
       will be scheduled to run very soon because its state is not
       TASK_INTERRUPTIBLE. If other CPU core sets the TASK_RUNNING state before
       writeback thread setting TASK_INTERRUPTIBLE, the implict memory barrier
       of wake_up_process() will make sure modification of dc->has_dirty on
       other CPU core is updated and observed on the CPU core of writeback
       thread. Therefore the condition check will correctly be false, and
       continue writeback code without sleeping.
    2.2 condition "!dc->writeback_running)"
       dc->writeback_running can be changed via sysfs file, every time it is
       modified, a following bch_writeback_queue() is alwasy called. So the
       change is always observed on the CPU core of writeback thread. If
       dc->writeback_running is changed from 0 to 1 on other CPU core, this
       condition check will observe the modification and allow writeback
       thread to continue to run without sleeping.
    Now we can see, even without a locking protection, multiple conditions
    check is safe here, no deadlock or process hang up will happen.
    
    I compose a separte patch because that patch "bcache: fix cached_dev->count
    usage for bch_cache_set_error()" already gets a "Reviewed-by:" from Hannes
    Reinecke. Also this fix is not trivial and good for a separate patch.
    
    Signed-off-by: Coly Li <colyli@suse.de>
    Reviewed-by: Michael Lyle <mlyle@lyle.org>
    Cc: Hannes Reinecke <hare@suse.com>
    Cc: Huijun Tang <tang.junhui@zte.com.cn>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b895aea67104f9bdb5b43a68302c0a711091f0f0
Author: Michael Schmitz <schmitzmic@gmail.com>
Date:   Sat Mar 3 12:04:13 2018 +1300

    zorro: Set up z->dev.dma_mask for the DMA API
    
    [ Upstream commit 55496d3fe2acd1a365c43cbd613a20ecd4d74395 ]
    
    The generic DMA API uses dev->dma_mask to check the DMA addressable
    memory bitmask, and warns if no mask is set or even allocated.
    
    Set z->dev.dma_coherent_mask on Zorro bus scan, and make z->dev.dma_mask
    to point to z->dev.dma_coherent_mask so device drivers that need DMA have
    everything set up to avoid warnings from dma_alloc_coherent(). Drivers can
    still use dma_set_mask_and_coherent() to explicitly set their DMA bit mask.
    
    Signed-off-by: Michael Schmitz <schmitzmic@gmail.com>
    [geert: Handle Zorro II with 24-bit address space]
    Acked-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f60da70ad94f3be3f40a3c119a0c1c04eaeaf91a
Author: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Date:   Fri Mar 16 15:33:54 2018 -0700

    usb: dwc3: Update DWC_usb31 GTXFIFOSIZ reg fields
    
    [ Upstream commit 0cab8d26d6e5e053b2bed3356992aaa71dc93628 ]
    
    Update two GTXFIFOSIZ bit fields for the DWC_usb31 controller. TXFDEP
    is a 15-bit value instead of 16-bit value, and bit 15 is TXFRAMNUM.
    
    The GTXFIFOSIZ register for DWC_usb31 is as follows:
     +-------+-----------+----------------------------------+
     | BITS  | Name      | Description                      |
     +=======+===========+==================================+
     | 31:16 | TXFSTADDR | Transmit FIFOn RAM Start Address |
     | 15    | TXFRAMNUM | Asynchronous/Periodic TXFIFO     |
     | 14:0  | TXFDEP    | TXFIFO Depth                     |
     +-------+-----------+----------------------------------+
    
    Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
    Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c688b28e9b6a11b0e98a4363874274649612546d
Author: Philipp Puschmann <pp@emlix.com>
Date:   Fri Mar 23 10:22:15 2018 +0100

    arm: dts: socfpga: fix GIC PPI warning
    
    [ Upstream commit 6d97d5aba08b26108f95dc9fb7bbe4d9436c769c ]
    
    Fixes the warning "GIC: PPI13 is secure or misconfigured" by
    changing the interrupt type from level_low to edge_raising
    
    Signed-off-by: Philipp Puschmann <pp@emlix.com>
    Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit bc3c40420f52bfc83e4963d6fdf71862dfd54492
Author: Jay Vosburgh <jay.vosburgh@canonical.com>
Date:   Thu Mar 22 14:42:41 2018 +0000

    virtio-net: Fix operstate for virtio when no VIRTIO_NET_F_STATUS
    
    [ Upstream commit bda7fab54828bbef2164bb23c0f6b1a7d05cc718 ]
    
    The operstate update logic will leave an interface in the
    default UNKNOWN operstate if the interface carrier state never changes
    from the default carrier up state set at creation.  This includes the
    case of an explicit call to netif_carrier_on, as the carrier on to on
    transition has no effect on operstate.
    
            This affects virtio-net for the case that the virtio peer does
    not support VIRTIO_NET_F_STATUS (the feature that provides carrier state
    updates).  Without this feature, the virtio specification states that
    "the link should be assumed active," so, logically, the operstate should
    be UP instead of UNKNOWN.  This has impact on user space applications
    that use the operstate to make availability decisions for the interface.
    
            Resolve this by changing the virtio probe logic slightly to call
    netif_carrier_off for both the "with" and "without" VIRTIO_NET_F_STATUS
    cases, and then the existing call to netif_carrier_on for the "without"
    case will cause an operstate transition.
    
    Cc: "Michael S. Tsirkin" <mst@redhat.com>
    Cc: Jason Wang <jasowang@redhat.com>
    Cc: Ben Hutchings <ben@decadent.org.uk>
    Signed-off-by: Jay Vosburgh <jay.vosburgh@canonical.com>
    Acked-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 477c193445d61dea0cf9c73de82eca336a5c98f3
Author: Petr Vorel <pvorel@suse.cz>
Date:   Fri Mar 23 14:41:08 2018 +0100

    ima: Fallback to the builtin hash algorithm
    
    [ Upstream commit ab60368ab6a452466885ef4edf0cefd089465132 ]
    
    IMA requires having it's hash algorithm be compiled-in due to it's
    early use.  The default IMA algorithm is protected by Kconfig to be
    compiled-in.
    
    The ima_hash kernel parameter allows to choose the hash algorithm. When
    the specified algorithm is not available or available as a module, IMA
    initialization fails, which leads to a kernel panic (mknodat syscall calls
    ima_post_path_mknod()).  Therefore as fallback we force IMA to use
    the default builtin Kconfig hash algorithm.
    
    Fixed crash:
    
    $ grep CONFIG_CRYPTO_MD4 .config
    CONFIG_CRYPTO_MD4=m
    
    [    0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-4.12.14-2.3-default root=UUID=74ae8202-9ca7-4e39-813b-22287ec52f7a video=1024x768-16 plymouth.ignore-serial-consoles console=ttyS0 console=tty resume=/dev/disk/by-path/pci-0000:00:07.0-part3 splash=silent showopts ima_hash=md4
    ...
    [    1.545190] ima: Can not allocate md4 (reason: -2)
    ...
    [    2.610120] BUG: unable to handle kernel NULL pointer dereference at           (null)
    [    2.611903] IP: ima_match_policy+0x23/0x390
    [    2.612967] PGD 0 P4D 0
    [    2.613080] Oops: 0000 [#1] SMP
    [    2.613080] Modules linked in: autofs4
    [    2.613080] Supported: Yes
    [    2.613080] CPU: 0 PID: 1 Comm: systemd Not tainted 4.12.14-2.3-default #1
    [    2.613080] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.0.0-prebuilt.qemu-project.org 04/01/2014
    [    2.613080] task: ffff88003e2d0040 task.stack: ffffc90000190000
    [    2.613080] RIP: 0010:ima_match_policy+0x23/0x390
    [    2.613080] RSP: 0018:ffffc90000193e88 EFLAGS: 00010296
    [    2.613080] RAX: 0000000000000000 RBX: 000000000000000c RCX: 0000000000000004
    [    2.613080] RDX: 0000000000000010 RSI: 0000000000000001 RDI: ffff880037071728
    [    2.613080] RBP: 0000000000008000 R08: 0000000000000000 R09: 0000000000000000
    [    2.613080] R10: 0000000000000008 R11: 61c8864680b583eb R12: 00005580ff10086f
    [    2.613080] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000008000
    [    2.613080] FS:  00007f5c1da08940(0000) GS:ffff88003fc00000(0000) knlGS:0000000000000000
    [    2.613080] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [    2.613080] CR2: 0000000000000000 CR3: 0000000037002000 CR4: 00000000003406f0
    [    2.613080] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    [    2.613080] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    [    2.613080] Call Trace:
    [    2.613080]  ? shmem_mknod+0xbf/0xd0
    [    2.613080]  ima_post_path_mknod+0x1c/0x40
    [    2.613080]  SyS_mknod+0x210/0x220
    [    2.613080]  entry_SYSCALL_64_fastpath+0x1a/0xa5
    [    2.613080] RIP: 0033:0x7f5c1bfde570
    [    2.613080] RSP: 002b:00007ffde1c90dc8 EFLAGS: 00000246 ORIG_RAX: 0000000000000085
    [    2.613080] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f5c1bfde570
    [    2.613080] RDX: 0000000000000000 RSI: 0000000000008000 RDI: 00005580ff10086f
    [    2.613080] RBP: 00007ffde1c91040 R08: 00005580ff10086f R09: 0000000000000000
    [    2.613080] R10: 0000000000104000 R11: 0000000000000246 R12: 00005580ffb99660
    [    2.613080] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000002
    [    2.613080] Code: 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 41 57 41 56 44 8d 14 09 41 55 41 54 55 53 44 89 d3 09 cb 48 83 ec 38 48 8b 05 c5 03 29 01 <4c> 8b 20 4c 39 e0 0f 84 d7 01 00 00 4c 89 44 24 08 89 54 24 20
    [    2.613080] RIP: ima_match_policy+0x23/0x390 RSP: ffffc90000193e88
    [    2.613080] CR2: 0000000000000000
    [    2.613080] ---[ end trace 9a9f0a8a73079f6a ]---
    [    2.673052] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000009
    [    2.673052]
    [    2.675337] Kernel Offset: disabled
    [    2.676405] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000009
    
    Signed-off-by: Petr Vorel <pvorel@suse.cz>
    Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 00cef0273f36c2a3046427e672390df379fc7d53
Author: Karthikeyan Periyasamy <periyasa@codeaurora.org>
Date:   Mon Mar 12 17:09:40 2018 +0530

    ath10k: Fix kernel panic while using worker (ath10k_sta_rc_update_wk)
    
    [ Upstream commit 8b2d93dd22615cb7f3046a5a2083a6f8bb8052ed ]
    
    When attempt to run worker (ath10k_sta_rc_update_wk) after the station object
    (ieee80211_sta) delete will trigger the kernel panic.
    
    This problem arise in AP + Mesh configuration, Where the current node AP VAP
    and neighbor node mesh VAP MAC address are same. When the current mesh node
    try to establish the mesh link with neighbor node, driver peer creation for
    the neighbor mesh node fails due to duplication MAC address. Already the AP
    VAP created with same MAC address.
    
    It is caused by the following scenario steps.
    
    Steps:
    1. In above condition, ath10k driver sta_state callback (ath10k_sta_state)
       fails to do the state change for a station from IEEE80211_STA_NOTEXIST
       to IEEE80211_STA_NONE due to peer creation fails. Sta_state callback is
       called from ieee80211_add_station() to handle the new station
       (neighbor mesh node) request from the wpa_supplicant.
    2. Concurrently ath10k receive the sta_rc_update callback notification from
       the mesh_neighbour_update() to handle the beacon frames of the above
       neighbor mesh node. since its atomic callback, ath10k driver queue the
       work (ath10k_sta_rc_update_wk) to handle rc update.
    3. Due to driver sta_state callback fails (step 1), mac80211 free the station
       object.
    4. When the worker (ath10k_sta_rc_update_wk) scheduled to run, it will access
       the station object which is already deleted. so it will trigger kernel
       panic.
    
    Added the peer exist check in sta_rc_update callback before queue the work.
    
    Kernel Panic log:
    
    Unable to handle kernel NULL pointer dereference at virtual address 00000000
    pgd = c0204000
    [00000000] *pgd=00000000
    Internal error: Oops: 17 [#1] PREEMPT SMP ARM
    CPU: 1 PID: 1833 Comm: kworker/u4:2 Not tainted 3.14.77 #1
    task: dcef0000 ti: d72b6000 task.ti: d72b6000
    PC is at pwq_activate_delayed_work+0x10/0x40
    LR is at pwq_activate_delayed_work+0xc/0x40
    pc : [<c023f988>]    lr : [<c023f984>]    psr: 40000193
    sp : d72b7f18  ip : 0000007a  fp : d72b6000
    r10: 00000000  r9 : dd404414  r8 : d8c31998
    r7 : d72b6038  r6 : 00000004  r5 : d4907ec8  r4 : dcee1300
    r3 : ffffffe0  r2 : 00000000  r1 : 00000001  r0 : 00000000
    Flags: nZcv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
    Control: 10c5787d  Table: 595bc06a  DAC: 00000015
    ...
    Process kworker/u4:2 (pid: 1833, stack limit = 0xd72b6238)
    Stack: (0xd72b7f18 to 0xd72b8000)
    7f00:                                                       00000001 dcee1300
    7f20: 00000001 c02410dc d8c31980 dd404400 dd404400 c0242790 d8c31980 00000089
    7f40: 00000000 d93e1340 00000000 d8c31980 c0242568 00000000 00000000 00000000
    7f60: 00000000 c02474dc 00000000 00000000 000000f8 d8c31980 00000000 00000000
    7f80: d72b7f80 d72b7f80 00000000 00000000 d72b7f90 d72b7f90 d72b7fac d93e1340
    7fa0: c0247404 00000000 00000000 c0208d20 00000000 00000000 00000000 00000000
    7fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
    7fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
    [<c023f988>] (pwq_activate_delayed_work) from [<c02410dc>] (pwq_dec_nr_in_flight+0x58/0xc4)
    [<c02410dc>] (pwq_dec_nr_in_flight) from [<c0242790>] (worker_thread+0x228/0x360)
    [<c0242790>] (worker_thread) from [<c02474dc>] (kthread+0xd8/0xec)
    [<c02474dc>] (kthread) from [<c0208d20>] (ret_from_fork+0x14/0x34)
    Code: e92d4038 e1a05000 ebffffbc[69210.619376] SMP: failed to stop secondary CPUs
    Rebooting in 3 seconds..
    
    Signed-off-by: Karthikeyan Periyasamy <periyasa@codeaurora.org>
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ff98be440c07d70739c8e31b736758cf7ae3f229
Author: Leon Romanovsky <leonro@mellanox.com>
Date:   Tue Jan 2 16:49:56 2018 +0200

    net/mlx5: Protect from command bit overflow
    
    [ Upstream commit 957f6ba8adc7be401a74ccff427e4cfd88d3bfcb ]
    
    The system with CONFIG_UBSAN enabled on produces the following error
    during driver initialization. The reason to it that max_reg_cmds can be
    larger enough to cause to "1 << max_reg_cmds" overflow the unsigned long.
    
    ================================================================================
    UBSAN: Undefined behaviour in drivers/net/ethernet/mellanox/mlx5/core/cmd.c:1805:42
    signed integer overflow:
    -2147483648 - 1 cannot be represented in type 'int'
    CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.15.0-rc2-00032-g06cda2358d9b-dirty #724
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.7.5-0-ge51488c-20140602_164612-nilsson.home.kraxel.org 04/01/2014
    Call Trace:
     dump_stack+0xe9/0x18f
     ? dma_virt_alloc+0x81/0x81
     ubsan_epilogue+0xe/0x4e
     handle_overflow+0x187/0x20c
     mlx5_cmd_init+0x73a/0x12b0
     mlx5_load_one+0x1c3d/0x1d30
     init_one+0xd02/0xf10
     pci_device_probe+0x26c/0x3b0
     driver_probe_device+0x622/0xb40
     __driver_attach+0x175/0x1b0
     bus_for_each_dev+0xef/0x190
     bus_add_driver+0x2db/0x490
     driver_register+0x16b/0x1e0
     __pci_register_driver+0x177/0x1b0
     init+0x6d/0x92
     do_one_initcall+0x15b/0x270
     kernel_init_freeable+0x2d8/0x3d0
     kernel_init+0x14/0x190
     ret_from_fork+0x24/0x30
    ================================================================================
    
    Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
    Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit adef5f75f416f2f1a0ec10d7e0c33532bedd1a1b
Author: Frank Asseg <frank.asseg@objecthunter.net>
Date:   Mon Mar 12 19:57:06 2018 +0100

    tools/thermal: tmon: fix for segfault
    
    [ Upstream commit 6c59f64b7ecf2bccbe73931d7d573d66ed13b537 ]
    
    Fixes a segfault occurring when e.g. <TAB> is pressed multiple times in the
    ncurses tmon application. The segfault is caused by incrementing
    cur_thermal_record in the main function without checking if it's value reached
    NR_THERMAL_RECORD immediately. Since the boundary check only occurred in
    update_thermal_data a race condition existed, which lead to an attempted read
    beyond the last element of the trec array.
    
    The fix was implemented by moving the cur_thermal_record incrementation to the
    update_thermal_data function using a temporary variable on which the boundary
    condition is checked before updating cur_thread_record, so that the variable is
    never incremented beyond the trec array's boundary.
    
    It seems the segfault does not occur on every machine: On a HP EliteBook G4 the
    segfault happens, while it does not happen on a Thinkpad T540p.
    
    Signed-off-by: Frank Asseg <frank.asseg@objecthunter.net>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 675944019d97dee47b701c0bfb18c98bed21ff52
Author: Michael Ellerman <mpe@ellerman.id.au>
Date:   Wed Mar 21 17:10:24 2018 +0530

    powerpc/perf: Fix kernel address leak via sampling registers
    
    [ Upstream commit e1ebd0e5b9d0a10ba65e63a3514b6da8c6a5a819 ]
    
    Current code in power_pmu_disable() does not clear the sampling
    registers like Sampling Instruction Address Register (SIAR) and
    Sampling Data Address Register (SDAR) after disabling the PMU. Since
    these are userspace readable and could contain kernel addresses, add
    code to explicitly clear the content of these registers.
    
    Also add a "context synchronizing instruction" to enforce no further
    updates to these registers as suggested by Power ISA v3.0B. From
    section 9.4, on page 1108:
    
      "If an mtspr instruction is executed that changes the value of a
      Performance Monitor register other than SIAR, SDAR, and SIER, the
      change is not guaranteed to have taken effect until after a
      subsequent context synchronizing instruction has been executed (see
      Chapter 11. "Synchronization Requirements for Context Alterations"
      on page 1133)."
    
    Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
    [mpe: Massage change log and add ISA reference]
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9d2d68f23d1fae6e90741dd2da543f1b53b173a4
Author: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Date:   Wed Mar 21 17:10:25 2018 +0530

    powerpc/perf: Prevent kernel address leak to userspace via BHRB buffer
    
    [ Upstream commit bb19af816025d495376bd76bf6fbcf4244f9a06d ]
    
    The current Branch History Rolling Buffer (BHRB) code does not check
    for any privilege levels before updating the data from BHRB. This
    could leak kernel addresses to userspace even when profiling only with
    userspace privileges. Add proper checks to prevent it.
    
    Acked-by: Balbir Singh <bsingharora@gmail.com>
    Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6631ce183c5f87abcff841a681d5c734f9286133
Author: Guenter Roeck <linux@roeck-us.net>
Date:   Mon Mar 26 19:50:31 2018 -0700

    hwmon: (nct6775) Fix writing pwmX_mode
    
    [ Upstream commit 415eb2a1aaa4881cf85bd86c683356fdd8094a23 ]
    
    pwmX_mode is defined in the ABI as 0=DC mode, 1=pwm mode. The chip
    register bit is set to 1 for DC mode. This got mixed up, and writing
    1 into pwmX_mode resulted in DC mode enabled. Fix it up by using
    the ABI definition throughout the driver for consistency.
    
    Fixes: 77eb5b3703d99 ("hwmon: (nct6775) Add support for pwm, pwm_mode, ... ")
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8482ee536c0e216d1e044b613bf168252bd3d05f
Author: Helge Deller <deller@gmx.de>
Date:   Sun Mar 25 14:04:22 2018 +0200

    parisc/pci: Switch LBA PCI bus from Hard Fail to Soft Fail mode
    
    [ Upstream commit b845f66f78bf42a4ce98e5cfe0e94fab41dd0742 ]
    
    Carlo Pisani noticed that his C3600 workstation behaved unstable during heavy
    I/O on the PCI bus with a VIA VT6421 IDE/SATA PCI card.
    
    To avoid such instability, this patch switches the LBA PCI bus from Hard Fail
    mode into Soft Fail mode. In this mode the bus will return -1UL for timed out
    MMIO transactions, which is exactly how the x86 (and most other architectures)
    PCI busses behave.
    
    This patch is based on a proposal by Grant Grundler and Kyle McMartin 10
    years ago:
    https://www.spinics.net/lists/linux-parisc/msg01027.html
    
    Cc: Carlo Pisani <carlojpisani@gmail.com>
    Cc: Kyle McMartin <kyle@mcmartin.ca>
    Reviewed-by: Grant Grundler <grantgrundler@gmail.com>
    Signed-off-by: Helge Deller <deller@gmx.de>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2231cc411a037eee7afc91904661cdb3a2f672d7
Author: Greg Ungerer <gerg@linux-m68k.org>
Date:   Wed Mar 28 17:12:18 2018 +1000

    m68k: set dma and coherent masks for platform FEC ethernets
    
    [ Upstream commit f61e64310b75733d782e930d1fb404b84699eed6 ]
    
    As of commit 205e1b7f51e4 ("dma-mapping: warn when there is no
    coherent_dma_mask") the Freescale FEC driver is issuing the following
    warning on driver initialization on ColdFire systems:
    
    WARNING: CPU: 0 PID: 1 at ./include/linux/dma-mapping.h:516 0x40159e20
    Modules linked in:
    CPU: 0 PID: 1 Comm: swapper Not tainted 4.16.0-rc7-dirty #4
    Stack from 41833dd8:
            41833dd8 40259c53 40025534 40279e26 00000003 00000000 4004e514 41827000
            400255de 40244e42 00000204 40159e20 00000009 00000000 00000000 4024531d
            40159e20 40244e42 00000204 00000000 00000000 00000000 00000007 00000000
            00000000 40279e26 4028d040 40226576 4003ae88 40279e26 418273f6 41833ef8
            7fffffff 418273f2 41867028 4003c9a2 4180ac6c 00000004 41833f8c 4013e71c
            40279e1c 40279e26 40226c16 4013ced2 40279e26 40279e58 4028d040 00000000
    Call Trace:
            [<40025534>] 0x40025534
     [<4004e514>] 0x4004e514
     [<400255de>] 0x400255de
     [<40159e20>] 0x40159e20
     [<40159e20>] 0x40159e20
    
    It is not fatal, the driver and the system continue to function normally.
    
    As per the warning the coherent_dma_mask is not set on this device.
    There is nothing special about the DMA memory coherency on this hardware
    so we can just set the mask to 32bits in the platform data for the FEC
    ethernet devices.
    
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1699271ab466e92757fb895d567c959181cfa290
Author: Michael Ellerman <mpe@ellerman.id.au>
Date:   Fri Mar 30 23:27:25 2018 +1100

    powerpc/mpic: Check if cpu_possible() in mpic_physmask()
    
    [ Upstream commit 0834d627fbea00c1444075eb3e448e1974da452d ]
    
    In mpic_physmask() we loop over all CPUs up to 32, then get the hard
    SMP processor id of that CPU.
    
    Currently that's possibly walking off the end of the paca array, but
    in a future patch we will change the paca array to be an array of
    pointers, and in that case we will get a NULL for missing CPUs and
    oops. eg:
    
      Unable to handle kernel paging request for data at address 0x88888888888888b8
      Faulting instruction address: 0xc00000000004e380
      Oops: Kernel access of bad area, sig: 11 [#1]
      ...
      NIP .mpic_set_affinity+0x60/0x1a0
      LR  .irq_do_set_affinity+0x48/0x100
    
    Fix it by checking the CPU is possible, this also fixes the code if
    there are gaps in the CPU numbering which probably never happens on
    mpic systems but who knows.
    
    Debugged-by: Nicholas Piggin <npiggin@gmail.com>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c893df8b44bb2c18f6875c918f3d3b778c195fe3
Author: Lenny Szubowicz <lszubowi@redhat.com>
Date:   Tue Mar 27 09:56:40 2018 -0400

    ACPI: acpi_pad: Fix memory leak in power saving threads
    
    [ Upstream commit 8b29d29abc484d638213dd79a18a95ae7e5bb402 ]
    
    Fix once per second (round_robin_time) memory leak of about 1 KB in
    each acpi_pad kernel idling thread that is activated.
    
    Found by testing with kmemleak.
    
    Signed-off-by: Lenny Szubowicz <lszubowi@redhat.com>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6ba54321af564567b7e714a4baac95b95be57a72
Author: Dan Carpenter <dan.carpenter@oracle.com>
Date:   Thu Mar 29 12:01:53 2018 +0300

    xen/acpi: off by one in read_acpi_id()
    
    [ Upstream commit c37a3c94775855567b90f91775b9691e10bd2806 ]
    
    If acpi_id is == nr_acpi_bits, then we access one element beyond the end
    of the acpi_psd[] array or we set one bit beyond the end of the bit map
    when we do __set_bit(acpi_id, acpi_id_present);
    
    Fixes: 59a568029181 ("xen/acpi-processor: C and P-state driver that uploads said data to hypervisor.")
    Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
    Reviewed-by: Joao Martins <joao.m.martins@oracle.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 84901fa446579c76a3bad996134953c00dd86569
Author: Jeff Mahoney <jeffm@suse.com>
Date:   Fri Mar 16 14:36:27 2018 -0400

    btrfs: fix lockdep splat in btrfs_alloc_subvolume_writers
    
    [ Upstream commit 8a5a916d9a35e13576d79cc16e24611821b13e34 ]
    
    While running btrfs/011, I hit the following lockdep splat.
    
    This is the important bit:
       pcpu_alloc+0x1ac/0x5e0
       __percpu_counter_init+0x4e/0xb0
       btrfs_init_fs_root+0x99/0x1c0 [btrfs]
       btrfs_get_fs_root.part.54+0x5b/0x150 [btrfs]
       resolve_indirect_refs+0x130/0x830 [btrfs]
       find_parent_nodes+0x69e/0xff0 [btrfs]
       btrfs_find_all_roots_safe+0xa0/0x110 [btrfs]
       btrfs_find_all_roots+0x50/0x70 [btrfs]
       btrfs_qgroup_prepare_account_extents+0x53/0x90 [btrfs]
       btrfs_commit_transaction+0x3ce/0x9b0 [btrfs]
    
    The percpu_counter_init call in btrfs_alloc_subvolume_writers
    uses GFP_KERNEL, which we can't do during transaction commit.
    
    This switches it to GFP_NOFS.
    
    ========================================================
    WARNING: possible irq lock inversion dependency detected
    4.12.14-kvmsmall #8 Tainted: G        W
    --------------------------------------------------------
    kswapd0/50 just changed the state of lock:
     (&delayed_node->mutex){+.+.-.}, at: [<ffffffffc06994fa>] __btrfs_release_delayed_node+0x3a/0x1f0 [btrfs]
    but this lock took another, RECLAIM_FS-unsafe lock in the past:
     (pcpu_alloc_mutex){+.+.+.}
    
    and interrupts could create inverse lock ordering between them.
    
    other info that might help us debug this:
    Chain exists of:
      &delayed_node->mutex --> &found->groups_sem --> pcpu_alloc_mutex
    
     Possible interrupt unsafe locking scenario:
    
           CPU0                    CPU1
           ----                    ----
      lock(pcpu_alloc_mutex);
                                   local_irq_disable();
                                   lock(&delayed_node->mutex);
                                   lock(&found->groups_sem);
      <Interrupt>
        lock(&delayed_node->mutex);
    
     *** DEADLOCK ***
    
    2 locks held by kswapd0/50:
     #0:  (shrinker_rwsem){++++..}, at: [<ffffffff811dc11f>] shrink_slab+0x7f/0x5b0
     #1:  (&type->s_umount_key#30){+++++.}, at: [<ffffffff8126dec6>] trylock_super+0x16/0x50
    
    the shortest dependencies between 2nd lock and 1st lock:
       -> (pcpu_alloc_mutex){+.+.+.} ops: 4904 {
          HARDIRQ-ON-W at:
                              __mutex_lock+0x4e/0x8c0
                              pcpu_alloc+0x1ac/0x5e0
                              alloc_kmem_cache_cpus.isra.70+0x25/0xa0
                              __do_tune_cpucache+0x2c/0x220
                              do_tune_cpucache+0x26/0xc0
                              enable_cpucache+0x6d/0xf0
                              kmem_cache_init_late+0x42/0x75
                              start_kernel+0x343/0x4cb
                              x86_64_start_kernel+0x127/0x134
                              secondary_startup_64+0xa5/0xb0
          SOFTIRQ-ON-W at:
                              __mutex_lock+0x4e/0x8c0
                              pcpu_alloc+0x1ac/0x5e0
                              alloc_kmem_cache_cpus.isra.70+0x25/0xa0
                              __do_tune_cpucache+0x2c/0x220
                              do_tune_cpucache+0x26/0xc0
                              enable_cpucache+0x6d/0xf0
                              kmem_cache_init_late+0x42/0x75
                              start_kernel+0x343/0x4cb
                              x86_64_start_kernel+0x127/0x134
                              secondary_startup_64+0xa5/0xb0
          RECLAIM_FS-ON-W at:
                                 __kmalloc+0x47/0x310
                                 pcpu_extend_area_map+0x2b/0xc0
                                 pcpu_alloc+0x3ec/0x5e0
                                 alloc_kmem_cache_cpus.isra.70+0x25/0xa0
                                 __do_tune_cpucache+0x2c/0x220
                                 do_tune_cpucache+0x26/0xc0
                                 enable_cpucache+0x6d/0xf0
                                 __kmem_cache_create+0x1bf/0x390
                                 create_cache+0xba/0x1b0
                                 kmem_cache_create+0x1f8/0x2b0
                                 ksm_init+0x6f/0x19d
                                 do_one_initcall+0x50/0x1b0
                                 kernel_init_freeable+0x201/0x289
                                 kernel_init+0xa/0x100
                                 ret_from_fork+0x3a/0x50
          INITIAL USE at:
                             __mutex_lock+0x4e/0x8c0
                             pcpu_alloc+0x1ac/0x5e0
                             alloc_kmem_cache_cpus.isra.70+0x25/0xa0
                             setup_cpu_cache+0x2f/0x1f0
                             __kmem_cache_create+0x1bf/0x390
                             create_boot_cache+0x8b/0xb1
                             kmem_cache_init+0xa1/0x19e
                             start_kernel+0x270/0x4cb
                             x86_64_start_kernel+0x127/0x134
                             secondary_startup_64+0xa5/0xb0
        }
        ... key      at: [<ffffffff821d8e70>] pcpu_alloc_mutex+0x70/0xa0
        ... acquired at:
       pcpu_alloc+0x1ac/0x5e0
       __percpu_counter_init+0x4e/0xb0
       btrfs_init_fs_root+0x99/0x1c0 [btrfs]
       btrfs_get_fs_root.part.54+0x5b/0x150 [btrfs]
       resolve_indirect_refs+0x130/0x830 [btrfs]
       find_parent_nodes+0x69e/0xff0 [btrfs]
       btrfs_find_all_roots_safe+0xa0/0x110 [btrfs]
       btrfs_find_all_roots+0x50/0x70 [btrfs]
       btrfs_qgroup_prepare_account_extents+0x53/0x90 [btrfs]
       btrfs_commit_transaction+0x3ce/0x9b0 [btrfs]
       transaction_kthread+0x176/0x1b0 [btrfs]
       kthread+0x102/0x140
       ret_from_fork+0x3a/0x50
    
      -> (&fs_info->commit_root_sem){++++..} ops: 1566382 {
         HARDIRQ-ON-W at:
                            down_write+0x3e/0xa0
                            cache_block_group+0x287/0x420 [btrfs]
                            find_free_extent+0x106c/0x12d0 [btrfs]
                            btrfs_reserve_extent+0xd8/0x170 [btrfs]
                            cow_file_range.isra.66+0x133/0x470 [btrfs]
                            run_delalloc_range+0x121/0x410 [btrfs]
                            writepage_delalloc.isra.50+0xfe/0x180 [btrfs]
                            __extent_writepage+0x19a/0x360 [btrfs]
                            extent_write_cache_pages.constprop.56+0x249/0x3e0 [btrfs]
                            extent_writepages+0x4d/0x60 [btrfs]
                            do_writepages+0x1a/0x70
                            __filemap_fdatawrite_range+0xa7/0xe0
                            btrfs_rename+0x5ee/0xdb0 [btrfs]
                            vfs_rename+0x52a/0x7e0
                            SyS_rename+0x351/0x3b0
                            do_syscall_64+0x79/0x1e0
                            entry_SYSCALL_64_after_hwframe+0x42/0xb7
         HARDIRQ-ON-R at:
                            down_read+0x35/0x90
                            caching_thread+0x57/0x560 [btrfs]
                            normal_work_helper+0x1c0/0x5e0 [btrfs]
                            process_one_work+0x1e0/0x5c0
                            worker_thread+0x44/0x390
                            kthread+0x102/0x140
                            ret_from_fork+0x3a/0x50
         SOFTIRQ-ON-W at:
                            down_write+0x3e/0xa0
                            cache_block_group+0x287/0x420 [btrfs]
                            find_free_extent+0x106c/0x12d0 [btrfs]
                            btrfs_reserve_extent+0xd8/0x170 [btrfs]
                            cow_file_range.isra.66+0x133/0x470 [btrfs]
                            run_delalloc_range+0x121/0x410 [btrfs]
                            writepage_delalloc.isra.50+0xfe/0x180 [btrfs]
                            __extent_writepage+0x19a/0x360 [btrfs]
                            extent_write_cache_pages.constprop.56+0x249/0x3e0 [btrfs]
                            extent_writepages+0x4d/0x60 [btrfs]
                            do_writepages+0x1a/0x70
                            __filemap_fdatawrite_range+0xa7/0xe0
                            btrfs_rename+0x5ee/0xdb0 [btrfs]
                            vfs_rename+0x52a/0x7e0
                            SyS_rename+0x351/0x3b0
                            do_syscall_64+0x79/0x1e0
                            entry_SYSCALL_64_after_hwframe+0x42/0xb7
         SOFTIRQ-ON-R at:
                            down_read+0x35/0x90
                            caching_thread+0x57/0x560 [btrfs]
                            normal_work_helper+0x1c0/0x5e0 [btrfs]
                            process_one_work+0x1e0/0x5c0
                            worker_thread+0x44/0x390
                            kthread+0x102/0x140
                            ret_from_fork+0x3a/0x50
         INITIAL USE at:
                           down_write+0x3e/0xa0
                           cache_block_group+0x287/0x420 [btrfs]
                           find_free_extent+0x106c/0x12d0 [btrfs]
                           btrfs_reserve_extent+0xd8/0x170 [btrfs]
                           cow_file_range.isra.66+0x133/0x470 [btrfs]
                           run_delalloc_range+0x121/0x410 [btrfs]
                           writepage_delalloc.isra.50+0xfe/0x180 [btrfs]
                           __extent_writepage+0x19a/0x360 [btrfs]
                           extent_write_cache_pages.constprop.56+0x249/0x3e0 [btrfs]
                           extent_writepages+0x4d/0x60 [btrfs]
                           do_writepages+0x1a/0x70
                           __filemap_fdatawrite_range+0xa7/0xe0
                           btrfs_rename+0x5ee/0xdb0 [btrfs]
                           vfs_rename+0x52a/0x7e0
                           SyS_rename+0x351/0x3b0
                           do_syscall_64+0x79/0x1e0
                           entry_SYSCALL_64_after_hwframe+0x42/0xb7
       }
       ... key      at: [<ffffffffc0729578>] __key.61970+0x0/0xfffffffffff9aa88 [btrfs]
       ... acquired at:
       cache_block_group+0x287/0x420 [btrfs]
       find_free_extent+0x106c/0x12d0 [btrfs]
       btrfs_reserve_extent+0xd8/0x170 [btrfs]
       btrfs_alloc_tree_block+0x12f/0x4c0 [btrfs]
       btrfs_create_tree+0xbb/0x2a0 [btrfs]
       btrfs_create_uuid_tree+0x37/0x140 [btrfs]
       open_ctree+0x23c0/0x2660 [btrfs]
       btrfs_mount+0xd36/0xf90 [btrfs]
       mount_fs+0x3a/0x160
       vfs_kern_mount+0x66/0x150
       btrfs_mount+0x18c/0xf90 [btrfs]
       mount_fs+0x3a/0x160
       vfs_kern_mount+0x66/0x150
       do_mount+0x1c1/0xcc0
       SyS_mount+0x7e/0xd0
       do_syscall_64+0x79/0x1e0
       entry_SYSCALL_64_after_hwframe+0x42/0xb7
    
     -> (&found->groups_sem){++++..} ops: 2134587 {
        HARDIRQ-ON-W at:
                          down_write+0x3e/0xa0
                          __link_block_group+0x34/0x130 [btrfs]
                          btrfs_read_block_groups+0x33d/0x7b0 [btrfs]
                          open_ctree+0x2054/0x2660 [btrfs]
                          btrfs_mount+0xd36/0xf90 [btrfs]
                          mount_fs+0x3a/0x160
                          vfs_kern_mount+0x66/0x150
                          btrfs_mount+0x18c/0xf90 [btrfs]
                          mount_fs+0x3a/0x160
                          vfs_kern_mount+0x66/0x150
                          do_mount+0x1c1/0xcc0
                          SyS_mount+0x7e/0xd0
                          do_syscall_64+0x79/0x1e0
                          entry_SYSCALL_64_after_hwframe+0x42/0xb7
        HARDIRQ-ON-R at:
                          down_read+0x35/0x90
                          btrfs_calc_num_tolerated_disk_barrier_failures+0x113/0x1f0 [btrfs]
                          open_ctree+0x207b/0x2660 [btrfs]
                          btrfs_mount+0xd36/0xf90 [btrfs]
                          mount_fs+0x3a/0x160
                          vfs_kern_mount+0x66/0x150
                          btrfs_mount+0x18c/0xf90 [btrfs]
                          mount_fs+0x3a/0x160
                          vfs_kern_mount+0x66/0x150
                          do_mount+0x1c1/0xcc0
                          SyS_mount+0x7e/0xd0
                          do_syscall_64+0x79/0x1e0
                          entry_SYSCALL_64_after_hwframe+0x42/0xb7
        SOFTIRQ-ON-W at:
                          down_write+0x3e/0xa0
                          __link_block_group+0x34/0x130 [btrfs]
                          btrfs_read_block_groups+0x33d/0x7b0 [btrfs]
                          open_ctree+0x2054/0x2660 [btrfs]
                          btrfs_mount+0xd36/0xf90 [btrfs]
                          mount_fs+0x3a/0x160
                          vfs_kern_mount+0x66/0x150
                          btrfs_mount+0x18c/0xf90 [btrfs]
                          mount_fs+0x3a/0x160
                          vfs_kern_mount+0x66/0x150
                          do_mount+0x1c1/0xcc0
                          SyS_mount+0x7e/0xd0
                          do_syscall_64+0x79/0x1e0
                          entry_SYSCALL_64_after_hwframe+0x42/0xb7
        SOFTIRQ-ON-R at:
                          down_read+0x35/0x90
                          btrfs_calc_num_tolerated_disk_barrier_failures+0x113/0x1f0 [btrfs]
                          open_ctree+0x207b/0x2660 [btrfs]
                          btrfs_mount+0xd36/0xf90 [btrfs]
                          mount_fs+0x3a/0x160
                          vfs_kern_mount+0x66/0x150
                          btrfs_mount+0x18c/0xf90 [btrfs]
                          mount_fs+0x3a/0x160
                          vfs_kern_mount+0x66/0x150
                          do_mount+0x1c1/0xcc0
                          SyS_mount+0x7e/0xd0
                          do_syscall_64+0x79/0x1e0
                          entry_SYSCALL_64_after_hwframe+0x42/0xb7
        INITIAL USE at:
                         down_write+0x3e/0xa0
                         __link_block_group+0x34/0x130 [btrfs]
                         btrfs_read_block_groups+0x33d/0x7b0 [btrfs]
                         open_ctree+0x2054/0x2660 [btrfs]
                         btrfs_mount+0xd36/0xf90 [btrfs]
                         mount_fs+0x3a/0x160
                         vfs_kern_mount+0x66/0x150
                         btrfs_mount+0x18c/0xf90 [btrfs]
                         mount_fs+0x3a/0x160
                         vfs_kern_mount+0x66/0x150
                         do_mount+0x1c1/0xcc0
                         SyS_mount+0x7e/0xd0
                         do_syscall_64+0x79/0x1e0
                         entry_SYSCALL_64_after_hwframe+0x42/0xb7
      }
      ... key      at: [<ffffffffc0729488>] __key.59101+0x0/0xfffffffffff9ab78 [btrfs]
      ... acquired at:
       find_free_extent+0xcb4/0x12d0 [btrfs]
       btrfs_reserve_extent+0xd8/0x170 [btrfs]
       btrfs_alloc_tree_block+0x12f/0x4c0 [btrfs]
       __btrfs_cow_block+0x110/0x5b0 [btrfs]
       btrfs_cow_block+0xd7/0x290 [btrfs]
       btrfs_search_slot+0x1f6/0x960 [btrfs]
       btrfs_lookup_inode+0x2a/0x90 [btrfs]
       __btrfs_update_delayed_inode+0x65/0x210 [btrfs]
       btrfs_commit_inode_delayed_inode+0x121/0x130 [btrfs]
       btrfs_evict_inode+0x3fe/0x6a0 [btrfs]
       evict+0xc4/0x190
       __dentry_kill+0xbf/0x170
       dput+0x2ae/0x2f0
       SyS_rename+0x2a6/0x3b0
       do_syscall_64+0x79/0x1e0
       entry_SYSCALL_64_after_hwframe+0x42/0xb7
    
    -> (&delayed_node->mutex){+.+.-.} ops: 5580204 {
       HARDIRQ-ON-W at:
                        __mutex_lock+0x4e/0x8c0
                        btrfs_delayed_update_inode+0x46/0x6e0 [btrfs]
                        btrfs_update_inode+0x83/0x110 [btrfs]
                        btrfs_dirty_inode+0x62/0xe0 [btrfs]
                        touch_atime+0x8c/0xb0
                        do_generic_file_read+0x818/0xb10
                        __vfs_read+0xdc/0x150
                        vfs_read+0x8a/0x130
                        SyS_read+0x45/0xa0
                        do_syscall_64+0x79/0x1e0
                        entry_SYSCALL_64_after_hwframe+0x42/0xb7
       SOFTIRQ-ON-W at:
                        __mutex_lock+0x4e/0x8c0
                        btrfs_delayed_update_inode+0x46/0x6e0 [btrfs]
                        btrfs_update_inode+0x83/0x110 [btrfs]
                        btrfs_dirty_inode+0x62/0xe0 [btrfs]
                        touch_atime+0x8c/0xb0
                        do_generic_file_read+0x818/0xb10
                        __vfs_read+0xdc/0x150
                        vfs_read+0x8a/0x130
                        SyS_read+0x45/0xa0
                        do_syscall_64+0x79/0x1e0
                        entry_SYSCALL_64_after_hwframe+0x42/0xb7
       IN-RECLAIM_FS-W at:
                           __mutex_lock+0x4e/0x8c0
                           __btrfs_release_delayed_node+0x3a/0x1f0 [btrfs]
                           btrfs_evict_inode+0x22c/0x6a0 [btrfs]
                           evict+0xc4/0x190
                           dispose_list+0x35/0x50
                           prune_icache_sb+0x42/0x50
                           super_cache_scan+0x139/0x190
                           shrink_slab+0x262/0x5b0
                           shrink_node+0x2eb/0x2f0
                           kswapd+0x2eb/0x890
                           kthread+0x102/0x140
                           ret_from_fork+0x3a/0x50
       INITIAL USE at:
                       __mutex_lock+0x4e/0x8c0
                       btrfs_delayed_update_inode+0x46/0x6e0 [btrfs]
                       btrfs_update_inode+0x83/0x110 [btrfs]
                       btrfs_dirty_inode+0x62/0xe0 [btrfs]
                       touch_atime+0x8c/0xb0
                       do_generic_file_read+0x818/0xb10
                       __vfs_read+0xdc/0x150
                       vfs_read+0x8a/0x130
                       SyS_read+0x45/0xa0
                       do_syscall_64+0x79/0x1e0
                       entry_SYSCALL_64_after_hwframe+0x42/0xb7
     }
     ... key      at: [<ffffffffc072d488>] __key.56935+0x0/0xfffffffffff96b78 [btrfs]
     ... acquired at:
       __lock_acquire+0x264/0x11c0
       lock_acquire+0xbd/0x1e0
       __mutex_lock+0x4e/0x8c0
       __btrfs_release_delayed_node+0x3a/0x1f0 [btrfs]
       btrfs_evict_inode+0x22c/0x6a0 [btrfs]
       evict+0xc4/0x190
       dispose_list+0x35/0x50
       prune_icache_sb+0x42/0x50
       super_cache_scan+0x139/0x190
       shrink_slab+0x262/0x5b0
       shrink_node+0x2eb/0x2f0
       kswapd+0x2eb/0x890
       kthread+0x102/0x140
       ret_from_fork+0x3a/0x50
    
    stack backtrace:
    CPU: 1 PID: 50 Comm: kswapd0 Tainted: G        W        4.12.14-kvmsmall #8 SLE15 (unreleased)
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.0.0-prebuilt.qemu-project.org 04/01/2014
    Call Trace:
     dump_stack+0x78/0xb7
     print_irq_inversion_bug.part.38+0x19f/0x1aa
     check_usage_forwards+0x102/0x120
     ? ret_from_fork+0x3a/0x50
     ? check_usage_backwards+0x110/0x110
     mark_lock+0x16c/0x270
     __lock_acquire+0x264/0x11c0
     ? pagevec_lookup_entries+0x1a/0x30
     ? truncate_inode_pages_range+0x2b3/0x7f0
     lock_acquire+0xbd/0x1e0
     ? __btrfs_release_delayed_node+0x3a/0x1f0 [btrfs]
     __mutex_lock+0x4e/0x8c0
     ? __btrfs_release_delayed_node+0x3a/0x1f0 [btrfs]
     ? __btrfs_release_delayed_node+0x3a/0x1f0 [btrfs]
     ? btrfs_evict_inode+0x1f6/0x6a0 [btrfs]
     __btrfs_release_delayed_node+0x3a/0x1f0 [btrfs]
     btrfs_evict_inode+0x22c/0x6a0 [btrfs]
     evict+0xc4/0x190
     dispose_list+0x35/0x50
     prune_icache_sb+0x42/0x50
     super_cache_scan+0x139/0x190
     shrink_slab+0x262/0x5b0
     shrink_node+0x2eb/0x2f0
     kswapd+0x2eb/0x890
     kthread+0x102/0x140
     ? mem_cgroup_shrink_node+0x2c0/0x2c0
     ? kthread_create_on_node+0x40/0x40
     ret_from_fork+0x3a/0x50
    
    Signed-off-by: Jeff Mahoney <jeffm@suse.com>
    Reviewed-by: Liu Bo <bo.liu@linux.alibaba.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0ad62f3d268fbd6755b7c886224d7f7338dd71aa
Author: Filipe Manana <fdmanana@suse.com>
Date:   Mon Mar 26 23:59:12 2018 +0100

    Btrfs: fix copy_items() return value when logging an inode
    
    [ Upstream commit 8434ec46c6e3232cebc25a910363b29f5c617820 ]
    
    When logging an inode, at tree-log.c:copy_items(), if we call
    btrfs_next_leaf() at the loop which checks for the need to log holes, we
    need to make sure copy_items() returns the value 1 to its caller and
    not 0 (on success). This is because the path the caller passed was
    released and is now different from what is was before, and the caller
    expects a return value of 0 to mean both success and that the path
    has not changed, while a return value of 1 means both success and
    signals the caller that it can not reuse the path, it has to perform
    another tree search.
    
    Even though this is a case that should not be triggered on normal
    circumstances or very rare at least, its consequences can be very
    unpredictable (especially when replaying a log tree).
    
    Fixes: 16e7549f045d ("Btrfs: incompatible format change to remove hole extents")
    Signed-off-by: Filipe Manana <fdmanana@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 860f7a0e5dedf84636d320b327d5ceef4e2f6509
Author: Qu Wenruo <wqu@suse.com>
Date:   Tue Mar 27 20:44:18 2018 +0800

    btrfs: tests/qgroup: Fix wrong tree backref level
    
    [ Upstream commit 3c0efdf03b2d127f0e40e30db4e7aa0429b1b79a ]
    
    The extent tree of the test fs is like the following:
    
     BTRFS info (device (null)): leaf 16327509003777336587 total ptrs 1 free space 3919
      item 0 key (4096 168 4096) itemoff 3944 itemsize 51
              extent refs 1 gen 1 flags 2
              tree block key (68719476736 0 0) level 1
                                               ^^^^^^^
              ref#0: tree block backref root 5
    
    And it's using an empty tree for fs tree, so there is no way that its
    level can be 1.
    
    For REAL (created by mkfs) fs tree backref with no skinny metadata, the
    result should look like:
    
     item 3 key (30408704 EXTENT_ITEM 4096) itemoff 3845 itemsize 51
             refs 1 gen 4 flags TREE_BLOCK
             tree block key (256 INODE_ITEM 0) level 0
                                               ^^^^^^^
             tree block backref root 5
    
    Fix the level to 0, so it won't break later tree level checker.
    
    Fixes: faa2dbf004e8 ("Btrfs: add sanity tests for new qgroup accounting code")
    Signed-off-by: Qu Wenruo <wqu@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit bcc36315361731fd269a7dde11ca77ff87ab45a5
Author: David S. Miller <davem@davemloft.net>
Date:   Tue Apr 3 08:24:35 2018 -0700

    sparc64: Make atomic_xchg() an inline function rather than a macro.
    
    [ Upstream commit d13864b68e41c11e4231de90cf358658f6ecea45 ]
    
    This avoids a lot of -Wunused warnings such as:
    
    ====================
    kernel/debug/debug_core.c: In function ‘kgdb_cpu_enter’:
    ./arch/sparc/include/asm/cmpxchg_64.h:55:22: warning: value computed is not used [-Wunused-value]
     #define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
    
    ./arch/sparc/include/asm/atomic_64.h:86:30: note: in expansion of macro ‘xchg’
     #define atomic_xchg(v, new) (xchg(&((v)->counter), new))
                                  ^~~~
    kernel/debug/debug_core.c:508:4: note: in expansion of macro ‘atomic_xchg’
        atomic_xchg(&kgdb_active, cpu);
        ^~~~~~~~~~~
    ====================
    
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3f2e6156efb0e33f79ca1d0e7211baddd37ab9b6
Author: Sean Christopherson <sean.j.christopherson@intel.com>
Date:   Fri Mar 23 09:34:00 2018 -0700

    KVM: VMX: raise internal error for exception during invalid protected mode state
    
    [ Upstream commit add5ff7a216ee545a214013f26d1ef2f44a9c9f8 ]
    
    Exit to userspace with KVM_INTERNAL_ERROR_EMULATION if we encounter
    an exception in Protected Mode while emulating guest due to invalid
    guest state.  Unlike Big RM, KVM doesn't support emulating exceptions
    in PM, i.e. PM exceptions are always injected via the VMCS.  Because
    we will never do VMRESUME due to emulation_required, the exception is
    never realized and we'll keep emulating the faulting instruction over
    and over until we receive a signal.
    
    Exit to userspace iff there is a pending exception, i.e. don't exit
    simply on a requested event. The purpose of this check and exit is to
    aid in debugging a guest that is in all likelihood already doomed.
    Invalid guest state in PM is extremely limited in normal operation,
    e.g. it generally only occurs for a few instructions early in BIOS,
    and any exception at this time is all but guaranteed to be fatal.
    Non-vectored interrupts, e.g. INIT, SIPI and SMI, can be cleanly
    handled/emulated, while checking for vectored interrupts, e.g. INTR
    and NMI, without hitting false positives would add a fair amount of
    complexity for almost no benefit (getting hit by lightning seems
    more likely than encountering this specific scenario).
    
    Add a WARN_ON_ONCE to vmx_queue_exception() if we try to inject an
    exception via the VMCS and emulation_required is true.
    
    Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
    Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e42acd54ef4569c4e0f1a745c5b0bfc0eeff8728
Author: Davidlohr Bueso <dave@stgolabs.net>
Date:   Mon Apr 2 09:49:54 2018 -0700

    sched/rt: Fix rq->clock_update_flags < RQCF_ACT_SKIP warning
    
    [ Upstream commit d29a20645d5e929aa7e8616f28e5d8e1c49263ec ]
    
    While running rt-tests' pi_stress program I got the following splat:
    
      rq->clock_update_flags < RQCF_ACT_SKIP
      WARNING: CPU: 27 PID: 0 at kernel/sched/sched.h:960 assert_clock_updated.isra.38.part.39+0x13/0x20
    
      [...]
    
      <IRQ>
      enqueue_top_rt_rq+0xf4/0x150
      ? cpufreq_dbs_governor_start+0x170/0x170
      sched_rt_rq_enqueue+0x65/0x80
      sched_rt_period_timer+0x156/0x360
      ? sched_rt_rq_enqueue+0x80/0x80
      __hrtimer_run_queues+0xfa/0x260
      hrtimer_interrupt+0xcb/0x220
      smp_apic_timer_interrupt+0x62/0x120
      apic_timer_interrupt+0xf/0x20
      </IRQ>
    
      [...]
    
      do_idle+0x183/0x1e0
      cpu_startup_entry+0x5f/0x70
      start_secondary+0x192/0x1d0
      secondary_startup_64+0xa5/0xb0
    
    We can get rid of it be the "traditional" means of adding an
    update_rq_clock() call after acquiring the rq->lock in
    do_sched_rt_period_timer().
    
    The case for the RT task throttling (which this workload also hits)
    can be ignored in that the skip_update call is actually bogus and
    quite the contrary (the request bits are removed/reverted).
    
    By setting RQCF_UPDATED we really don't care if the skip is happening
    or not and will therefore make the assert_clock_updated() check happy.
    
    Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
    Reviewed-by: Matt Fleming <matt@codeblueprint.co.uk>
    Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Mike Galbraith <efault@gmx.de>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: dave@stgolabs.net
    Cc: linux-kernel@vger.kernel.org
    Cc: rostedt@goodmis.org
    Link: http://lkml.kernel.org/r/20180402164954.16255-1-dave@stgolabs.net
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a0270cd17b01d1c66a6815cd8e5121161bd161ce
Author: Nikolay Borisov <nborisov@suse.com>
Date:   Thu Apr 5 10:40:15 2018 +0300

    btrfs: Fix possible softlock on single core machines
    
    [ Upstream commit 1e1c50a929bc9e49bc3f9935b92450d9e69f8158 ]
    
    do_chunk_alloc implements a loop checking whether there is a pending
    chunk allocation and if so causes the caller do loop. Generally this
    loop is executed only once, however testing with btrfs/072 on a single
    core vm machines uncovered an extreme case where the system could loop
    indefinitely. This is due to a missing cond_resched when loop which
    doesn't give a chance to the previous chunk allocator finish its job.
    
    The fix is to simply add the missing cond_resched.
    
    Fixes: 6d74119f1a3e ("Btrfs: avoid taking the chunk_mutex in do_chunk_alloc")
    Signed-off-by: Nikolay Borisov <nborisov@suse.com>
    Reviewed-by: David Sterba <dsterba@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7253c7778691b991f369eafeb4f72fd0c6e5c34d
Author: Liu Bo <bo.liu@linux.alibaba.com>
Date:   Tue Apr 3 01:59:47 2018 +0800

    Btrfs: fix NULL pointer dereference in log_dir_items
    
    [ Upstream commit 80c0b4210a963e31529e15bf90519708ec947596 ]
    
    0, 1 and <0 can be returned by btrfs_next_leaf(), and when <0 is
    returned, path->nodes[0] could be NULL, log_dir_items lacks such a
    check for <0 and we may run into a null pointer dereference panic.
    
    Fixes: e02119d5a7b4 ("Btrfs: Add a write ahead tree log to optimize synchronous operations")
    Reviewed-by: Nikolay Borisov <nborisov@suse.com>
    Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b56cd693a93802c3ffbe3007a29f14a306c3f575
Author: Liu Bo <bo.liu@linux.alibaba.com>
Date:   Tue Apr 3 01:59:48 2018 +0800

    Btrfs: bail out on error during replay_dir_deletes
    
    [ Upstream commit b98def7ca6e152ee55e36863dddf6f41f12d1dc6 ]
    
    If errors were returned by btrfs_next_leaf(), replay_dir_deletes needs
    to bail out, otherwise @ret would be forced to be 0 after 'break;' and
    the caller won't be aware of it.
    
    Fixes: e02119d5a7b4 ("Btrfs: Add a write ahead tree log to optimize synchronous operations")
    Reviewed-by: Nikolay Borisov <nborisov@suse.com>
    Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1d79b1d257adbf9b2fc01fc4fa843dda8d2b1bb6
Author: Huang Ying <ying.huang@intel.com>
Date:   Thu Apr 5 16:23:20 2018 -0700

    mm: fix races between address_space dereference and free in page_evicatable
    
    [ Upstream commit e92bb4dd9673945179b1fc738c9817dd91bfb629 ]
    
    When page_mapping() is called and the mapping is dereferenced in
    page_evicatable() through shrink_active_list(), it is possible for the
    inode to be truncated and the embedded address space to be freed at the
    same time.  This may lead to the following race.
    
    CPU1                                                CPU2
    
    truncate(inode)                                     shrink_active_list()
      ...                                                 page_evictable(page)
      truncate_inode_page(mapping, page);
        delete_from_page_cache(page)
          spin_lock_irqsave(&mapping->tree_lock, flags);
            __delete_from_page_cache(page, NULL)
              page_cache_tree_delete(..)
                ...                                         mapping = page_mapping(page);
                page->mapping = NULL;
                ...
          spin_unlock_irqrestore(&mapping->tree_lock, flags);
          page_cache_free_page(mapping, page)
            put_page(page)
              if (put_page_testzero(page)) -> false
    - inode now has no pages and can be freed including embedded address_space
    
                                                            mapping_unevictable(mapping)
                                                              test_bit(AS_UNEVICTABLE, &mapping->flags);
    - we've dereferenced mapping which is potentially already free.
    
    Similar race exists between swap cache freeing and page_evicatable()
    too.
    
    The address_space in inode and swap cache will be freed after a RCU
    grace period.  So the races are fixed via enclosing the page_mapping()
    and address_space usage in rcu_read_lock/unlock().  Some comments are
    added in code to make it clear what is protected by the RCU read lock.
    
    Link: http://lkml.kernel.org/r/20180212081227.1940-1-ying.huang@intel.com
    Signed-off-by: "Huang, Ying" <ying.huang@intel.com>
    Reviewed-by: Jan Kara <jack@suse.cz>
    Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
    Cc: Mel Gorman <mgorman@techsingularity.net>
    Cc: Minchan Kim <minchan@kernel.org>
    Cc: "Huang, Ying" <ying.huang@intel.com>
    Cc: Johannes Weiner <hannes@cmpxchg.org>
    Cc: Michal Hocko <mhocko@suse.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 824c8192221e439f1dfc248ba4a4ad4ad3c2b058
Author: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>
Date:   Thu Apr 5 16:25:41 2018 -0700

    mm/ksm: fix interaction with THP
    
    [ Upstream commit 77da2ba0648a4fd52e5ff97b8b2b8dd312aec4b0 ]
    
    This patch fixes a corner case for KSM.  When two pages belong or
    belonged to the same transparent hugepage, and they should be merged,
    KSM fails to split the page, and therefore no merging happens.
    
    This bug can be reproduced by:
    * making sure ksm is running (in case disabling ksmtuned)
    * enabling transparent hugepages
    * allocating a THP-aligned 1-THP-sized buffer
      e.g. on amd64: posix_memalign(&p, 1<<21, 1<<21)
    * filling it with the same values
      e.g. memset(p, 42, 1<<21)
    * performing madvise to make it mergeable
      e.g. madvise(p, 1<<21, MADV_MERGEABLE)
    * waiting for KSM to perform a few scans
    
    The expected outcome is that the all the pages get merged (1 shared and
    the rest sharing); the actual outcome is that no pages get merged (1
    unshared and the rest volatile)
    
    The reason of this behaviour is that we increase the reference count
    once for both pages we want to merge, but if they belong to the same
    hugepage (or compound page), the reference counter used in both cases is
    the one of the head of the compound page.  This means that
    split_huge_page will find a value of the reference counter too high and
    will fail.
    
    This patch solves this problem by testing if the two pages to merge
    belong to the same hugepage when attempting to merge them.  If so, the
    hugepage is split safely.  This means that the hugepage is not split if
    not necessary.
    
    Link: http://lkml.kernel.org/r/1521548069-24758-1-git-send-email-imbrenda@linux.vnet.ibm.com
    Signed-off-by: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>
    Co-authored-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
    Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
    Cc: Andrea Arcangeli <aarcange@redhat.com>
    Cc: Minchan Kim <minchan@kernel.org>
    Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Christian Borntraeger <borntraeger@de.ibm.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4d6ceac4cd59a4b5d4ee250543c1665096a8fd09
Author: Esben Haabendal <eha@deif.com>
Date:   Sun Apr 8 22:17:01 2018 +0200

    dp83640: Ensure against premature access to PHY registers after reset
    
    [ Upstream commit 76327a35caabd1a932e83d6a42b967aa08584e5d ]
    
    The datasheet specifies a 3uS pause after performing a software
    reset. The default implementation of genphy_soft_reset() does not
    provide this, so implement soft_reset with the needed pause.
    
    Signed-off-by: Esben Haabendal <eha@deif.com>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit dd38f46b21b4f94f58e8b6723b895f633f9a98c4
Author: Dave Carroll <david.carroll@microsemi.com>
Date:   Tue Apr 3 15:50:42 2018 -0600

    scsi: aacraid: Insure command thread is not recursively stopped
    
    [ Upstream commit 1c6b41fb92936fa5facea464d5d7cbf855966d04 ]
    
    If a recursive IOP_RESET is invoked, usually due to the eh_thread
    handling errors after the first reset, be sure we flag that the command
    thread has been stopped to avoid an Oops of the form;
    
     [ 336.620256] CPU: 28 PID: 1193 Comm: scsi_eh_0 Kdump: loaded Not tainted 4.14.0-49.el7a.ppc64le #1
     [ 336.620297] task: c000003fd630b800 task.stack: c000003fd61a4000
     [ 336.620326] NIP: c000000000176794 LR: c00000000013038c CTR: c00000000024bc10
     [ 336.620361] REGS: c000003fd61a7720 TRAP: 0300 Not tainted (4.14.0-49.el7a.ppc64le)
     [ 336.620395] MSR: 9000000000009033 <SF,HV,EE,ME,IR,DR,RI,LE> CR: 22084022 XER: 20040000
     [ 336.620435] CFAR: c000000000130388 DAR: 0000000000000000 DSISR: 40000000 SOFTE: 1
     [ 336.620435] GPR00: c00000000013038c c000003fd61a79a0 c0000000014c7e00 0000000000000000
     [ 336.620435] GPR04: 000000000000000c 000000000000000c 9000000000009033 0000000000000477
     [ 336.620435] GPR08: 0000000000000477 0000000000000000 0000000000000000 c008000010f7d940
     [ 336.620435] GPR12: c00000000024bc10 c000000007a33400 c0000000001708a8 c000003fe3b881d8
     [ 336.620435] GPR16: c000003fe3b88060 c000003fd61a7d10 fffffffffffff000 000000000000001e
     [ 336.620435] GPR20: 0000000000000001 c000000000ebf1a0 0000000000000001 c000003fe3b88000
     [ 336.620435] GPR24: 0000000000000003 0000000000000002 c000003fe3b88840 c000003fe3b887e8
     [ 336.620435] GPR28: c000003fe3b88000 c000003fc8181788 0000000000000000 c000003fc8181700
     [ 336.620750] NIP [c000000000176794] exit_creds+0x34/0x160
     [ 336.620775] LR [c00000000013038c] __put_task_struct+0x8c/0x1f0
     [ 336.620804] Call Trace:
     [ 336.620817] [c000003fd61a79a0] [c000003fe3b88000] 0xc000003fe3b88000 (unreliable)
     [ 336.620853] [c000003fd61a79d0] [c00000000013038c] __put_task_struct+0x8c/0x1f0
     [ 336.620889] [c000003fd61a7a00] [c000000000171418] kthread_stop+0x1e8/0x1f0
     [ 336.620922] [c000003fd61a7a40] [c008000010f7448c] aac_reset_adapter+0x14c/0x8d0 [aacraid]
     [ 336.620959] [c000003fd61a7b00] [c008000010f60174] aac_eh_host_reset+0x84/0x100 [aacraid]
     [ 336.621010] [c000003fd61a7b30] [c000000000864f24] scsi_try_host_reset+0x74/0x180
     [ 336.621046] [c000003fd61a7bb0] [c000000000867ac0] scsi_eh_ready_devs+0xc00/0x14d0
     [ 336.625165] [c000003fd61a7ca0] [c0000000008699e0] scsi_error_handler+0x550/0x730
     [ 336.632101] [c000003fd61a7dc0] [c000000000170a08] kthread+0x168/0x1b0
     [ 336.639031] [c000003fd61a7e30] [c00000000000b528] ret_from_kernel_thread+0x5c/0xb4
     [ 336.645971] Instruction dump:
     [ 336.648743] 384216a0 7c0802a6 fbe1fff8 f8010010 f821ffd1 7c7f1b78 60000000 60000000
     [ 336.657056] 39400000 e87f0838 f95f0838 7c0004ac <7d401828> 314affff 7d40192d 40c2fff4
     [ 336.663997] -[ end trace 4640cf8d4945ad95 ]-
    
    So flag when the thread is stopped by setting the thread pointer to NULL.
    
    Signed-off-by: Dave Carroll <david.carroll@microsemi.com>
    Reviewed-by: Raghava Aditya Renukunta <raghavaaditya.renukunta@microsemi.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0fb0e2558ae3f12ee82a305a194e30ebd55c5a75
Author: Carlos Maiolino <cmaiolino@redhat.com>
Date:   Tue Apr 10 22:39:04 2018 -0700

    Force log to disk before reading the AGF during a fstrim
    
    [ Upstream commit 8c81dd46ef3c416b3b95e3020fb90dbd44e6140b ]
    
    Forcing the log to disk after reading the agf is wrong, we might be
    calling xfs_log_force with XFS_LOG_SYNC with a metadata lock held.
    
    This can cause a deadlock when racing a fstrim with a filesystem
    shutdown.
    
    The deadlock has been identified due a miscalculation bug in device-mapper
    dm-thin, which returns lack of space to its users earlier than the device itself
    really runs out of space, changing the device-mapper volume into an error state.
    
    The problem happened while filling the filesystem with a single file,
    triggering the bug in device-mapper, consequently causing an IO error
    and shutting down the filesystem.
    
    If such file is removed, and fstrim executed before the XFS finishes the
    shut down process, the fstrim process will end up holding the buffer
    lock, and going to sleep on the cil wait queue.
    
    At this point, the shut down process will try to wake up all the threads
    waiting on the cil wait queue, but for this, it will try to hold the
    same buffer log already held my the fstrim, locking up the filesystem.
    
    Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
    Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ab01cffced072c169d84c9d149480bc570adebb2
Author: Jens Axboe <axboe@kernel.dk>
Date:   Wed Apr 11 11:26:09 2018 -0600

    sr: get/drop reference to device in revalidate and check_events
    
    [ Upstream commit 2d097c50212e137e7b53ffe3b37561153eeba87d ]
    
    We can't just use scsi_cd() to get the scsi_cd structure, we have
    to grab a live reference to the device. For both callbacks, we're
    not inside an open where we already hold a reference to the device.
    
    This fixes device removal/addition under concurrent device access,
    which otherwise could result in the below oops.
    
    NULL pointer dereference at 0000000000000010
    PGD 0 P4D 0
    Oops: 0000 [#1] PREEMPT SMP
    Modules linked in:
    sr 12:0:0:0: [sr2] scsi-1 drive
     scsi_debug crc_t10dif crct10dif_generic crct10dif_common nvme nvme_core sb_edac xl
    sr 12:0:0:0: Attached scsi CD-ROM sr2
     sr_mod cdrom btrfs xor zstd_decompress zstd_compress xxhash lzo_compress zlib_defc
    sr 12:0:0:0: Attached scsi generic sg7 type 5
     igb ahci libahci i2c_algo_bit libata dca [last unloaded: crc_t10dif]
    CPU: 43 PID: 4629 Comm: systemd-udevd Not tainted 4.16.0+ #650
    Hardware name: Dell Inc. PowerEdge T630/0NT78X, BIOS 2.3.4 11/09/2016
    RIP: 0010:sr_block_revalidate_disk+0x23/0x190 [sr_mod]
    RSP: 0018:ffff883ff357bb58 EFLAGS: 00010292
    RAX: ffffffffa00b07d0 RBX: ffff883ff3058000 RCX: ffff883ff357bb66
    RDX: 0000000000000003 RSI: 0000000000007530 RDI: ffff881fea631000
    RBP: 0000000000000000 R08: ffff881fe4d38400 R09: 0000000000000000
    R10: 0000000000000000 R11: 00000000000001b6 R12: 000000000800005d
    R13: 000000000800005d R14: ffff883ffd9b3790 R15: 0000000000000000
    FS:  00007f7dc8e6d8c0(0000) GS:ffff883fff340000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 0000000000000010 CR3: 0000003ffda98005 CR4: 00000000003606e0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    Call Trace:
     ? __invalidate_device+0x48/0x60
     check_disk_change+0x4c/0x60
     sr_block_open+0x16/0xd0 [sr_mod]
     __blkdev_get+0xb9/0x450
     ? iget5_locked+0x1c0/0x1e0
     blkdev_get+0x11e/0x320
     ? bdget+0x11d/0x150
     ? _raw_spin_unlock+0xa/0x20
     ? bd_acquire+0xc0/0xc0
     do_dentry_open+0x1b0/0x320
     ? inode_permission+0x24/0xc0
     path_openat+0x4e6/0x1420
     ? cpumask_any_but+0x1f/0x40
     ? flush_tlb_mm_range+0xa0/0x120
     do_filp_open+0x8c/0xf0
     ? __seccomp_filter+0x28/0x230
     ? _raw_spin_unlock+0xa/0x20
     ? __handle_mm_fault+0x7d6/0x9b0
     ? list_lru_add+0xa8/0xc0
     ? _raw_spin_unlock+0xa/0x20
     ? __alloc_fd+0xaf/0x160
     ? do_sys_open+0x1a6/0x230
     do_sys_open+0x1a6/0x230
     do_syscall_64+0x5a/0x100
     entry_SYSCALL_64_after_hwframe+0x3d/0xa2
    
    Reviewed-by: Lee Duncan <lduncan@suse.com>
    Reviewed-by: Jan Kara <jack@suse.cz>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c8199e33898d0697c19f07346b7e5ff019dcf5e0
Author: Tom Abraham <tabraham@suse.com>
Date:   Tue Apr 10 16:29:48 2018 -0700

    swap: divide-by-zero when zero length swap file on ssd
    
    [ Upstream commit a06ad633a37c64a0cd4c229fc605cee8725d376e ]
    
    Calling swapon() on a zero length swap file on SSD can lead to a
    divide-by-zero.
    
    Although creating such files isn't possible with mkswap and they woud be
    considered invalid, it would be better for the swapon code to be more
    robust and handle this condition gracefully (return -EINVAL).
    Especially since the fix is small and straightforward.
    
    To help with wear leveling on SSD, the swapon syscall calculates a
    random position in the swap file using modulo p->highest_bit, which is
    set to maxpages - 1 in read_swap_header.
    
    If the swap file is zero length, read_swap_header sets maxpages=1 and
    last_page=0, resulting in p->highest_bit=0 and we divide-by-zero when we
    modulo p->highest_bit in swapon syscall.
    
    This can be prevented by having read_swap_header return zero if
    last_page is zero.
    
    Link: http://lkml.kernel.org/r/5AC747C1020000A7001FA82C@prv-mh.provo.novell.com
    Signed-off-by: Thomas Abraham <tabraham@suse.com>
    Reported-by: <Mark.Landis@Teradata.com>
    Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
    Cc: Randy Dunlap <rdunlap@infradead.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b4b8334a00f4a7d61e9baad2d456703da3c5252f
Author: Danilo Krummrich <danilokrummrich@dk-develop.de>
Date:   Tue Apr 10 16:31:38 2018 -0700

    fs/proc/proc_sysctl.c: fix potential page fault while unregistering sysctl table
    
    [ Upstream commit a0b0d1c345d0317efe594df268feb5ccc99f651e ]
    
    proc_sys_link_fill_cache() does not take currently unregistering sysctl
    tables into account, which might result into a page fault in
    sysctl_follow_link() - add a check to fix it.
    
    This bug has been present since v3.4.
    
    Link: http://lkml.kernel.org/r/20180228013506.4915-1-danilokrummrich@dk-develop.de
    Fixes: 0e47c99d7fe25 ("sysctl: Replace root_list with links between sysctl_table_sets")
    Signed-off-by: Danilo Krummrich <danilokrummrich@dk-develop.de>
    Acked-by: Kees Cook <keescook@chromium.org>
    Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
    Cc: "Luis R . Rodriguez" <mcgrof@kernel.org>
    Cc: "Eric W. Biederman" <ebiederm@xmission.com>
    Cc: Alexey Dobriyan <adobriyan@gmail.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit af794b799a80cb855e251de3748a25f3700f0587
Author: Rich Felker <dalias@libc.org>
Date:   Thu Mar 15 20:01:36 2018 -0400

    sh: fix debug trap failure to process signals before return to user
    
    [ Upstream commit 96a598996f6ac518ac79839ecbb17c91af91f4f7 ]
    
    When responding to a debug trap (breakpoint) in userspace, the
    kernel's trap handler raised SIGTRAP but returned from the trap via a
    code path that ignored pending signals, resulting in an infinite loop
    re-executing the trapping instruction.
    
    Signed-off-by: Rich Felker <dalias@libc.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8035424c9c5b4bd249a21866e6507c51e19e7ecd
Author: Yelena Krivosheev <yelena@marvell.com>
Date:   Fri Mar 30 12:05:31 2018 +0200

    net: mvneta: fix enable of all initialized RXQs
    
    [ Upstream commit e81b5e01c14add8395dfba7130f8829206bb507d ]
    
    In mvneta_port_up() we enable relevant RX and TX port queues by write
    queues bit map to an appropriate register.
    
    q_map must be ZERO in the beginning of this process.
    
    Signed-off-by: Yelena Krivosheev <yelena@marvell.com>
    Acked-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit dbbe95b03e22475a2ecb54727eb3e3ecc14e50ac
Author: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
Date:   Thu Mar 29 19:05:29 2018 +0900

    net: Fix untag for vlan packets without ethernet header
    
    [ Upstream commit ae4745730cf8e693d354ccd4dbaf59ea440c09a9 ]
    
    In some situation vlan packets do not have ethernet headers. One example
    is packets from tun devices. Users can specify vlan protocol in tun_pi
    field instead of IP protocol, and skb_vlan_untag() attempts to untag such
    packets.
    
    skb_vlan_untag() (more precisely, skb_reorder_vlan_header() called by it)
    however did not expect packets without ethernet headers, so in such a case
    size argument for memmove() underflowed and triggered crash.
    
    ====
    BUG: unable to handle kernel paging request at ffff8801cccb8000
    IP: __memmove+0x24/0x1a0 arch/x86/lib/memmove_64.S:43
    PGD 9cee067 P4D 9cee067 PUD 1d9401063 PMD 1cccb7063 PTE 2810100028101
    Oops: 000b [#1] SMP KASAN
    Dumping ftrace buffer:
       (ftrace buffer empty)
    Modules linked in:
    CPU: 1 PID: 17663 Comm: syz-executor2 Not tainted 4.16.0-rc7+ #368
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
    RIP: 0010:__memmove+0x24/0x1a0 arch/x86/lib/memmove_64.S:43
    RSP: 0018:ffff8801cc046e28 EFLAGS: 00010287
    RAX: ffff8801ccc244c4 RBX: fffffffffffffffe RCX: fffffffffff6c4c2
    RDX: fffffffffffffffe RSI: ffff8801cccb7ffc RDI: ffff8801cccb8000
    RBP: ffff8801cc046e48 R08: ffff8801ccc244be R09: ffffed0039984899
    R10: 0000000000000001 R11: ffffed0039984898 R12: ffff8801ccc244c4
    R13: ffff8801ccc244c0 R14: ffff8801d96b7c06 R15: ffff8801d96b7b40
    FS:  00007febd562d700(0000) GS:ffff8801db300000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: ffff8801cccb8000 CR3: 00000001ccb2f006 CR4: 00000000001606e0
    DR0: 0000000020000000 DR1: 0000000020000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600
    Call Trace:
     memmove include/linux/string.h:360 [inline]
     skb_reorder_vlan_header net/core/skbuff.c:5031 [inline]
     skb_vlan_untag+0x470/0xc40 net/core/skbuff.c:5061
     __netif_receive_skb_core+0x119c/0x3460 net/core/dev.c:4460
     __netif_receive_skb+0x2c/0x1b0 net/core/dev.c:4627
     netif_receive_skb_internal+0x10b/0x670 net/core/dev.c:4701
     netif_receive_skb+0xae/0x390 net/core/dev.c:4725
     tun_rx_batched.isra.50+0x5ee/0x870 drivers/net/tun.c:1555
     tun_get_user+0x299e/0x3c20 drivers/net/tun.c:1962
     tun_chr_write_iter+0xb9/0x160 drivers/net/tun.c:1990
     call_write_iter include/linux/fs.h:1782 [inline]
     new_sync_write fs/read_write.c:469 [inline]
     __vfs_write+0x684/0x970 fs/read_write.c:482
     vfs_write+0x189/0x510 fs/read_write.c:544
     SYSC_write fs/read_write.c:589 [inline]
     SyS_write+0xef/0x220 fs/read_write.c:581
     do_syscall_64+0x281/0x940 arch/x86/entry/common.c:287
     entry_SYSCALL_64_after_hwframe+0x42/0xb7
    RIP: 0033:0x454879
    RSP: 002b:00007febd562cc68 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
    RAX: ffffffffffffffda RBX: 00007febd562d6d4 RCX: 0000000000454879
    RDX: 0000000000000157 RSI: 0000000020000180 RDI: 0000000000000014
    RBP: 000000000072bea0 R08: 0000000000000000 R09: 0000000000000000
    R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff
    R13: 00000000000006b0 R14: 00000000006fc120 R15: 0000000000000000
    Code: 90 90 90 90 90 90 90 48 89 f8 48 83 fa 20 0f 82 03 01 00 00 48 39 fe 7d 0f 49 89 f0 49 01 d0 49 39 f8 0f 8f 9f 00 00 00 48 89 d1 <f3> a4 c3 48 81 fa a8 02 00 00 72 05 40 38 fe 74 3b 48 83 ea 20
    RIP: __memmove+0x24/0x1a0 arch/x86/lib/memmove_64.S:43 RSP: ffff8801cc046e28
    CR2: ffff8801cccb8000
    ====
    
    We don't need to copy headers for packets which do not have preceding
    headers of vlan headers, so skip memmove() in that case.
    
    Fixes: 4bbb3e0e8239 ("net: Fix vlan untag for bridge and vlan_dev with reorder_hdr off")
    Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
    Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 65bdc34426769ee8411147cc07260c23c70f50f1
Author: Cong Wang <xiyou.wangcong@gmail.com>
Date:   Mon Mar 26 15:08:33 2018 -0700

    llc: properly handle dev_queue_xmit() return value
    
    [ Upstream commit b85ab56c3f81c5a24b5a5213374f549df06430da ]
    
    llc_conn_send_pdu() pushes the skb into write queue and
    calls llc_conn_send_pdus() to flush them out. However, the
    status of dev_queue_xmit() is not returned to caller,
    in this case, llc_conn_state_process().
    
    llc_conn_state_process() needs hold the skb no matter
    success or failure, because it still uses it after that,
    therefore we should hold skb before dev_queue_xmit() when
    that skb is the one being processed by llc_conn_state_process().
    
    For other callers, they can just pass NULL and ignore
    the return value as they are.
    
    Reported-by: Noam Rathaus <noamr@beyondsecurity.com>
    Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e42c5ccd2b68dc491767b03fcce8a43cda1809ca
Author: Giuseppe Lippolis <giu.lippolis@gmail.com>
Date:   Mon Mar 26 16:34:39 2018 +0200

    net-usb: add qmi_wwan if on lte modem wistron neweb d18q1
    
    [ Upstream commit d4c4bc11353f3bea6754f7d21e3612c9f32d1d64 ]
    
    This modem is embedded on dlink dwr-921 router.
        The oem configuration states:
    
        T:  Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=480 MxCh= 0
        D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
        P:  Vendor=1435 ProdID=0918 Rev= 2.32
        S:  Manufacturer=Android
        S:  Product=Android
        S:  SerialNumber=0123456789ABCDEF
        C:* #Ifs= 7 Cfg#= 1 Atr=80 MxPwr=500mA
        I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
        E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
        E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
        I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
        E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
        E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
        I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
        E:  Ad=84(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
        E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
        E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
        I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
        E:  Ad=86(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
        E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
        E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
        I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
        E:  Ad=88(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
        E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
        E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
        I:* If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
        E:  Ad=8a(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
        E:  Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
        E:  Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
        I:* If#= 6 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=(none)
        E:  Ad=8b(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
        E:  Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=125us
    
    Tested on openwrt distribution
    
    Signed-off-by: Giuseppe Lippolis <giu.lippolis@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4582e6d3ee724011adadb60c80a852c49502ad80
Author: Pawel Dembicki <paweldembicki@gmail.com>
Date:   Sat Mar 24 22:08:14 2018 +0100

    net: qmi_wwan: add BroadMobi BM806U 2020:2033
    
    [ Upstream commit 743989254ea9f132517806d8893ca9b6cf9dc86b ]
    
    BroadMobi BM806U is an Qualcomm MDM9225 based 3G/4G modem.
    Tested hardware BM806U is mounted on D-Link DWR-921-C3 router.
    The USB id is added to qmi_wwan.c to allow QMI communication with
    the BM806U.
    
    Tested on 4.14 kernel and OpenWRT.
    
    Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d6d9306ee0670a7999d5e333773d2fb51da98009
Author: Linus Lüssing <linus.luessing@c0d3.blue>
Date:   Thu Mar 22 00:21:32 2018 +0100

    batman-adv: fix packet loss for broadcasted DHCP packets to a server
    
    [ Upstream commit a752c0a4524889cdc0765925258fd1fd72344100 ]
    
    DHCP connectivity issues can currently occur if the following conditions
    are met:
    
    1) A DHCP packet from a client to a server
    2) This packet has a multicast destination
    3) This destination has a matching entry in the translation table
       (FF:FF:FF:FF:FF:FF for IPv4, 33:33:00:01:00:02/33:33:00:01:00:03
        for IPv6)
    4) The orig-node determined by TT for the multicast destination
       does not match the orig-node determined by best-gateway-selection
    
    In this case the DHCP packet will be dropped.
    
    The "gateway-out-of-range" check is supposed to only be applied to
    unicasted DHCP packets to a specific DHCP server.
    
    In that case dropping the the unicasted frame forces the client to
    retry via a broadcasted one, but now directed to the new best
    gateway.
    
    A DHCP packet with broadcast/multicast destination is already ensured to
    always be delivered to the best gateway. Dropping a multicasted
    DHCP packet here will only prevent completing DHCP as there is no
    other fallback.
    
    So far, it seems the unicast check was implicitly performed by
    expecting the batadv_transtable_search() to return NULL for multicast
    destinations. However, a multicast address could have always ended up in
    the translation table and in fact is now common.
    
    To fix this potential loss of a DHCP client-to-server packet to a
    multicast address this patch adds an explicit multicast destination
    check to reliably bail out of the gateway-out-of-range check for such
    destinations.
    
    The issue and fix were tested in the following three node setup:
    
    - Line topology, A-B-C
    - A: gateway client, DHCP client
    - B: gateway server, hop-penalty increased: 30->60, DHCP server
    - C: gateway server, code modifications to announce FF:FF:FF:FF:FF:FF
    
    Without this patch, A would never transmit its DHCP Discover packet
    due to an always "out-of-range" condition. With this patch,
    a full DHCP handshake between A and B was possible again.
    
    Fixes: be7af5cf9cae ("batman-adv: refactoring gateway handling code")
    Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
    Signed-off-by: Sven Eckelmann <sven@narfation.org>
    Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d0fb1d220b0b5f436e8737a105ae8bca31075eab
Author: Linus Lüssing <linus.luessing@c0d3.blue>
Date:   Tue Mar 20 03:13:27 2018 +0100

    batman-adv: fix multicast-via-unicast transmission with AP isolation
    
    [ Upstream commit f8fb3419ead44f9a3136995acd24e35da4525177 ]
    
    For multicast frames AP isolation is only supposed to be checked on
    the receiving nodes and never on the originating one.
    
    Furthermore, the isolation or wifi flag bits should only be intepreted
    as such for unicast and never multicast TT entries.
    
    By injecting flags to the multicast TT entry claimed by a single
    target node it was verified in tests that this multicast address
    becomes unreachable, leading to packet loss.
    
    Omitting the "src" parameter to the batadv_transtable_search() call
    successfully skipped the AP isolation check and made the target
    reachable again.
    
    Fixes: 1d8ab8d3c176 ("batman-adv: Modified forwarding behaviour for multicast packets")
    Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
    Signed-off-by: Sven Eckelmann <sven@narfation.org>
    Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b8506758363831ffc5716d55c97d3def1166bfd1
Author: Masami Hiramatsu <mhiramat@kernel.org>
Date:   Sat Mar 17 21:40:31 2018 +0900

    selftests: ftrace: Add a testcase for probepoint
    
    [ Upstream commit dfa453bc90eca0febff33c8d292a656e53702158 ]
    
    Add a testcase for probe point definition. This tests
    symbol, address and symbol+offset syntax. The offset
    must be positive and smaller than UINT_MAX.
    
    Link: http://lkml.kernel.org/r/152129043097.31874.14273580606301767394.stgit@devbox
    
    Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
    Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 053a459c8c8cfa584766f3c6712ae40e74e84ea2
Author: Masami Hiramatsu <mhiramat@kernel.org>
Date:   Sat Mar 17 21:39:44 2018 +0900

    selftests: ftrace: Add a testcase for string type with kprobe_event
    
    [ Upstream commit 5fbdbed797b6d12d043a5121fdbc8d8b49d10e80 ]
    
    Add a testcase for string type with kprobe event.
    This tests good/bad syntax combinations and also
    the traced data is correct in several way.
    
    Link: http://lkml.kernel.org/r/152129038381.31874.9201387794548737554.stgit@devbox
    
    Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
    Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1f8c76a6a205410927caa9204778927816ea2741
Author: Masami Hiramatsu <mhiramat@kernel.org>
Date:   Sat Mar 17 21:38:56 2018 +0900

    selftests: ftrace: Add probe event argument syntax testcase
    
    [ Upstream commit 871bef2000968c312a4000b2f56d370dcedbc93c ]
    
    Add a testcase for probe event argument syntax which
    ensures the kprobe_events interface correctly parses
    given event arguments.
    
    Link: http://lkml.kernel.org/r/152129033679.31874.12705519603869152799.stgit@devbox
    
    Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
    Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 36f5b18f7bea9df0818c312120bdfbe5d7bc9aea
Author: Yisheng Xie <xieyisheng1@huawei.com>
Date:   Thu Mar 22 16:17:02 2018 -0700

    mm/mempolicy.c: avoid use uninitialized preferred_node
    
    [ Upstream commit 8970a63e965b43288c4f5f40efbc2bbf80de7f16 ]
    
    Alexander reported a use of uninitialized memory in __mpol_equal(),
    which is caused by incorrect use of preferred_node.
    
    When mempolicy in mode MPOL_PREFERRED with flags MPOL_F_LOCAL, it uses
    numa_node_id() instead of preferred_node, however, __mpol_equal() uses
    preferred_node without checking whether it is MPOL_F_LOCAL or not.
    
    [akpm@linux-foundation.org: slight comment tweak]
    Link: http://lkml.kernel.org/r/4ebee1c2-57f6-bcb8-0e2d-1833d1ee0bb7@huawei.com
    Fixes: fc36b8d3d819 ("mempolicy: use MPOL_F_LOCAL to Indicate Preferred Local Policy")
    Signed-off-by: Yisheng Xie <xieyisheng1@huawei.com>
    Reported-by: Alexander Potapenko <glider@google.com>
    Tested-by: Alexander Potapenko <glider@google.com>
    Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
    Cc: Dmitriy Vyukov <dvyukov@google.com>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Cc: Michal Hocko <mhocko@kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 08a049c84408dfd0240a3340681486779c167cc8
Author: Stefano Brivio <sbrivio@redhat.com>
Date:   Thu Mar 15 17:16:29 2018 +0100

    vti4: Don't override MTU passed on link creation via IFLA_MTU
    
    [ Upstream commit 03080e5ec72740c1a62e6730f2a5f3f114f11b19 ]
    
    Don't hardcode a MTU value on vti tunnel initialization,
    ip_tunnel_newlink() is able to deal with this already. See also
    commit ffc2b6ee4174 ("ip_gre: fix IFLA_MTU ignored on NEWLINK").
    
    Fixes: 1181412c1a67 ("net/ipv4: VTI support new module for ip_vti.")
    Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
    Acked-by: Sabrina Dubroca <sd@queasysnail.net>
    Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4929eda28f3767addfb6e75cbbd462c01eef33ee
Author: Stefano Brivio <sbrivio@redhat.com>
Date:   Thu Mar 15 17:16:27 2018 +0100

    vti4: Don't count header length twice on tunnel setup
    
    [ Upstream commit dd1df24737727e119c263acf1be2a92763938297 ]
    
    This re-introduces the effect of commit a32452366b72 ("vti4:
    Don't count header length twice.") which was accidentally
    reverted by merge commit f895f0cfbb77 ("Merge branch 'master' of
    git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec").
    
    The commit message from Steffen Klassert said:
    
        We currently count the size of LL_MAX_HEADER and struct iphdr
        twice for vti4 devices, this leads to a wrong device mtu.
        The size of LL_MAX_HEADER and struct iphdr is already counted in
        ip_tunnel_bind_dev(), so don't do it again in vti_tunnel_init().
    
    And this is still the case now: ip_tunnel_bind_dev() already
    accounts for the header length of the link layer (not
    necessarily LL_MAX_HEADER, if the output device is found), plus
    one IP header.
    
    For example, with a vti device on top of veth, with MTU of 1500,
    the existing implementation would set the initial vti MTU to
    1332, accounting once for LL_MAX_HEADER (128, included in
    hard_header_len by vti) and twice for the same IP header (once
    from hard_header_len, once from ip_tunnel_bind_dev()).
    
    It should instead be 1480, because ip_tunnel_bind_dev() is able
    to figure out that the output device is veth, so no additional
    link layer header is attached, and will properly count one
    single IP header.
    
    The existing issue had the side effect of avoiding PMTUD for
    most xfrm policies, by arbitrarily lowering the initial MTU.
    However, the only way to get a consistent PMTU value is to let
    the xfrm PMTU discovery do its course, and commit d6af1a31cc72
    ("vti: Add pmtu handling to vti_xmit.") now takes care of local
    delivery cases where the application ignores local socket
    notifications.
    
    Fixes: b9959fd3b0fa ("vti: switch to new ip tunnel code")
    Fixes: f895f0cfbb77 ("Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec")
    Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
    Acked-by: Sabrina Dubroca <sd@queasysnail.net>
    Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 06b3c3f5bf043f42e00fae034ad387f8b6d58625
Author: Matthias Schiffer <mschiffer@universe-factory.net>
Date:   Fri Mar 16 11:29:10 2018 +0100

    batman-adv: fix header size check in batadv_dbg_arp()
    
    [ Upstream commit 6f27d2c2a8c236d296201c19abb8533ec20d212b ]
    
    Checking for 0 is insufficient: when an SKB without a batadv header, but
    with a VLAN header is received, hdr_size will be 4, making the following
    code interpret the Ethernet header as a batadv header.
    
    Fixes: be1db4f6615b ("batman-adv: make the Distributed ARP Table vlan aware")
    Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
    Signed-off-by: Sven Eckelmann <sven@narfation.org>
    Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 480739ce65497fddc32fb6d30887281644517a31
Author: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
Date:   Tue Mar 13 14:51:27 2018 +0900

    net: Fix vlan untag for bridge and vlan_dev with reorder_hdr off
    
    [ Upstream commit 4bbb3e0e8239f9079bf1fe20b3c0cb598714ae61 ]
    
    When we have a bridge with vlan_filtering on and a vlan device on top of
    it, packets would be corrupted in skb_vlan_untag() called from
    br_dev_xmit().
    
    The problem sits in skb_reorder_vlan_header() used in skb_vlan_untag(),
    which makes use of skb->mac_len. In this function mac_len is meant for
    handling rx path with vlan devices with reorder_header disabled, but in
    tx path mac_len is typically 0 and cannot be used, which is the problem
    in this case.
    
    The current code even does not properly handle rx path (skb_vlan_untag()
    called from __netif_receive_skb_core()) with reorder_header off actually.
    
    In rx path single tag case, it works as follows:
    
    - Before skb_reorder_vlan_header()
    
     mac_header                                data
       v                                        v
       +-------------------+-------------+------+----
       |        ETH        |    VLAN     | ETH  |
       |       ADDRS       | TPID | TCI  | TYPE |
       +-------------------+-------------+------+----
       <-------- mac_len --------->
                           <------------->
                            to be removed
    
    - After skb_reorder_vlan_header()
    
                mac_header                     data
                     v                          v
                     +-------------------+------+----
                     |        ETH        | ETH  |
                     |       ADDRS       | TYPE |
                     +-------------------+------+----
                     <-------- mac_len --------->
    
    This is ok, but in rx double tag case, it corrupts packets:
    
    - Before skb_reorder_vlan_header()
    
     mac_header                                              data
       v                                                      v
       +-------------------+-------------+-------------+------+----
       |        ETH        |    VLAN     |    VLAN     | ETH  |
       |       ADDRS       | TPID | TCI  | TPID | TCI  | TYPE |
       +-------------------+-------------+-------------+------+----
       <--------------- mac_len ---------------->
                                         <------------->
                                        should be removed
                           <--------------------------->
                             actually will be removed
    
    - After skb_reorder_vlan_header()
    
                mac_header                                   data
                     v                                        v
                                   +-------------------+------+----
                                   |        ETH        | ETH  |
                                   |       ADDRS       | TYPE |
                                   +-------------------+------+----
                     <--------------- mac_len ---------------->
    
    So, two of vlan tags are both removed while only inner one should be
    removed and mac_header (and mac_len) is broken.
    
    skb_vlan_untag() is meant for removing the vlan header at (skb->data - 2),
    so use skb->data and skb->mac_header to calculate the right offset.
    
    Reported-by: Brandon Carpenter <brandon.carpenter@cypherpath.com>
    Fixes: a6e18ff11170 ("vlan: Fix untag operations of stacked vlans with REORDER_HEADER off")
    Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5d76473e6f51ce2145fcef98c2cb4e3b0885c4ff
Author: Florian Westphal <fw@strlen.de>
Date:   Thu Mar 8 12:54:19 2018 +0100

    netfilter: ebtables: fix erroneous reject of last rule
    
    [ Upstream commit 932909d9b28d27e807ff8eecb68c7748f6701628 ]
    
    The last rule in the blob has next_entry offset that is same as total size.
    This made "ebtables32 -A OUTPUT -d de:ad:be:ef:01:02" fail on 64 bit kernel.
    
    Fixes: b71812168571fa ("netfilter: ebtables: CONFIG_COMPAT: don't trust userland offsets")
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e2cad748adaf15153b063cfcbf45c072f60bc2ab
Author: Fredrik Noring <noring@nocrew.org>
Date:   Fri Mar 9 18:34:34 2018 +0100

    USB: OHCI: Fix NULL dereference in HCDs using HCD_LOCAL_MEM
    
    [ Upstream commit d6c931ea32dc08ac2665bb5f009f9c40ad1bbdb3 ]
    
    Scatter-gather needs to be disabled when using dma_declare_coherent_memory
    and HCD_LOCAL_MEM. Andrea Righi made the equivalent fix for EHCI drivers
    in commit 4307a28eb01284 "USB: EHCI: fix NULL pointer dererence in HCDs
    that use HCD_LOCAL_MEM".
    
    The following NULL pointer WARN_ON_ONCE triggered with OHCI drivers:
    
    ------------[ cut here ]------------
    WARNING: CPU: 0 PID: 49 at drivers/usb/core/hcd.c:1379 hcd_alloc_coherent+0x4c/0xc8
    Modules linked in:
    CPU: 0 PID: 49 Comm: usb-storage Not tainted 4.15.0+ #1014
    Stack : 00000000 00000000 805a78d2 0000003a 81f5c2cc 8053d367 804d77fc 00000031
            805a3a08 00000563 81ee9400 805a0000 00000000 10058c00 81f61b10 805c0000
            00000000 00000000 805a0000 00d9038e 00000004 803ee818 00000006 312e3420
            805c0000 00000000 00000073 81f61958 00000000 00000000 802eb380 804fd538
            00000009 00000563 81ee9400 805a0000 00000002 80056148 00000000 805a0000
            ...
    Call Trace:
    [<578af360>] show_stack+0x74/0x104
    [<2f3702c6>] __warn+0x118/0x120
    [<ae93fc9e>] warn_slowpath_null+0x44/0x58
    [<a891a517>] hcd_alloc_coherent+0x4c/0xc8
    [<3578fa36>] usb_hcd_map_urb_for_dma+0x4d8/0x534
    [<110bc94c>] usb_hcd_submit_urb+0x82c/0x834
    [<02eb5baf>] usb_sg_wait+0x14c/0x1a0
    [<ccd09e85>] usb_stor_bulk_transfer_sglist.part.1+0xac/0x124
    [<87a5c34c>] usb_stor_bulk_srb+0x40/0x60
    [<ff1792ac>] usb_stor_Bulk_transport+0x160/0x37c
    [<b9e2709c>] usb_stor_invoke_transport+0x3c/0x500
    [<004754f4>] usb_stor_control_thread+0x258/0x28c
    [<22edf42e>] kthread+0x134/0x13c
    [<a419ffd0>] ret_from_kernel_thread+0x14/0x1c
    ---[ end trace bcdb825805eefdcc ]---
    
    Signed-off-by: Fredrik Noring <noring@nocrew.org>
    Acked-by: Alan Stern <stern@rowland.harvard.edu>
    
    
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7f4ac642d59dcdc169f560361301f65ff888233d
Author: Arvind Yadav <arvind.yadav.cs@gmail.com>
Date:   Tue Mar 6 15:40:37 2018 +0530

    xen: xenbus: use put_device() instead of kfree()
    
    [ Upstream commit 351b2bccede1cb673ec7957b35ea997ea24c8884 ]
    
    Never directly free @dev after calling device_register(), even
    if it returned an error! Always use put_device() to give up the
    reference initialized.
    
    Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit db57535b77b8de5646291f368f50f9494800bff5
Author: Peter Malone <peter.malone@gmail.com>
Date:   Wed Mar 7 14:00:34 2018 +0100

    fbdev: Fixing arbitrary kernel leak in case FBIOGETCMAP_SPARC in sbusfb_ioctl_helper().
    
    [ Upstream commit 250c6c49e3b68756b14983c076183568636e2bde ]
    
    Fixing arbitrary kernel leak in case FBIOGETCMAP_SPARC in
    sbusfb_ioctl_helper().
    
    'index' is defined as an int in sbusfb_ioctl_helper().
    We retrieve this from the user:
    if (get_user(index, &c->index) ||
        __get_user(count, &c->count) ||
        __get_user(ured, &c->red) ||
        __get_user(ugreen, &c->green) ||
        __get_user(ublue, &c->blue))
           return -EFAULT;
    
    and then we use 'index' in the following way:
    red = cmap->red[index + i] >> 8;
    green = cmap->green[index + i] >> 8;
    blue = cmap->blue[index + i] >> 8;
    
    This is a classic information leak vulnerability. 'index' should be
    an unsigned int, given its usage above.
    
    This patch is straight-forward; it changes 'index' to unsigned int
    in two switch-cases: FBIOGETCMAP_SPARC && FBIOPUTCMAP_SPARC.
    
    This patch fixes CVE-2018-6412.
    
    Signed-off-by: Peter Malone <peter.malone@gmail.com>
    Acked-by: Mathieu Malaterre <malat@debian.org>
    Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a60caea86b2cbb3e96e8c9c03afdfa3fb0173707
Author: Jeremy Cline <jeremy@jcline.org>
Date:   Tue Mar 6 21:47:32 2018 +0000

    scsi: sd: Keep disk read-only when re-reading partition
    
    [ Upstream commit 20bd1d026aacc5399464f8328f305985c493cde3 ]
    
    If the read-only flag is true on a SCSI disk, re-reading the partition
    table sets the flag back to false.
    
    To observe this bug, you can run:
    
    1. blockdev --setro /dev/sda
    2. blockdev --rereadpt /dev/sda
    3. blockdev --getro /dev/sda
    
    This commit reads the disk's old state and combines it with the device
    disk-reported state rather than unconditionally marking it as RW.
    
    Reported-by: Li Ning <lining916740672@icloud.com>
    Signed-off-by: Jeremy Cline <jeremy@jcline.org>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3d418b778ca706e2b3ad83f13d3ebfcebbe9da51
Author: Merlijn Wajer <merlijn@wizzup.org>
Date:   Mon Mar 5 11:35:10 2018 -0600

    usb: musb: call pm_runtime_{get,put}_sync before reading vbus registers
    
    [ Upstream commit df6b074dbe248d8c43a82131e8fd429e401841a5 ]
    
    Without pm_runtime_{get,put}_sync calls in place, reading
    vbus status via /sys causes the following error:
    
    Unhandled fault: external abort on non-linefetch (0x1028) at 0xfa0ab060
    pgd = b333e822
    [fa0ab060] *pgd=48011452(bad)
    
    [<c05261b0>] (musb_default_readb) from [<c0525bd0>] (musb_vbus_show+0x58/0xe4)
    [<c0525bd0>] (musb_vbus_show) from [<c04c0148>] (dev_attr_show+0x20/0x44)
    [<c04c0148>] (dev_attr_show) from [<c0259f74>] (sysfs_kf_seq_show+0x80/0xdc)
    [<c0259f74>] (sysfs_kf_seq_show) from [<c0210bac>] (seq_read+0x250/0x448)
    [<c0210bac>] (seq_read) from [<c01edb40>] (__vfs_read+0x1c/0x118)
    [<c01edb40>] (__vfs_read) from [<c01edccc>] (vfs_read+0x90/0x144)
    [<c01edccc>] (vfs_read) from [<c01ee1d0>] (SyS_read+0x3c/0x74)
    [<c01ee1d0>] (SyS_read) from [<c0106fe0>] (ret_fast_syscall+0x0/0x54)
    
    Solution was suggested by Tony Lindgren <tony@atomide.com>.
    
    Signed-off-by: Merlijn Wajer <merlijn@wizzup.org>
    Acked-by: Tony Lindgren <tony@atomide.com>
    Signed-off-by: Bin Liu <b-liu@ti.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3b40952ecec22f6376833db83afa0366553a5ec5
Author: Pierre-Yves Kerbrat <pkerbrat@kalray.eu>
Date:   Fri Jan 26 11:24:12 2018 +0100

    e1000e: allocate ring descriptors with dma_zalloc_coherent
    
    [ Upstream commit aea3fca005fb45f80869f2e8d56fd4e64c1d1fdb ]
    
    Descriptor rings were not initialized at zero when allocated
    When area contained garbage data, it caused skb_over_panic in
    e1000_clean_rx_irq (if data had E1000_RXD_STAT_DD bit set)
    
    This patch makes use of dma_zalloc_coherent to make sure the
    ring is memset at 0 to prevent the area from containing garbage.
    
    Following is the signature of the panic:
    IODDR0@0.0: skbuff: skb_over_panic: text:80407b20 len:64010 put:64010 head:ab46d800 data:ab46d842 tail:0xab47d24c end:0xab46df40 dev:eth0
    IODDR0@0.0: BUG: failure at net/core/skbuff.c:105/skb_panic()!
    IODDR0@0.0: Kernel panic - not syncing: BUG!
    IODDR0@0.0:
    IODDR0@0.0: Process swapper/0 (pid: 0, threadinfo=81728000, task=8173cc00 ,cpu: 0)
    IODDR0@0.0: SP = <815a1c0c>
    IODDR0@0.0: Stack:      00000001
    IODDR0@0.0: b2d89800 815e33ac
    IODDR0@0.0: ea73c040 00000001
    IODDR0@0.0: 60040003 0000fa0a
    IODDR0@0.0: 00000002
    IODDR0@0.0:
    IODDR0@0.0: 804540c0 815a1c70
    IODDR0@0.0: b2744000 602ac070
    IODDR0@0.0: 815a1c44 b2d89800
    IODDR0@0.0: 8173cc00 815a1c08
    IODDR0@0.0:
    IODDR0@0.0:     00000006
    IODDR0@0.0: 815a1b50 00000000
    IODDR0@0.0: 80079434 00000001
    IODDR0@0.0: ab46df40 b2744000
    IODDR0@0.0: b2d89800
    IODDR0@0.0:
    IODDR0@0.0: 0000fa0a 8045745c
    IODDR0@0.0: 815a1c88 0000fa0a
    IODDR0@0.0: 80407b20 b2789f80
    IODDR0@0.0: 00000005 80407b20
    IODDR0@0.0:
    IODDR0@0.0:
    IODDR0@0.0: Call Trace:
    IODDR0@0.0: [<804540bc>] skb_panic+0xa4/0xa8
    IODDR0@0.0: [<80079430>] console_unlock+0x2f8/0x6d0
    IODDR0@0.0: [<80457458>] skb_put+0xa0/0xc0
    IODDR0@0.0: [<80407b1c>] e1000_clean_rx_irq+0x2dc/0x3e8
    IODDR0@0.0: [<80407b1c>] e1000_clean_rx_irq+0x2dc/0x3e8
    IODDR0@0.0: [<804079c8>] e1000_clean_rx_irq+0x188/0x3e8
    IODDR0@0.0: [<80407b1c>] e1000_clean_rx_irq+0x2dc/0x3e8
    IODDR0@0.0: [<80468b48>] __dev_kfree_skb_any+0x88/0xa8
    IODDR0@0.0: [<804101ac>] e1000e_poll+0x94/0x288
    IODDR0@0.0: [<8046e9d4>] net_rx_action+0x19c/0x4e8
    IODDR0@0.0:   ...
    IODDR0@0.0: Maximum depth to print reached. Use kstack=<maximum_depth_to_print> To specify a custom value (where 0 means to display the full backtrace)
    IODDR0@0.0: ---[ end Kernel panic - not syncing: BUG!
    
    Signed-off-by: Pierre-Yves Kerbrat <pkerbrat@kalray.eu>
    Signed-off-by: Marius Gligor <mgligor@kalray.eu>
    Tested-by: Aaron Brown <aaron.f.brown@intel.com>
    Reviewed-by: Alexander Duyck <alexander.h.duyck@intel.com>
    Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 34ec8d574c8619044162250ef5e9d3c7b17a4cec
Author: Benjamin Poirier <bpoirier@suse.com>
Date:   Tue Feb 20 15:12:00 2018 +0900

    e1000e: Fix check_for_link return value with autoneg off
    
    [ Upstream commit 4e7dc08e57c95673d2edaba8983c3de4dd1f65f5 ]
    
    When autoneg is off, the .check_for_link callback functions clear the
    get_link_status flag and systematically return a "pseudo-error". This means
    that the link is not detected as up until the next execution of the
    e1000_watchdog_task() 2 seconds later.
    
    Fixes: 19110cfbb34d ("e1000e: Separate signaling for link check/link up")
    Signed-off-by: Benjamin Poirier <bpoirier@suse.com>
    Acked-by: Sasha Neftin <sasha.neftin@intel.com>
    Tested-by: Aaron Brown <aaron.f.brown@intel.com>
    Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 089e299e5acbacf123245d4f16b1a0b70bd6c14d
Author: Igor Pylypiv <igor.pylypiv@gmail.com>
Date:   Wed Feb 28 00:59:12 2018 -0800

    watchdog: f71808e_wdt: Fix magic close handling
    
    [ Upstream commit 7bd3e7b743956afbec30fb525bc3c5e22e3d475c ]
    
    Watchdog close is "expected" when any byte is 'V' not just the last one.
    Writing "V" to the device fails because the last byte is the end of string.
    
    $ echo V > /dev/watchdog
    f71808e_wdt: Unexpected close, not stopping watchdog!
    
    Signed-off-by: Igor Pylypiv <igor.pylypiv@gmail.com>
    Reviewed-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7361dfb33dd5ade3d3a5fd3819edaacb1e6f2eae
Author: Filipe Manana <fdmanana@suse.com>
Date:   Tue Feb 6 20:39:20 2018 +0000

    Btrfs: send, fix issuing write op when processing hole in no data mode
    
    [ Upstream commit d4dfc0f4d39475ccbbac947880b5464a74c30b99 ]
    
    When doing an incremental send of a filesystem with the no-holes feature
    enabled, we end up issuing a write operation when using the no data mode
    send flag, instead of issuing an update extent operation. Fix this by
    issuing the update extent operation instead.
    
    Trivial reproducer:
    
      $ mkfs.btrfs -f -O no-holes /dev/sdc
      $ mkfs.btrfs -f /dev/sdd
      $ mount /dev/sdc /mnt/sdc
      $ mount /dev/sdd /mnt/sdd
    
      $ xfs_io -f -c "pwrite -S 0xab 0 32K" /mnt/sdc/foobar
      $ btrfs subvolume snapshot -r /mnt/sdc /mnt/sdc/snap1
    
      $ xfs_io -c "fpunch 8K 8K" /mnt/sdc/foobar
      $ btrfs subvolume snapshot -r /mnt/sdc /mnt/sdc/snap2
    
      $ btrfs send /mnt/sdc/snap1 | btrfs receive /mnt/sdd
      $ btrfs send --no-data -p /mnt/sdc/snap1 /mnt/sdc/snap2 \
           | btrfs receive -vv /mnt/sdd
    
    Before this change the output of the second receive command is:
    
      receiving snapshot snap2 uuid=f6922049-8c22-e544-9ff9-fc6755918447...
      utimes
      write foobar, offset 8192, len 8192
      utimes foobar
      BTRFS_IOC_SET_RECEIVED_SUBVOL uuid=f6922049-8c22-e544-9ff9-...
    
    After this change it is:
    
      receiving snapshot snap2 uuid=564d36a3-ebc8-7343-aec9-bf6fda278e64...
      utimes
      update_extent foobar: offset=8192, len=8192
      utimes foobar
      BTRFS_IOC_SET_RECEIVED_SUBVOL uuid=564d36a3-ebc8-7343-aec9-bf6fda278e64...
    
    Signed-off-by: Filipe Manana <fdmanana@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2f08745655105dc1e71c42a41e44291489e5c0ed
Author: Roger Pau Monne <roger.pau@citrix.com>
Date:   Wed Feb 28 09:19:03 2018 +0000

    xen/pirq: fix error path cleanup when binding MSIs
    
    [ Upstream commit 910f8befdf5bccf25287d9f1743e3e546bcb7ce0 ]
    
    Current cleanup in the error path of xen_bind_pirq_msi_to_irq is
    wrong. First of all there's an off-by-one in the cleanup loop, which
    can lead to unbinding wrong IRQs.
    
    Secondly IRQs not bound won't be freed, thus leaking IRQ numbers.
    
    Note that there's no need to differentiate between bound and unbound
    IRQs when freeing them, __unbind_from_irq will deal with both of them
    correctly.
    
    Fixes: 4892c9b4ada9f9 ("xen: add support for MSI message groups")
    Reported-by: Hooman Mirhadi <mirhadih@amazon.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Amit Shah <aams@amazon.com>
    Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c5f01c61ef4f1713407568454a0b45c7a2e66151
Author: Joey Pabalinas <joeypabalinas@gmail.com>
Date:   Tue Feb 27 22:05:53 2018 -1000

    net/tcp/illinois: replace broken algorithm reference link
    
    [ Upstream commit ecc832758a654e375924ebf06a4ac971acb5ce60 ]
    
    The link to the pdf containing the algorithm description is now a
    dead link; it seems http://www.ifp.illinois.edu/~srikant/ has been
    moved to https://sites.google.com/a/illinois.edu/srikant/ and none of
    the original papers can be found there...
    
    I have replaced it with the only working copy I was able to find.
    
    n.b. there is also a copy available at:
    
    http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.296.6350&rep=rep1&type=pdf
    
    However, this seems to only be a *cached* version, so I am unsure
    exactly how reliable that link can be expected to remain over time
    and have decided against using that one.
    
    Signed-off-by: Joey Pabalinas <joeypabalinas@gmail.com>
    
     net/ipv4/tcp_illinois.c |    2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ec99decb4b616f5eb0acedf375d47b4e473280eb
Author: Xin Long <lucien.xin@gmail.com>
Date:   Tue Feb 27 19:19:41 2018 +0800

    sit: fix IFLA_MTU ignored on NEWLINK
    
    [ Upstream commit 2b3957c34b6d7f03544b12ebbf875eee430745db ]
    
    Commit 128bb975dc3c ("ip6_gre: init dev->mtu and dev->hard_header_len
    correctly") fixed IFLA_MTU ignored on NEWLINK for ip6_gre. The same
    mtu fix is also needed for sit.
    
    Note that dev->hard_header_len setting for sit works fine, no need to
    fix it. sit is actually ipv4 tunnel, it can't call ip6_tnl_change_mtu
    to set mtu.
    
    Reported-by: Jianlin Shi <jishi@redhat.com>
    Signed-off-by: Xin Long <lucien.xin@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 52140265930858bff1d1c14a9d549980c66d88d8
Author: Tang Junhui <tang.junhui@zte.com.cn>
Date:   Tue Feb 27 09:49:30 2018 -0800

    bcache: fix kcrashes with fio in RAID5 backend dev
    
    [ Upstream commit 60eb34ec5526e264c2bbaea4f7512d714d791caf ]
    
    Kernel crashed when run fio in a RAID5 backend bcache device, the call
    trace is bellow:
    [  440.012034] kernel BUG at block/blk-ioc.c:146!
    [  440.012696] invalid opcode: 0000 [#1] SMP NOPTI
    [  440.026537] CPU: 2 PID: 2205 Comm: md127_raid5 Not tainted 4.15.0 #8
    [  440.027441] Hardware name: HP ProLiant MicroServer Gen8, BIOS J06 07/16
    /2015
    [  440.028615] RIP: 0010:put_io_context+0x8b/0x90
    [  440.029246] RSP: 0018:ffffa8c882b43af8 EFLAGS: 00010246
    [  440.029990] RAX: 0000000000000000 RBX: ffffa8c88294fca0 RCX: 0000000000
    0f4240
    [  440.031006] RDX: 0000000000000004 RSI: 0000000000000286 RDI: ffffa8c882
    94fca0
    [  440.032030] RBP: ffffa8c882b43b10 R08: 0000000000000003 R09: ffff949cb8
    0c1700
    [  440.033206] R10: 0000000000000104 R11: 000000000000b71c R12: 00000000000
    01000
    [  440.034222] R13: 0000000000000000 R14: ffff949cad84db70 R15: ffff949cb11
    bd1e0
    [  440.035239] FS:  0000000000000000(0000) GS:ffff949cba280000(0000) knlGS:
    0000000000000000
    [  440.060190] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [  440.084967] CR2: 00007ff0493ef000 CR3: 00000002f1e0a002 CR4: 00000000001
    606e0
    [  440.110498] Call Trace:
    [  440.135443]  bio_disassociate_task+0x1b/0x60
    [  440.160355]  bio_free+0x1b/0x60
    [  440.184666]  bio_put+0x23/0x30
    [  440.208272]  search_free+0x23/0x40 [bcache]
    [  440.231448]  cached_dev_write_complete+0x31/0x70 [bcache]
    [  440.254468]  closure_put+0xb6/0xd0 [bcache]
    [  440.277087]  request_endio+0x30/0x40 [bcache]
    [  440.298703]  bio_endio+0xa1/0x120
    [  440.319644]  handle_stripe+0x418/0x2270 [raid456]
    [  440.340614]  ? load_balance+0x17b/0x9c0
    [  440.360506]  handle_active_stripes.isra.58+0x387/0x5a0 [raid456]
    [  440.380675]  ? __release_stripe+0x15/0x20 [raid456]
    [  440.400132]  raid5d+0x3ed/0x5d0 [raid456]
    [  440.419193]  ? schedule+0x36/0x80
    [  440.437932]  ? schedule_timeout+0x1d2/0x2f0
    [  440.456136]  md_thread+0x122/0x150
    [  440.473687]  ? wait_woken+0x80/0x80
    [  440.491411]  kthread+0x102/0x140
    [  440.508636]  ? find_pers+0x70/0x70
    [  440.524927]  ? kthread_associate_blkcg+0xa0/0xa0
    [  440.541791]  ret_from_fork+0x35/0x40
    [  440.558020] Code: c2 48 00 5b 41 5c 41 5d 5d c3 48 89 c6 4c 89 e7 e8 bb c2
    48 00 48 8b 3d bc 36 4b 01 48 89 de e8 7c f7 e0 ff 5b 41 5c 41 5d 5d c3 <0f> 0b
    0f 1f 00 0f 1f 44 00 00 55 48 8d 47 b8 48 89 e5 41 57 41
    [  440.610020] RIP: put_io_context+0x8b/0x90 RSP: ffffa8c882b43af8
    [  440.628575] ---[ end trace a1fd79d85643a73e ]--
    
    All the crash issue happened when a bypass IO coming, in such scenario
    s->iop.bio is pointed to the s->orig_bio. In search_free(), it finishes the
    s->orig_bio by calling bio_complete(), and after that, s->iop.bio became
    invalid, then kernel would crash when calling bio_put(). Maybe its upper
    layer's faulty, since bio should not be freed before we calling bio_put(),
    but we'd better calling bio_put() first before calling bio_complete() to
    notify upper layer ending this bio.
    
    This patch moves bio_complete() under bio_put() to avoid kernel crash.
    
    [mlyle: fixed commit subject for character limits]
    
    Reported-by: Matthias Ferdinand <bcache@mfedv.net>
    Tested-by: Matthias Ferdinand <bcache@mfedv.net>
    Signed-off-by: Tang Junhui <tang.junhui@zte.com.cn>
    Reviewed-by: Michael Lyle <mlyle@lyle.org>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e8218416468047e84c7bf685b81b5fd0ed1edbf1
Author: Eric Dumazet <edumazet@google.com>
Date:   Sun Feb 25 19:12:10 2018 -0800

    r8152: fix tx packets accounting
    
    [ Upstream commit 4c27bf3c5b7434ccb9ab962301da661c26b467a4 ]
    
    r8152 driver handles TSO packets (limited to ~16KB) quite well,
    but pretends each TSO logical packet is a single packet on the wire.
    
    There is also some error since headers are accounted once, but
    error rate is small enough that we do not care.
    
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0fe836b6554d0867a52bbca33cb536228f49d891
Author: Colin Ian King <colin.king@canonical.com>
Date:   Mon Feb 26 11:36:14 2018 +0000

    clocksource/drivers/fsl_ftm_timer: Fix error return checking
    
    [ Upstream commit f287eb9013ccf199cbfa4eabd80c36fedfc15a73 ]
    
    The error checks on freq for a negative error return always fails because
    freq is unsigned and can never be negative. Fix this by making freq a
    signed long.
    
    Detected with Coccinelle:
    drivers/clocksource/fsl_ftm_timer.c:287:5-9: WARNING: Unsigned expression
    compared with zero: freq <= 0
    drivers/clocksource/fsl_ftm_timer.c:291:5-9: WARNING: Unsigned expression
    compared with zero: freq <= 0
    
    Fixes: 2529c3a33079 ("clocksource: Add Freescale FlexTimer Module (FTM) timer support")
    Signed-off-by: Colin Ian King <colin.king@canonical.com>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
    Cc: kernel-janitors@vger.kernel.org
    Link: https://lkml.kernel.org/r/20180226113614.3092-1-colin.king@canonical.com
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0f3eca6efb5bd6cc86aa3d691724210ab4740197
Author: Florian Westphal <fw@strlen.de>
Date:   Mon Feb 19 01:24:53 2018 +0100

    netfilter: ebtables: convert BUG_ONs to WARN_ONs
    
    [ Upstream commit fc6a5d0601c5ac1d02f283a46f60b87b2033e5ca ]
    
    All of these conditions are not fatal and should have
    been WARN_ONs from the get-go.
    
    Convert them to WARN_ONs and bail out.
    
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2ffa55ed09c75d73a54ece71a999881dfaa5b0d0
Author: Matthias Schiffer <mschiffer@universe-factory.net>
Date:   Tue Jan 23 10:59:50 2018 +0100

    batman-adv: invalidate checksum on fragment reassembly
    
    [ Upstream commit 3bf2a09da956b43ecfaa630a2ef9a477f991a46a ]
    
    A more sophisticated implementation could try to combine fragment checksums
    when all fragments have CHECKSUM_COMPLETE and are split at even offsets.
    For now, we just set ip_summed to CHECKSUM_NONE to avoid "hw csum failure"
    warnings in the kernel log when fragmented frames are received. In
    consequence, skb_pull_rcsum() can be replaced with skb_pull().
    
    Note that in usual setups, packets don't reach batman-adv with
    CHECKSUM_COMPLETE (I assume NICs bail out of checksumming when they see
    batadv's ethtype?), which is why the log messages do not occur on every
    system using batman-adv. I could reproduce this issue by stacking
    batman-adv on top of a VXLAN interface.
    
    Fixes: 610bfc6bc99b ("batman-adv: Receive fragmented packets and merge")
    Tested-by: Maximilian Wilhelm <max@sdn.clinic>
    Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
    Signed-off-by: Sven Eckelmann <sven@narfation.org>
    Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7806534fce853eec5128f62756f4b97186ee67a2
Author: Matthias Schiffer <mschiffer@universe-factory.net>
Date:   Tue Jan 23 10:59:49 2018 +0100

    batman-adv: fix packet checksum in receive path
    
    [ Upstream commit abd6360591d3f8259f41c34e31ac4826dfe621b8 ]
    
    eth_type_trans() internally calls skb_pull(), which does not adjust the
    skb checksum; skb_postpull_rcsum() is necessary to avoid log spam of the
    form "bat0: hw csum failure" when packets with CHECKSUM_COMPLETE are
    received.
    
    Note that in usual setups, packets don't reach batman-adv with
    CHECKSUM_COMPLETE (I assume NICs bail out of checksumming when they see
    batadv's ethtype?), which is why the log messages do not occur on every
    system using batman-adv. I could reproduce this issue by stacking
    batman-adv on top of a VXLAN interface.
    
    Fixes: c6c8fea29769 ("net: Add batman-adv meshing protocol")
    Tested-by: Maximilian Wilhelm <max@sdn.clinic>
    Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
    Signed-off-by: Sven Eckelmann <sven@narfation.org>
    Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4f5862c9e0593c4a7626329d8bfcf4059d3be683
Author: Yufen Yu <yuyufen@huawei.com>
Date:   Sat Feb 24 12:05:56 2018 +0800

    md/raid1: fix NULL pointer dereference
    
    [ Upstream commit 3de59bb9d551428cbdc76a9ea57883f82e350b4d ]
    
    In handle_write_finished(), if r1_bio->bios[m] != NULL, it thinks
    the corresponding conf->mirrors[m].rdev is also not NULL. But, it
    is not always true.
    
    Even if some io hold replacement rdev(i.e. rdev->nr_pending.count > 0),
    raid1_remove_disk() can also set the rdev as NULL. That means,
    bios[m] != NULL, but mirrors[m].rdev is NULL, resulting in NULL
    pointer dereference in handle_write_finished and sync_request_write.
    
    This patch can fix BUGs as follows:
    
     BUG: unable to handle kernel NULL pointer dereference at 0000000000000140
     IP: [<ffffffff815bbbbd>] raid1d+0x2bd/0xfc0
     PGD 12ab52067 PUD 12f587067 PMD 0
     Oops: 0000 [#1] SMP
     CPU: 1 PID: 2008 Comm: md3_raid1 Not tainted 4.1.44+ #130
     Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1.fc26 04/01/2014
     Call Trace:
      ? schedule+0x37/0x90
      ? prepare_to_wait_event+0x83/0xf0
      md_thread+0x144/0x150
      ? wake_atomic_t_function+0x70/0x70
      ? md_start_sync+0xf0/0xf0
      kthread+0xd8/0xf0
      ? kthread_worker_fn+0x160/0x160
      ret_from_fork+0x42/0x70
      ? kthread_worker_fn+0x160/0x160
    
     BUG: unable to handle kernel NULL pointer dereference at 00000000000000b8
     IP: sync_request_write+0x9e/0x980
     PGD 800000007c518067 P4D 800000007c518067 PUD 8002b067 PMD 0
     Oops: 0000 [#1] SMP PTI
     CPU: 24 PID: 2549 Comm: md3_raid1 Not tainted 4.15.0+ #118
     Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1.fc26 04/01/2014
     Call Trace:
      ? sched_clock+0x5/0x10
      ? sched_clock_cpu+0xc/0xb0
      ? flush_pending_writes+0x3a/0xd0
      ? pick_next_task_fair+0x4d5/0x5f0
      ? __switch_to+0xa2/0x430
      raid1d+0x65a/0x870
      ? find_pers+0x70/0x70
      ? find_pers+0x70/0x70
      ? md_thread+0x11c/0x160
      md_thread+0x11c/0x160
      ? finish_wait+0x80/0x80
      kthread+0x111/0x130
      ? kthread_create_worker_on_cpu+0x70/0x70
      ? do_syscall_64+0x6f/0x190
      ? SyS_exit_group+0x10/0x10
      ret_from_fork+0x35/0x40
    
    Reviewed-by: NeilBrown <neilb@suse.com>
    Signed-off-by: Yufen Yu <yuyufen@huawei.com>
    Signed-off-by: Shaohua Li <sh.li@alibaba-inc.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7b86d81c3aba790638ccedc3817b83a3fa67e439
Author: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Date:   Sun Feb 11 05:44:21 2018 -0500

    media: dmxdev: fix error code for invalid ioctls
    
    [ Upstream commit a145f64c6107d3aa5a7cec9f8977d04ac2a896c9 ]
    
    Returning -EINVAL when an ioctl is not implemented is a very
    bad idea, as it is hard to distinguish from other error
    contitions that an ioctl could lead. Replace it by its
    right error code: -ENOTTY.
    
    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 836053fdf00c8294e70ed69802b503220544b6de
Author: Samuel Neves <sneves@dei.uc.pt>
Date:   Wed Feb 21 20:50:36 2018 +0000

    x86/topology: Update the 'cpu cores' field in /proc/cpuinfo correctly across CPU hotplug operations
    
    [ Upstream commit 4596749339e06dc7a424fc08a15eded850ed78b7 ]
    
    Without this fix, /proc/cpuinfo will display an incorrect amount
    of CPU cores, after bringing them offline and online again, as
    exemplified below:
    
      $ cat /proc/cpuinfo | grep cores
      cpu cores     : 4
      cpu cores     : 8
      cpu cores     : 8
      cpu cores     : 20
      cpu cores     : 4
      cpu cores     : 3
      cpu cores     : 2
      cpu cores     : 2
    
    This patch fixes this by always zeroing the booted_cores variable
    upon turning off a logical CPU.
    
    Tested-by: Dou Liyang <douly.fnst@cn.fujitsu.com>
    Signed-off-by: Samuel Neves <sneves@dei.uc.pt>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: jgross@suse.com
    Cc: luto@kernel.org
    Cc: prarit@redhat.com
    Cc: vkuznets@redhat.com
    Link: http://lkml.kernel.org/r/20180221205036.5244-1-sneves@dei.uc.pt
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ce5555ac3ad3e468179ae90ccb1f8dc5831569fd
Author: Andrea Parri <parri.andrea@gmail.com>
Date:   Thu Feb 22 10:24:48 2018 +0100

    locking/xchg/alpha: Fix xchg() and cmpxchg() memory ordering bugs
    
    [ Upstream commit 472e8c55cf6622d1c112dc2bc777f68bbd4189db ]
    
    Successful RMW operations are supposed to be fully ordered, but
    Alpha's xchg() and cmpxchg() do not meet this requirement.
    
    Will Deacon noticed the bug:
    
      > So MP using xchg:
      >
      > WRITE_ONCE(x, 1)
      > xchg(y, 1)
      >
      > smp_load_acquire(y) == 1
      > READ_ONCE(x) == 0
      >
      > would be allowed.
    
    ... which thus violates the above requirement.
    
    Fix it by adding a leading smp_mb() to the xchg() and cmpxchg() implementations.
    
    Reported-by: Will Deacon <will.deacon@arm.com>
    Signed-off-by: Andrea Parri <parri.andrea@gmail.com>
    Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
    Cc: Alan Stern <stern@rowland.harvard.edu>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Matt Turner <mattst88@gmail.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Richard Henderson <rth@twiddle.net>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: linux-alpha@vger.kernel.org
    Link: http://lkml.kernel.org/r/1519291488-5752-1-git-send-email-parri.andrea@gmail.com
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 85dc640cb86720ee469301d5a4f0874ff173e6e2
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Thu Feb 22 20:55:28 2018 +0100

    regulatory: add NUL to request alpha2
    
    [ Upstream commit 657308f73e674e86b60509a430a46e569bf02846 ]
    
    Similar to the ancient commit a5fe8e7695dc ("regulatory: add NUL
    to alpha2"), add another byte to alpha2 in the request struct so
    that when we use nla_put_string(), we don't overrun anything.
    
    Fixes: 73d54c9e74c4 ("cfg80211: add regulatory netlink multicast group")
    Reported-by: Kees Cook <keescook@google.com>
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9fac7f80cc318c61b499bd4870172a6055b26a61
Author: Eric Dumazet <edumazet@google.com>
Date:   Tue Feb 20 21:42:26 2018 -0800

    smsc75xx: fix smsc75xx_set_features()
    
    [ Upstream commit 88e80c62671ceecdbb77c902731ec95a4bfa62f9 ]
    
    If an attempt is made to disable RX checksums, USB adapter is changed
    but netdev->features is not, because smsc75xx_set_features() returns a
    non zero value.
    
    This throws errors from netdev_rx_csum_fault() :
    <devname>: hw csum failure
    
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Cc: Steve Glendinning <steve.glendinning@shawell.net>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 300adcc42d61c5f3dd1ed21cba21676422955880
Author: Tony Lindgren <tony@atomide.com>
Date:   Thu Feb 22 10:02:49 2018 -0800

    ARM: OMAP: Fix dmtimer init for omap1
    
    [ Upstream commit ba6887836178d43b3665b9da075c2c5dfe1d207c ]
    
    We need to enable PM runtime on omap1 also as otherwise we
    will get errors:
    
    omap_timer omap_timer.1: omap_dm_timer_probe: pm_runtime_get_sync failed!
    omap_timer: probe of omap_timer.1 failed with error -13
    ...
    
    We are checking for OMAP_TIMER_NEEDS_RESET flag elsewhere so this is
    safe to do.
    
    Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
    Cc: Keerthy <j-keerthy@ti.com>
    Cc: Ladislav Michl <ladis@linux-mips.org>
    Signed-off-by: Tony Lindgren <tony@atomide.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0ef50f04aae890db9bc01cfc4d7e7fce54e04a27
Author: Sebastian Ott <sebott@linux.vnet.ibm.com>
Date:   Mon Feb 12 12:01:03 2018 +0100

    s390/cio: clear timer when terminating driver I/O
    
    [ Upstream commit 410d5e13e7638bc146321671e223d56495fbf3c7 ]
    
    When we terminate driver I/O (because we need to stop using a certain
    channel path) we also need to ensure that a timer (which may have been
    set up using ccw_device_start_timeout) is cleared.
    
    Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
    Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3e9b3e71b1d7d4bec83dbdd07897c1117675c34e
Author: Sebastian Ott <sebott@linux.vnet.ibm.com>
Date:   Wed Feb 7 13:18:19 2018 +0100

    s390/cio: fix return code after missing interrupt
    
    [ Upstream commit 770b55c995d171f026a9efb85e71e3b1ea47b93d ]
    
    When a timeout occurs for users of ccw_device_start_timeout
    we will stop the IO and call the drivers int handler with
    the irb pointer set to ERR_PTR(-ETIMEDOUT). Sometimes
    however we'd set the irb pointer to ERR_PTR(-EIO) which is
    not intended. Just set the correct value in all codepaths.
    
    Reported-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
    Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
    Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9afcd54175832fec6a994bffca01ceeec2058af3
Author: David Rientjes <rientjes@google.com>
Date:   Wed Feb 21 14:45:32 2018 -0800

    kernel/relay.c: limit kmalloc size to KMALLOC_MAX_SIZE
    
    [ Upstream commit 88913bd8ea2a75d7e460a4bed5f75e1c32660d7e ]
    
    chan->n_subbufs is set by the user and relay_create_buf() does a kmalloc()
    of chan->n_subbufs * sizeof(size_t *).
    
    kmalloc_slab() will generate a warning when this fails if
    chan->subbufs * sizeof(size_t *) > KMALLOC_MAX_SIZE.
    
    Limit chan->n_subbufs to the maximum allowed kmalloc() size.
    
    Link: http://lkml.kernel.org/r/alpine.DEB.2.10.1802061216100.122576@chino.kir.corp.google.com
    Fixes: f6302f1bcd75 ("relay: prevent integer overflow in relay_open()")
    Signed-off-by: David Rientjes <rientjes@google.com>
    Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
    Cc: Jens Axboe <axboe@kernel.dk>
    Cc: Dave Jiang <dave.jiang@intel.com>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Cc: Dan Carpenter <dan.carpenter@oracle.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ddcaf259537d9090baa2c8dd6de07047e5cf0641
Author: Andrea Parri <parri.andrea@gmail.com>
Date:   Tue Feb 20 19:45:56 2018 +0100

    locking/xchg/alpha: Add unconditional memory barrier to cmpxchg()
    
    [ Upstream commit cb13b424e986aed68d74cbaec3449ea23c50e167 ]
    
    Continuing along with the fight against smp_read_barrier_depends() [1]
    (or rather, against its improper use), add an unconditional barrier to
    cmpxchg.  This guarantees that dependency ordering is preserved when a
    dependency is headed by an unsuccessful cmpxchg.  As it turns out, the
    change could enable further simplification of LKMM as proposed in [2].
    
    [1] https://marc.info/?l=linux-kernel&m=150884953419377&w=2
        https://marc.info/?l=linux-kernel&m=150884946319353&w=2
        https://marc.info/?l=linux-kernel&m=151215810824468&w=2
        https://marc.info/?l=linux-kernel&m=151215816324484&w=2
    
    [2] https://marc.info/?l=linux-kernel&m=151881978314872&w=2
    
    Signed-off-by: Andrea Parri <parri.andrea@gmail.com>
    Acked-by: Peter Zijlstra <peterz@infradead.org>
    Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
    Cc: Alan Stern <stern@rowland.harvard.edu>
    Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Matt Turner <mattst88@gmail.com>
    Cc: Richard Henderson <rth@twiddle.net>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Will Deacon <will.deacon@arm.com>
    Cc: linux-alpha@vger.kernel.org
    Link: http://lkml.kernel.org/r/1519152356-4804-1-git-send-email-parri.andrea@gmail.com
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 854d97145e2f544f15ea05f1d966bc5d00eaa3bd
Author: Wolfram Sang <wsa+renesas@sang-engineering.com>
Date:   Mon Feb 5 21:09:59 2018 +0100

    drm/exynos: fix comparison to bitshift when dealing with a mask
    
    [ Upstream commit 1293b6191010672c0c9dacae8f71c6f3e4d70cbe ]
    
    Due to a typo, the mask was destroyed by a comparison instead of a bit
    shift.
    
    Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
    Signed-off-by: Inki Dae <inki.dae@samsung.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6524a8d1d3e0cffb14a0d859e785a4ac5cc84f97
Author: Yufen Yu <yuyufen@huawei.com>
Date:   Tue Feb 6 17:39:15 2018 +0800

    md raid10: fix NULL deference in handle_write_completed()
    
    [ Upstream commit 01a69cab01c184d3786af09e9339311123d63d22 ]
    
    In the case of 'recover', an r10bio with R10BIO_WriteError &
    R10BIO_IsRecover will be progressed by handle_write_completed().
    This function traverses all r10bio->devs[copies].
    If devs[m].repl_bio != NULL, it thinks conf->mirrors[dev].replacement
    is also not NULL. However, this is not always true.
    
    When there is an rdev of raid10 has replacement, then each r10bio
    ->devs[m].repl_bio != NULL in conf->r10buf_pool. However, in 'recover',
    even if corresponded replacement is NULL, it doesn't clear r10bio
    ->devs[m].repl_bio, resulting in replacement NULL deference.
    
    This bug was introduced when replacement support for raid10 was
    added in Linux 3.3.
    
    As NeilBrown suggested:
            Elsewhere the determination of "is this device part of the
            resync/recovery" is made by resting bio->bi_end_io.
            If this is end_sync_write, then we tried to write here.
            If it is NULL, then we didn't try to write.
    
    Fixes: 9ad1aefc8ae8 ("md/raid10:  Handle replacement devices during resync.")
    Cc: stable (V3.3+)
    Suggested-by: NeilBrown <neilb@suse.com>
    Signed-off-by: Yufen Yu <yuyufen@huawei.com>
    Signed-off-by: Shaohua Li <sh.li@alibaba-inc.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d7680ddc5abb801eeb67b707518b50e363635be6
Author: Felix Fietkau <nbd@nbd.name>
Date:   Sat Feb 10 13:20:34 2018 +0100

    mac80211: round IEEE80211_TX_STATUS_HEADROOM up to multiple of 4
    
    [ Upstream commit 651b9920d7a694ffb1f885aef2bbb068a25d9d66 ]
    
    This ensures that mac80211 allocated management frames are properly
    aligned, which makes copying them more efficient.
    For instance, mt76 uses iowrite32_copy to copy beacon frames to beacon
    template memory on the chip.
    Misaligned 32-bit accesses cause CPU exceptions on MIPS and should be
    avoided.
    
    Signed-off-by: Felix Fietkau <nbd@nbd.name>
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 39e221cb5ce0822cd7d0a4c82e8949d32f33e43e
Author: Kees Cook <keescook@chromium.org>
Date:   Wed Feb 14 15:45:07 2018 -0800

    NFC: llcp: Limit size of SDP URI
    
    [ Upstream commit fe9c842695e26d8116b61b80bfb905356f07834b ]
    
    The tlv_len is u8, so we need to limit the size of the SDP URI. Enforce
    this both in the NLA policy and in the code that performs the allocation
    and copy, to avoid writing past the end of the allocated buffer.
    
    Fixes: d9b8d8e19b073 ("NFC: llcp: Service Name Lookup netlink interface")
    Signed-off-by: Kees Cook <keescook@chromium.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4a7cc649a73f344c323829bfa26aad2cd964c2d8
Author: Geert Uytterhoeven <geert+renesas@glider.be>
Date:   Tue Jan 2 16:25:35 2018 +0100

    ARM: OMAP1: clock: Fix debugfs_create_*() usage
    
    [ Upstream commit 8cbbf1745dcde7ba7e423dc70619d223de90fd43 ]
    
    When exposing data access through debugfs, the correct
    debugfs_create_*() functions must be used, depending on data type.
    
    Remove all casts from data pointers passed to debugfs_create_*()
    functions, as such casts prevent the compiler from flagging bugs.
    
    Correct all wrong usage:
      - clk.rate is unsigned long, not u32,
      - clk.flags is u8, not u32, which exposed the successive
        clk.rate_offset and clk.src_offset fields.
    
    Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
    Acked-by: Aaro Koskinen <aaro.koskinen@iki.fi>
    Signed-off-by: Tony Lindgren <tony@atomide.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f5441ffc9ce37a456164b5a37567f53f1cece420
Author: Tony Lindgren <tony@atomide.com>
Date:   Fri Feb 9 08:15:53 2018 -0800

    ARM: OMAP3: Fix prm wake interrupt for resume
    
    [ Upstream commit d3be6d2a08bd26580562d9714d3d97ea9ba22c73 ]
    
    For platform_suspend_ops, the finish call is too late to re-enable wake
    irqs and we need re-enable wake irqs on wake call instead.
    
    Otherwise noirq resume for devices has already happened. And then
    dev_pm_disarm_wake_irq() has already disabled the dedicated wake irqs
    when the interrupt triggers and the wake irq is never handled.
    
    For devices that are already in PM runtime suspended state when we
    enter suspend this means that a possible wake irq will never trigger.
    
    And this can lead into a situation where a device has a pending padconf
    wake irq, and the device will stay unresponsive to any further wake
    irqs.
    
    This issue can be easily reproduced by setting serial console log level
    to zero, letting the serial console idle, and suspend the system from
    an ssh terminal. Then try to wake up the system by typing to the serial
    console.
    
    Note that this affects only omap3 PRM interrupt as that's currently
    the only omap variant that does anything in omap_pm_wake().
    
    In general, for the wake irqs to work, the interrupt must have either
    IRQF_NO_SUSPEND or IRQF_EARLY_RESUME set for it to trigger before
    dev_pm_disarm_wake_irq() disables the wake irqs.
    
    Reported-by: Grygorii Strashko <grygorii.strashko@ti.com>
    Cc: Tero Kristo <t-kristo@ti.com>
    Signed-off-by: Tony Lindgren <tony@atomide.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5ab7e72697e27065450af8003385c67c7d173b86
Author: Manish Rangankar <manish.rangankar@cavium.com>
Date:   Sun Feb 11 22:48:41 2018 -0800

    scsi: qla4xxx: skip error recovery in case of register disconnect.
    
    [ Upstream commit 1bc5ad3a6acdcf56f83272f2de1cd2389ea9e9e2 ]
    
    A system crashes when continuously removing/re-adding the storage
    controller.
    
    Signed-off-by: Manish Rangankar <manish.rangankar@cavium.com>
    Reviewed-by: Ewan D. Milne <emilne@redhat.com>
    Reviewed-by: Tomas Henzl <thenzl@redhat.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6d059190a8582459eb28e877537a806647e0cca9
Author: Meelis Roos <mroos@linux.ee>
Date:   Fri Feb 9 08:57:44 2018 +0200

    scsi: aacraid: fix shutdown crash when init fails
    
    [ Upstream commit 00c20cdc79259c6c5bf978b21af96c2d3edb646d ]
    
    When aacraid init fails with "AAC0: adapter self-test failed.", shutdown
    leads to UBSAN warning and then oops:
    
    [154316.118423] ================================================================================
    [154316.118508] UBSAN: Undefined behaviour in drivers/scsi/scsi_lib.c:2328:27
    [154316.118566] member access within null pointer of type 'struct Scsi_Host'
    [154316.118631] CPU: 2 PID: 14530 Comm: reboot Tainted: G        W        4.15.0-dirty #89
    [154316.118701] Hardware name: Hewlett Packard HP NetServer/HP System Board, BIOS 4.06.46 PW 06/25/2003
    [154316.118774] Call Trace:
    [154316.118848]  dump_stack+0x48/0x65
    [154316.118916]  ubsan_epilogue+0xe/0x40
    [154316.118976]  __ubsan_handle_type_mismatch+0xfb/0x180
    [154316.119043]  scsi_block_requests+0x20/0x30
    [154316.119135]  aac_shutdown+0x18/0x40 [aacraid]
    [154316.119196]  pci_device_shutdown+0x33/0x50
    [154316.119269]  device_shutdown+0x18a/0x390
    [...]
    [154316.123435] BUG: unable to handle kernel NULL pointer dereference at 000000f4
    [154316.123515] IP: scsi_block_requests+0xa/0x30
    
    This is because aac_shutdown() does
    
            struct Scsi_Host *shost = pci_get_drvdata(dev);
            scsi_block_requests(shost);
    
    and that assumes shost has been assigned with pci_set_drvdata().
    
    However, pci_set_drvdata(pdev, shost) is done in aac_probe_one() far
    after bailing out with error from calling the init function
    ((*aac_drivers[index].init)(aac)), and when the init function fails, no
    error is returned from aac_probe_one() so PCI layer assumes there is
    driver attached, and tries to shut it down later.
    
    Fix it by returning error from aac_probe_one() when card-specific init
    function fails.
    
    This fixes reboot on my HP NetRAID-4M with dead battery.
    
    Signed-off-by: Meelis Roos <mroos@linux.ee>
    Reviewed-by: Dave Carroll <david.carroll@microsemi.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 21323aabe27f2c80e71fafc32a5c74648b3f6811
Author: Anders Roxell <anders.roxell@linaro.org>
Date:   Tue Feb 6 16:20:44 2018 -0600

    selftests: memfd: add config fragment for fuse
    
    [ Upstream commit 9a606f8d55cfc932ec02172aaed4124fdc150047 ]
    
    The memfd test requires to insert the fuse module (CONFIG_FUSE_FS).
    
    Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
    Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org>
    Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d72c90b4599bb89a926d6c81c7cf43d21994e82c
Author: Stefan Agner <stefan@agner.ch>
Date:   Mon Feb 12 00:14:42 2018 +0100

    usb: gadget: fsl_udc_core: fix ep valid checks
    
    [ Upstream commit 20c63f4089cceab803438c383631963e34c4d8e5 ]
    
    Clang reports the following warning:
      drivers/usb/gadget/udc/fsl_udc_core.c:1312:10: warning: address of array
      'ep->name' will always evaluate to 'true' [-Wpointer-bool-conversion]
            if (ep->name)
            ~~  ~~~~^~~~
    
    It seems that the authors intention was to check if the ep has been
    configured through struct_ep_setup. Check whether struct usb_ep name
    pointer has been set instead.
    
    Signed-off-by: Stefan Agner <stefan@agner.ch>
    Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3a7976cd3cdb497f0a4c8f712b910d2e3915b1d1
Author: John Keeping <john@metanate.com>
Date:   Fri Jan 12 18:43:32 2018 +0000

    usb: gadget: f_uac2: fix bFirstInterface in composite gadget
    
    [ Upstream commit 8813a59ed892305b5ac1b5b901740b1ad4b5fefa ]
    
    If there are multiple functions associated with a configuration, then
    the UAC2 interfaces may not start at zero.  Set the correct first
    interface number in the association descriptor so that the audio
    interfaces are enumerated correctly in this case.
    
    Reviewed-by: Krzysztof Opasiak <k.opasiak@samsung.com>
    Signed-off-by: John Keeping <john@metanate.com>
    Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 44d731a1670c901c6350e63ad6c853865d5af71c
Author: Bart Van Assche <bart.vanassche@wdc.com>
Date:   Thu Jan 25 08:24:29 2018 -0800

    scsi: qla2xxx: Avoid triggering undefined behavior in qla2x00_mbx_completion()
    
    [ Upstream commit c02189e12ce3bf3808cb880569d3b10249f50bd9 ]
    
    A left shift must shift less than the bit width of the left argument.
    Avoid triggering undefined behavior if ha->mbx_count == 32.
    
    This patch avoids that UBSAN reports the following complaint:
    
    UBSAN: Undefined behaviour in drivers/scsi/qla2xxx/qla_isr.c:275:14
    shift exponent 32 is too large for 32-bit type 'int'
    Call Trace:
     dump_stack+0x4e/0x6c
     ubsan_epilogue+0xd/0x3b
     __ubsan_handle_shift_out_of_bounds+0x112/0x14c
     qla2x00_mbx_completion+0x1c5/0x25d [qla2xxx]
     qla2300_intr_handler+0x1ea/0x3bb [qla2xxx]
     qla2x00_mailbox_command+0x77b/0x139a [qla2xxx]
     qla2x00_mbx_reg_test+0x83/0x114 [qla2xxx]
     qla2x00_chip_diag+0x354/0x45f [qla2xxx]
     qla2x00_initialize_adapter+0x2c2/0xa4e [qla2xxx]
     qla2x00_probe_one+0x1681/0x392e [qla2xxx]
     pci_device_probe+0x10b/0x1f1
     driver_probe_device+0x21f/0x3a4
     __driver_attach+0xa9/0xe1
     bus_for_each_dev+0x6e/0xb5
     driver_attach+0x22/0x3c
     bus_add_driver+0x1d1/0x2ae
     driver_register+0x78/0x130
     __pci_register_driver+0x75/0xa8
     qla2x00_module_init+0x21b/0x267 [qla2xxx]
     do_one_initcall+0x5a/0x1e2
     do_init_module+0x9d/0x285
     load_module+0x20db/0x38e3
     SYSC_finit_module+0xa8/0xbc
     SyS_finit_module+0x9/0xb
     do_syscall_64+0x77/0x271
     entry_SYSCALL64_slow_path+0x25/0x25
    
    Reported-by: Meelis Roos <mroos@linux.ee>
    Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
    Cc: Himanshu Madhani <himanshu.madhani@cavium.com>
    Reviewed-by: Laurence Oberman <loberman@redhat.com>
    Acked-by: Himanshu Madhani <himanshu.madhani@cavium.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 57ee3868c7136003e1ff675e41cb2c774211d6bd
Author: Dan Carpenter <dan.carpenter@oracle.com>
Date:   Thu Jan 25 17:27:27 2018 +0300

    scsi: mptfusion: Add bounds check in mptctl_hp_targetinfo()
    
    [ Upstream commit a7043e9529f3c367cc4d82997e00be034cbe57ca ]
    
    My static checker complains about an out of bounds read:
    
        drivers/message/fusion/mptctl.c:2786 mptctl_hp_targetinfo()
        error: buffer overflow 'hd->sel_timeout' 255 <= u32max.
    
    It's true that we probably should have a bounds check here.
    
    Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
    Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f7c06035ba6c3bae9e0a556e6e68d81c14d75e3f
Author: Dan Carpenter <dan.carpenter@oracle.com>
Date:   Thu Jan 25 17:13:40 2018 +0300

    scsi: sym53c8xx_2: iterator underflow in sym_getsync()
    
    [ Upstream commit e6f791d95313c85f3dd4a26141e28e50ae9aa0ae ]
    
    We wanted to exit the loop with "div" set to zero, but instead, if we
    don't hit the break then "div" is -1 when we finish the loop.  It leads
    to an array underflow a few lines later.
    
    Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
    Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
    Acked-by: Matthew Wilcox <mawilcox@microsoft.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 34bd6e78ddb1c54c5400250fa8816c0ddbc4b33d
Author: Chad Dupuis <chad.dupuis@cavium.com>
Date:   Wed Jan 24 08:07:06 2018 -0800

    scsi: bnx2fc: Fix check in SCSI completion handler for timed out request
    
    [ Upstream commit ecf7ff49945f5741fa1da112f994939f942031d3 ]
    
    When a request times out we set the io_req flag BNX2FC_FLAG_IO_COMPL so
    that if a subsequent completion comes in on that task ID we will ignore
    it.  The issue is that in the check for this flag there is a missing
    return so we will continue to process a request which may have already
    been returned to the ownership of the SCSI layer.  This can cause
    unpredictable results.
    
    Solution is to add in the missing return.
    
    [mkp: typo plus title shortening]
    
    Signed-off-by: Chad Dupuis <chad.dupuis@cavium.com>
    Reviewed-by: Laurence Oberman <loberman@redhat.com>
    Tested-by: Laurence Oberman <loberman@redhat.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1da0681380798b41437351cc788e0213a5c5cb47
Author: Sujit Reddy Thumma <sthumma@codeaurora.org>
Date:   Wed Jan 24 09:52:35 2018 +0530

    scsi: ufs: Enable quirk to ignore sending WRITE_SAME command
    
    [ Upstream commit 84af7e8b895088d89f246d6b0f82717fafdebf61 ]
    
    WRITE_SAME command is not supported by UFS. Enable a quirk for the upper
    level drivers to not send WRITE SAME command.
    
    [mkp: botched patch, applied by hand]
    
    Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
    Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
    Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 617d71506940e60c5960fcfa235f7c194a9e94b5
Author: Mark Salter <msalter@redhat.com>
Date:   Fri Feb 2 09:20:29 2018 -0500

    irqchip/gic-v3: Change pr_debug message to pr_devel
    
    [ Upstream commit b6dd4d83dc2f78cebc9a7e6e7e4bc2be4d29b94d ]
    
    The pr_debug() in gic-v3 gic_send_sgi() can trigger a circular locking
    warning:
    
     GICv3: CPU10: ICC_SGI1R_EL1 5000400
     ======================================================
     WARNING: possible circular locking dependency detected
     4.15.0+ #1 Tainted: G        W
     ------------------------------------------------------
     dynamic_debug01/1873 is trying to acquire lock:
      ((console_sem).lock){-...}, at: [<0000000099c891ec>] down_trylock+0x20/0x4c
    
     but task is already holding lock:
      (&rq->lock){-.-.}, at: [<00000000842e1587>] __task_rq_lock+0x54/0xdc
    
     which lock already depends on the new lock.
    
     the existing dependency chain (in reverse order) is:
    
     -> #2 (&rq->lock){-.-.}:
            __lock_acquire+0x3b4/0x6e0
            lock_acquire+0xf4/0x2a8
            _raw_spin_lock+0x4c/0x60
            task_fork_fair+0x3c/0x148
            sched_fork+0x10c/0x214
            copy_process.isra.32.part.33+0x4e8/0x14f0
            _do_fork+0xe8/0x78c
            kernel_thread+0x48/0x54
            rest_init+0x34/0x2a4
            start_kernel+0x45c/0x488
    
     -> #1 (&p->pi_lock){-.-.}:
            __lock_acquire+0x3b4/0x6e0
            lock_acquire+0xf4/0x2a8
            _raw_spin_lock_irqsave+0x58/0x70
            try_to_wake_up+0x48/0x600
            wake_up_process+0x28/0x34
            __up.isra.0+0x60/0x6c
            up+0x60/0x68
            __up_console_sem+0x4c/0x7c
            console_unlock+0x328/0x634
            vprintk_emit+0x25c/0x390
            dev_vprintk_emit+0xc4/0x1fc
            dev_printk_emit+0x88/0xa8
            __dev_printk+0x58/0x9c
            _dev_info+0x84/0xa8
            usb_new_device+0x100/0x474
            hub_port_connect+0x280/0x92c
            hub_event+0x740/0xa84
            process_one_work+0x240/0x70c
            worker_thread+0x60/0x400
            kthread+0x110/0x13c
            ret_from_fork+0x10/0x18
    
     -> #0 ((console_sem).lock){-...}:
            validate_chain.isra.34+0x6e4/0xa20
            __lock_acquire+0x3b4/0x6e0
            lock_acquire+0xf4/0x2a8
            _raw_spin_lock_irqsave+0x58/0x70
            down_trylock+0x20/0x4c
            __down_trylock_console_sem+0x3c/0x9c
            console_trylock+0x20/0xb0
            vprintk_emit+0x254/0x390
            vprintk_default+0x58/0x90
            vprintk_func+0xbc/0x164
            printk+0x80/0xa0
            __dynamic_pr_debug+0x84/0xac
            gic_raise_softirq+0x184/0x18c
            smp_cross_call+0xac/0x218
            smp_send_reschedule+0x3c/0x48
            resched_curr+0x60/0x9c
            check_preempt_curr+0x70/0xdc
            wake_up_new_task+0x310/0x470
            _do_fork+0x188/0x78c
            SyS_clone+0x44/0x50
            __sys_trace_return+0x0/0x4
    
     other info that might help us debug this:
    
     Chain exists of:
       (console_sem).lock --> &p->pi_lock --> &rq->lock
    
      Possible unsafe locking scenario:
    
            CPU0                    CPU1
            ----                    ----
       lock(&rq->lock);
                                    lock(&p->pi_lock);
                                    lock(&rq->lock);
       lock((console_sem).lock);
    
      *** DEADLOCK ***
    
     2 locks held by dynamic_debug01/1873:
      #0:  (&p->pi_lock){-.-.}, at: [<000000001366df53>] wake_up_new_task+0x40/0x470
      #1:  (&rq->lock){-.-.}, at: [<00000000842e1587>] __task_rq_lock+0x54/0xdc
    
     stack backtrace:
     CPU: 10 PID: 1873 Comm: dynamic_debug01 Tainted: G        W        4.15.0+ #1
     Hardware name: GIGABYTE R120-T34-00/MT30-GS2-00, BIOS T48 10/02/2017
     Call trace:
      dump_backtrace+0x0/0x188
      show_stack+0x24/0x2c
      dump_stack+0xa4/0xe0
      print_circular_bug.isra.31+0x29c/0x2b8
      check_prev_add.constprop.39+0x6c8/0x6dc
      validate_chain.isra.34+0x6e4/0xa20
      __lock_acquire+0x3b4/0x6e0
      lock_acquire+0xf4/0x2a8
      _raw_spin_lock_irqsave+0x58/0x70
      down_trylock+0x20/0x4c
      __down_trylock_console_sem+0x3c/0x9c
      console_trylock+0x20/0xb0
      vprintk_emit+0x254/0x390
      vprintk_default+0x58/0x90
      vprintk_func+0xbc/0x164
      printk+0x80/0xa0
      __dynamic_pr_debug+0x84/0xac
      gic_raise_softirq+0x184/0x18c
      smp_cross_call+0xac/0x218
      smp_send_reschedule+0x3c/0x48
      resched_curr+0x60/0x9c
      check_preempt_curr+0x70/0xdc
      wake_up_new_task+0x310/0x470
      _do_fork+0x188/0x78c
      SyS_clone+0x44/0x50
      __sys_trace_return+0x0/0x4
     GICv3: CPU0: ICC_SGI1R_EL1 12000
    
    This could be fixed with printk_deferred() but that might lessen its
    usefulness for debugging. So change it to pr_devel to keep it out of
    production kernels. Developers working on gic-v3 can enable it as
    needed in their kernels.
    
    Signed-off-by: Mark Salter <msalter@redhat.com>
    Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0ee08b0c6efbda0cb25e6f3252ec3b27797ed50b
Author: Tang Junhui <tang.junhui@zte.com.cn>
Date:   Wed Feb 7 11:41:45 2018 -0800

    bcache: return attach error when no cache set exist
    
    [ Upstream commit 7f4fc93d4713394ee8f1cd44c238e046e11b4f15 ]
    
    I attach a back-end device to a cache set, and the cache set is not
    registered yet, this back-end device did not attach successfully, and no
    error returned:
    [root]# echo 87859280-fec6-4bcc-20df7ca8f86b > /sys/block/sde/bcache/attach
    [root]#
    
    In sysfs_attach(), the return value "v" is initialized to "size" in
    the beginning, and if no cache set exist in bch_cache_sets, the "v" value
    would not change any more, and return to sysfs, sysfs regard it as success
    since the "size" is a positive number.
    
    This patch fixes this issue by assigning "v" with "-ENOENT" in the
    initialization.
    
    Signed-off-by: Tang Junhui <tang.junhui@zte.com.cn>
    Reviewed-by: Michael Lyle <mlyle@lyle.org>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 11d1a3d57d80331af0ebd39452cb998b73891117
Author: Tang Junhui <tang.junhui@zte.com.cn>
Date:   Wed Feb 7 11:41:46 2018 -0800

    bcache: fix for data collapse after re-attaching an attached device
    
    [ Upstream commit 73ac105be390c1de42a2f21643c9778a5e002930 ]
    
    back-end device sdm has already attached a cache_set with ID
    f67ebe1f-f8bc-4d73-bfe5-9dc88607f119, then try to attach with
    another cache set, and it returns with an error:
    [root]# cd /sys/block/sdm/bcache
    [root]# echo 5ccd0a63-148e-48b8-afa2-aca9cbd6279f > attach
    -bash: echo: write error: Invalid argument
    
    After that, execute a command to modify the label of bcache
    device:
    [root]# echo data_disk1 > label
    
    Then we reboot the system, when the system power on, the back-end
    device can not attach to cache_set, a messages show in the log:
    Feb  5 12:05:52 ceph152 kernel: [922385.508498] bcache:
    bch_cached_dev_attach() couldn't find uuid for sdm in set
    
    In sysfs_attach(), dc->sb.set_uuid was assigned to the value
    which input through sysfs, no matter whether it is success
    or not in bch_cached_dev_attach(). For example, If the back-end
    device has already attached to an cache set, bch_cached_dev_attach()
    would fail, but dc->sb.set_uuid was changed. Then modify the
    label of bcache device, it will call bch_write_bdev_super(),
    which would write the dc->sb.set_uuid to the super block, so we
    record a wrong cache set ID in the super block, after the system
    reboot, the cache set couldn't find the uuid of the back-end
    device, so the bcache device couldn't exist and use any more.
    
    In this patch, we don't assigned cache set ID to dc->sb.set_uuid
    in sysfs_attach() directly, but input it into bch_cached_dev_attach(),
    and assigned dc->sb.set_uuid to the cache set ID after the back-end
    device attached to the cache set successful.
    
    Signed-off-by: Tang Junhui <tang.junhui@zte.com.cn>
    Reviewed-by: Michael Lyle <mlyle@lyle.org>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e2febcb179333708042bddcc293fb071ec9c52df
Author: Tang Junhui <tang.junhui@zte.com.cn>
Date:   Wed Feb 7 11:41:43 2018 -0800

    bcache: fix for allocator and register thread race
    
    [ Upstream commit 682811b3ce1a5a4e20d700939a9042f01dbc66c4 ]
    
    After long time running of random small IO writing,
    I reboot the machine, and after the machine power on,
    I found bcache got stuck, the stack is:
    [root@ceph153 ~]# cat /proc/2510/task/*/stack
    [<ffffffffa06b2455>] closure_sync+0x25/0x90 [bcache]
    [<ffffffffa06b6be8>] bch_journal+0x118/0x2b0 [bcache]
    [<ffffffffa06b6dc7>] bch_journal_meta+0x47/0x70 [bcache]
    [<ffffffffa06be8f7>] bch_prio_write+0x237/0x340 [bcache]
    [<ffffffffa06a8018>] bch_allocator_thread+0x3c8/0x3d0 [bcache]
    [<ffffffff810a631f>] kthread+0xcf/0xe0
    [<ffffffff8164c318>] ret_from_fork+0x58/0x90
    [<ffffffffffffffff>] 0xffffffffffffffff
    [root@ceph153 ~]# cat /proc/2038/task/*/stack
    [<ffffffffa06b1abd>] __bch_btree_map_nodes+0x12d/0x150 [bcache]
    [<ffffffffa06b1bd1>] bch_btree_insert+0xf1/0x170 [bcache]
    [<ffffffffa06b637f>] bch_journal_replay+0x13f/0x230 [bcache]
    [<ffffffffa06c75fe>] run_cache_set+0x79a/0x7c2 [bcache]
    [<ffffffffa06c0cf8>] register_bcache+0xd48/0x1310 [bcache]
    [<ffffffff812f702f>] kobj_attr_store+0xf/0x20
    [<ffffffff8125b216>] sysfs_write_file+0xc6/0x140
    [<ffffffff811dfbfd>] vfs_write+0xbd/0x1e0
    [<ffffffff811e069f>] SyS_write+0x7f/0xe0
    [<ffffffff8164c3c9>] system_call_fastpath+0x16/0x1
    The stack shows the register thread and allocator thread
    were getting stuck when registering cache device.
    
    I reboot the machine several times, the issue always
    exsit in this machine.
    
    I debug the code, and found the call trace as bellow:
    register_bcache()
       ==>run_cache_set()
          ==>bch_journal_replay()
             ==>bch_btree_insert()
                ==>__bch_btree_map_nodes()
                   ==>btree_insert_fn()
                      ==>btree_split() //node need split
                         ==>btree_check_reserve()
    In btree_check_reserve(), It will check if there is enough buckets
    of RESERVE_BTREE type, since allocator thread did not work yet, so
    no buckets of RESERVE_BTREE type allocated, so the register thread
    waits on c->btree_cache_wait, and goes to sleep.
    
    Then the allocator thread initialized, the call trace is bellow:
    bch_allocator_thread()
    ==>bch_prio_write()
       ==>bch_journal_meta()
          ==>bch_journal()
             ==>journal_wait_for_write()
    In journal_wait_for_write(), It will check if journal is full by
    journal_full(), but the long time random small IO writing
    causes the exhaustion of journal buckets(journal.blocks_free=0),
    In order to release the journal buckets,
    the allocator calls btree_flush_write() to flush keys to
    btree nodes, and waits on c->journal.wait until btree nodes writing
    over or there has already some journal buckets space, then the
    allocator thread goes to sleep. but in btree_flush_write(), since
    bch_journal_replay() is not finished, so no btree nodes have journal
    (condition "if (btree_current_write(b)->journal)" never satisfied),
    so we got no btree node to flush, no journal bucket released,
    and allocator sleep all the times.
    
    Through the above analysis, we can see that:
    1) Register thread wait for allocator thread to allocate buckets of
       RESERVE_BTREE type;
    2) Alloctor thread wait for register thread to replay journal, so it
       can flush btree nodes and get journal bucket.
       then they are all got stuck by waiting for each other.
    
    Hua Rui provided a patch for me, by allocating some buckets of
    RESERVE_BTREE type in advance, so the register thread can get bucket
    when btree node splitting and no need to waiting for the allocator
    thread. I tested it, it has effect, and register thread run a step
    forward, but finally are still got stuck, the reason is only 8 bucket
    of RESERVE_BTREE type were allocated, and in bch_journal_replay(),
    after 2 btree nodes splitting, only 4 bucket of RESERVE_BTREE type left,
    then btree_check_reserve() is not satisfied anymore, so it goes to sleep
    again, and in the same time, alloctor thread did not flush enough btree
    nodes to release a journal bucket, so they all got stuck again.
    
    So we need to allocate more buckets of RESERVE_BTREE type in advance,
    but how much is enough?  By experience and test, I think it should be
    as much as journal buckets. Then I modify the code as this patch,
    and test in the machine, and it works.
    
    This patch modified base on Hua Rui’s patch, and allocate more buckets
    of RESERVE_BTREE type in advance to avoid register thread and allocate
    thread going to wait for each other.
    
    [patch v2] ca->sb.njournal_buckets would be 0 in the first time after
    cache creation, and no journal exists, so just 8 btree buckets is OK.
    
    Signed-off-by: Hua Rui <huarui.dev@gmail.com>
    Signed-off-by: Tang Junhui <tang.junhui@zte.com.cn>
    Reviewed-by: Michael Lyle <mlyle@lyle.org>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c969aa8da34782b810a9592683ad689a91aa8b77
Author: Coly Li <colyli@suse.de>
Date:   Wed Feb 7 11:41:41 2018 -0800

    bcache: properly set task state in bch_writeback_thread()
    
    [ Upstream commit 99361bbf26337186f02561109c17a4c4b1a7536a ]
    
    Kernel thread routine bch_writeback_thread() has the following code block,
    
    447         down_write(&dc->writeback_lock);
    448~450     if (check conditions) {
    451                 up_write(&dc->writeback_lock);
    452                 set_current_state(TASK_INTERRUPTIBLE);
    453
    454                 if (kthread_should_stop())
    455                         return 0;
    456
    457                 schedule();
    458                 continue;
    459         }
    
    If condition check is true, its task state is set to TASK_INTERRUPTIBLE
    and call schedule() to wait for others to wake up it.
    
    There are 2 issues in current code,
    1, Task state is set to TASK_INTERRUPTIBLE after the condition checks, if
       another process changes the condition and call wake_up_process(dc->
       writeback_thread), then at line 452 task state is set back to
       TASK_INTERRUPTIBLE, the writeback kernel thread will lose a chance to be
       waken up.
    2, At line 454 if kthread_should_stop() is true, writeback kernel thread
       will return to kernel/kthread.c:kthread() with TASK_INTERRUPTIBLE and
       call do_exit(). It is not good to enter do_exit() with task state
       TASK_INTERRUPTIBLE, in following code path might_sleep() is called and a
       warning message is reported by __might_sleep(): "WARNING: do not call
       blocking ops when !TASK_RUNNING; state=1 set at [xxxx]".
    
    For the first issue, task state should be set before condition checks.
    Ineed because dc->writeback_lock is required when modifying all the
    conditions, calling set_current_state() inside code block where dc->
    writeback_lock is hold is safe. But this is quite implicit, so I still move
    set_current_state() before all the condition checks.
    
    For the second issue, frankley speaking it does not hurt when kernel thread
    exits with TASK_INTERRUPTIBLE state, but this warning message scares users,
    makes them feel there might be something risky with bcache and hurt their
    data.  Setting task state to TASK_RUNNING before returning fixes this
    problem.
    
    In alloc.c:allocator_wait(), there is also a similar issue, and is also
    fixed in this patch.
    
    Changelog:
    v3: merge two similar fixes into one patch
    v2: fix the race issue in v1 patch.
    v1: initial buggy fix.
    
    Signed-off-by: Coly Li <colyli@suse.de>
    Reviewed-by: Hannes Reinecke <hare@suse.de>
    Reviewed-by: Michael Lyle <mlyle@lyle.org>
    Cc: Michael Lyle <mlyle@lyle.org>
    Cc: Junhui Tang <tang.junhui@zte.com.cn>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 635716ddbaa2cb802f7ddd9fb2b916db795776c3
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Fri Feb 2 16:48:47 2018 +0100

    cifs: silence compiler warnings showing up with gcc-8.0.0
    
    [ Upstream commit ade7db991b47ab3016a414468164f4966bd08202 ]
    
    This bug was fixed before, but came up again with the latest
    compiler in another function:
    
    fs/cifs/cifssmb.c: In function 'CIFSSMBSetEA':
    fs/cifs/cifssmb.c:6362:3: error: 'strncpy' offset 8 is out of the bounds [0, 4] [-Werror=array-bounds]
       strncpy(parm_data->list[0].name, ea_name, name_len);
    
    Let's apply the same fix that was used for the other instances.
    
    Fixes: b2a3ad9ca502 ("cifs: silence compiler warnings showing up with gcc-4.7.0")
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Signed-off-by: Steve French <smfrench@gmail.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1a159e90ffbe1e1a23f89b1b8ccdebce57ceac1d
Author: Alexey Dobriyan <adobriyan@gmail.com>
Date:   Tue Feb 6 15:36:59 2018 -0800

    proc: fix /proc/*/map_files lookup
    
    [ Upstream commit ac7f1061c2c11bb8936b1b6a94cdb48de732f7a4 ]
    
    Current code does:
    
            if (sscanf(dentry->d_name.name, "%lx-%lx", start, end) != 2)
    
    However sscanf() is broken garbage.
    
    It silently accepts whitespace between format specifiers
    (did you know that?).
    
    It silently accepts valid strings which result in integer overflow.
    
    Do not use sscanf() for any even remotely reliable parsing code.
    
            OK
            # readlink '/proc/1/map_files/55a23af39000-55a23b05b000'
            /lib/systemd/systemd
    
            broken
            # readlink '/proc/1/map_files/               55a23af39000-55a23b05b000'
            /lib/systemd/systemd
    
            broken
            # readlink '/proc/1/map_files/55a23af39000-55a23b05b000    '
            /lib/systemd/systemd
    
            very broken
            # readlink '/proc/1/map_files/1000000000000000055a23af39000-55a23b05b000'
            /lib/systemd/systemd
    
    Andrei said:
    
    : This patch breaks criu.  It was a bug in criu.  And this bug is on a minor
    : path, which works when memfd_create() isn't available.  It is a reason why
    : I ask to not backport this patch to stable kernels.
    :
    : In CRIU this bug can be triggered, only if this patch will be backported
    : to a kernel which version is lower than v3.16.
    
    Link: http://lkml.kernel.org/r/20171120212706.GA14325@avx2
    Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
    Cc: Pavel Emelyanov <xemul@openvz.org>
    Cc: Andrei Vagin <avagin@virtuozzo.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6af42d1a3b9d0d2cc6831580806804fef4faeb2d
Author: Ross Lagerwall <ross.lagerwall@citrix.com>
Date:   Thu Jan 11 09:36:37 2018 +0000

    xen/grant-table: Use put_page instead of free_page
    
    [ Upstream commit 3ac7292a25db1c607a50752055a18aba32ac2176 ]
    
    The page given to gnttab_end_foreign_access() to free could be a
    compound page so use put_page() instead of free_page() since it can
    handle both compound and single pages correctly.
    
    This bug was discovered when migrating a Xen VM with several VIFs and
    CONFIG_DEBUG_VM enabled. It hits a BUG usually after fewer than 10
    iterations. All netfront devices disconnect from the backend during a
    suspend/resume and this will call gnttab_end_foreign_access() if a
    netfront queue has an outstanding skb. The mismatch between calling
    get_page() and free_page() on a compound page causes a reference
    counting error which is detected when DEBUG_VM is enabled.
    
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 162180a735bf16d09ed575247944342fd1f3b792
Author: Matt Redfearn <matt.redfearn@mips.com>
Date:   Mon Jan 29 11:26:45 2018 +0000

    MIPS: TXx9: use IS_BUILTIN() for CONFIG_LEDS_CLASS
    
    [ Upstream commit 0cde5b44a30f1daaef1c34e08191239dc63271c4 ]
    
    When commit b27311e1cace ("MIPS: TXx9: Add RBTX4939 board support")
    added board support for the RBTX4939, it added a call to
    led_classdev_register even if the LED class is built as a module.
    Built-in arch code cannot call module code directly like this. Commit
    b33b44073734 ("MIPS: TXX9: use IS_ENABLED() macro") subsequently
    changed the inclusion of this code to a single check that
    CONFIG_LEDS_CLASS is either builtin or a module, but the same issue
    remains.
    
    This leads to MIPS allmodconfig builds failing when CONFIG_MACH_TX49XX=y
    is set:
    
    arch/mips/txx9/rbtx4939/setup.o: In function `rbtx4939_led_probe':
    setup.c:(.init.text+0xc0): undefined reference to `of_led_classdev_register'
    make: *** [Makefile:999: vmlinux] Error 1
    
    Fix this by using the IS_BUILTIN() macro instead.
    
    Fixes: b27311e1cace ("MIPS: TXx9: Add RBTX4939 board support")
    Signed-off-by: Matt Redfearn <matt.redfearn@mips.com>
    Reviewed-by: James Hogan <jhogan@kernel.org>
    Cc: Ralf Baechle <ralf@linux-mips.org>
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/18544/
    Signed-off-by: James Hogan <jhogan@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4c53640915f20c4372239348d89d4338b55da2f4
Author: Chen Yu <yu.c.chen@intel.com>
Date:   Mon Jan 29 10:26:46 2018 +0800

    ACPI: processor_perflib: Do not send _PPC change notification if not ready
    
    [ Upstream commit ba1edb9a5125a617d612f98eead14b9b84e75c3a ]
    
    The following warning was triggered after resumed from S3 -
    if all the nonboot CPUs were put offline before suspend:
    
    [ 1840.329515] unchecked MSR access error: RDMSR from 0x771 at rIP: 0xffffffff86061e3a (native_read_msr+0xa/0x30)
    [ 1840.329516] Call Trace:
    [ 1840.329521]  __rdmsr_on_cpu+0x33/0x50
    [ 1840.329525]  generic_exec_single+0x81/0xb0
    [ 1840.329527]  smp_call_function_single+0xd2/0x100
    [ 1840.329530]  ? acpi_ds_result_pop+0xdd/0xf2
    [ 1840.329532]  ? acpi_ds_create_operand+0x215/0x23c
    [ 1840.329534]  rdmsrl_on_cpu+0x57/0x80
    [ 1840.329536]  ? cpumask_next+0x1b/0x20
    [ 1840.329538]  ? rdmsrl_on_cpu+0x57/0x80
    [ 1840.329541]  intel_pstate_update_perf_limits+0xf3/0x220
    [ 1840.329544]  ? notifier_call_chain+0x4a/0x70
    [ 1840.329546]  intel_pstate_set_policy+0x4e/0x150
    [ 1840.329548]  cpufreq_set_policy+0xcd/0x2f0
    [ 1840.329550]  cpufreq_update_policy+0xb2/0x130
    [ 1840.329552]  ? cpufreq_update_policy+0x130/0x130
    [ 1840.329556]  acpi_processor_ppc_has_changed+0x65/0x80
    [ 1840.329558]  acpi_processor_notify+0x80/0x100
    [ 1840.329561]  acpi_ev_notify_dispatch+0x44/0x5c
    [ 1840.329563]  acpi_os_execute_deferred+0x14/0x20
    [ 1840.329565]  process_one_work+0x193/0x3c0
    [ 1840.329567]  worker_thread+0x35/0x3b0
    [ 1840.329569]  kthread+0x125/0x140
    [ 1840.329571]  ? process_one_work+0x3c0/0x3c0
    [ 1840.329572]  ? kthread_park+0x60/0x60
    [ 1840.329575]  ? do_syscall_64+0x67/0x180
    [ 1840.329577]  ret_from_fork+0x25/0x30
    [ 1840.329585] unchecked MSR access error: WRMSR to 0x774 (tried to write 0x0000000000000000) at rIP: 0xffffffff86061f78 (native_write_msr+0x8/0x30)
    [ 1840.329586] Call Trace:
    [ 1840.329587]  __wrmsr_on_cpu+0x37/0x40
    [ 1840.329589]  generic_exec_single+0x81/0xb0
    [ 1840.329592]  smp_call_function_single+0xd2/0x100
    [ 1840.329594]  ? acpi_ds_create_operand+0x215/0x23c
    [ 1840.329595]  ? cpumask_next+0x1b/0x20
    [ 1840.329597]  wrmsrl_on_cpu+0x57/0x70
    [ 1840.329598]  ? rdmsrl_on_cpu+0x57/0x80
    [ 1840.329599]  ? wrmsrl_on_cpu+0x57/0x70
    [ 1840.329602]  intel_pstate_hwp_set+0xd3/0x150
    [ 1840.329604]  intel_pstate_set_policy+0x119/0x150
    [ 1840.329606]  cpufreq_set_policy+0xcd/0x2f0
    [ 1840.329607]  cpufreq_update_policy+0xb2/0x130
    [ 1840.329610]  ? cpufreq_update_policy+0x130/0x130
    [ 1840.329613]  acpi_processor_ppc_has_changed+0x65/0x80
    [ 1840.329615]  acpi_processor_notify+0x80/0x100
    [ 1840.329617]  acpi_ev_notify_dispatch+0x44/0x5c
    [ 1840.329619]  acpi_os_execute_deferred+0x14/0x20
    [ 1840.329620]  process_one_work+0x193/0x3c0
    [ 1840.329622]  worker_thread+0x35/0x3b0
    [ 1840.329624]  kthread+0x125/0x140
    [ 1840.329625]  ? process_one_work+0x3c0/0x3c0
    [ 1840.329626]  ? kthread_park+0x60/0x60
    [ 1840.329628]  ? do_syscall_64+0x67/0x180
    [ 1840.329631]  ret_from_fork+0x25/0x30
    
    This is because if there's only one online CPU, the MSR_PM_ENABLE
    (package wide)can not be enabled after resumed, due to
    intel_pstate_hwp_enable() will only be invoked on AP's online
    process after resumed - if there's no AP online, the HWP remains
    disabled after resumed (BIOS has disabled it in S3). Then if
    there comes a _PPC change notification which touches HWP register
    during this stage, the warning is triggered.
    
    Since we don't call acpi_processor_register_performance() when
    HWP is enabled, the pr->performance will be NULL. When this is
    NULL we don't need to do _PPC change notification.
    
    Reported-by: Doug Smythies <dsmythies@telus.net>
    Suggested-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
    Signed-off-by: Yu Chen <yu.c.chen@intel.com>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a78a787aae99d97fc5b0209d76df4031daebb707
Author: Jean Delvare <jdelvare@suse.de>
Date:   Sat Feb 3 11:25:20 2018 +0100

    firmware: dmi_scan: Fix handling of empty DMI strings
    
    [ Upstream commit a7770ae194569e96a93c48aceb304edded9cc648 ]
    
    The handling of empty DMI strings looks quite broken to me:
    * Strings from 1 to 7 spaces are not considered empty.
    * True empty DMI strings (string index set to 0) are not considered
      empty, and result in allocating a 0-char string.
    * Strings with invalid index also result in allocating a 0-char
      string.
    * Strings starting with 8 spaces are all considered empty, even if
      non-space characters follow (sounds like a weird thing to do, but
      I have actually seen occurrences of this in DMI tables before.)
    * Strings which are considered empty are reported as 8 spaces,
      instead of being actually empty.
    
    Some of these issues are the result of an off-by-one error in memcmp,
    the rest is incorrect by design.
    
    So let's get it square: missing strings and strings made of only
    spaces, regardless of their length, should be treated as empty and
    no memory should be allocated for them. All other strings are
    non-empty and should be allocated.
    
    Signed-off-by: Jean Delvare <jdelvare@suse.de>
    Fixes: 79da4721117f ("x86: fix DMI out of memory problems")
    Cc: Parag Warudkar <parag.warudkar@gmail.com>
    Cc: Ingo Molnar <mingo@kernel.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c9d86aa02faae8ea79065ef72fe3f886936a69bf
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Fri Feb 2 15:56:18 2018 +0100

    x86/power: Fix swsusp_arch_resume prototype
    
    [ Upstream commit 328008a72d38b5bde6491e463405c34a81a65d3e ]
    
    The declaration for swsusp_arch_resume marks it as 'asmlinkage', but the
    definition in x86-32 does not, and it fails to include the header with the
    declaration. This leads to a warning when building with
    link-time-optimizations:
    
    kernel/power/power.h:108:23: error: type of 'swsusp_arch_resume' does not match original declaration [-Werror=lto-type-mismatch]
     extern asmlinkage int swsusp_arch_resume(void);
                           ^
    arch/x86/power/hibernate_32.c:148:0: note: 'swsusp_arch_resume' was previously declared here
     int swsusp_arch_resume(void)
    
    This moves the declaration into a globally visible header file and fixes up
    both x86 definitions to match it.
    
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Cc: Len Brown <len.brown@intel.com>
    Cc: Andi Kleen <ak@linux.intel.com>
    Cc: Nicolas Pitre <nico@linaro.org>
    Cc: linux-pm@vger.kernel.org
    Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
    Cc: Pavel Machek <pavel@ucw.cz>
    Cc: Bart Van Assche <bart.vanassche@wdc.com>
    Link: https://lkml.kernel.org/r/20180202145634.200291-2-arnd@arndb.de
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2ab6382c53d4b15960004c96c469fe12f81db8ca
Author: Alex Estrin <alex.estrin@intel.com>
Date:   Thu Feb 1 10:55:41 2018 -0800

    IB/ipoib: Fix for potential no-carrier state
    
    [ Upstream commit 1029361084d18cc270f64dfd39529fafa10cfe01 ]
    
    On reboot SM can program port pkey table before ipoib registered its
    event handler, which could result in missing pkey event and leave root
    interface with initial pkey value from index 0.
    
    Since OPA port starts with invalid pkey in index 0, root interface will
    fail to initialize and stay down with no-carrier flag.
    
    For IB ipoib interface may end up with pkey different from value
    opensm put in pkey table idx 0, resulting in connectivity issues
    (different mcast groups, for example).
    
    Close the window by calling event handler after registration
    to make sure ipoib pkey is in sync with port pkey table.
    
    Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
    Reviewed-by: Ira Weiny <ira.weiny@intel.com>
    Signed-off-by: Alex Estrin <alex.estrin@intel.com>
    Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
    Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0a07b78516b99732edf732ea43d05efaae260d85
Author: Mel Gorman <mgorman@techsingularity.net>
Date:   Wed Jan 31 16:19:52 2018 -0800

    mm: pin address_space before dereferencing it while isolating an LRU page
    
    [ Upstream commit 69d763fc6d3aee787a3e8c8c35092b4f4960fa5d ]
    
    Minchan Kim asked the following question -- what locks protects
    address_space destroying when race happens between inode trauncation and
    __isolate_lru_page? Jan Kara clarified by describing the race as follows
    
    CPU1                                            CPU2
    
    truncate(inode)                                 __isolate_lru_page()
      ...
      truncate_inode_page(mapping, page);
        delete_from_page_cache(page)
          spin_lock_irqsave(&mapping->tree_lock, flags);
            __delete_from_page_cache(page, NULL)
              page_cache_tree_delete(..)
                ...                                   mapping = page_mapping(page);
                page->mapping = NULL;
                ...
          spin_unlock_irqrestore(&mapping->tree_lock, flags);
          page_cache_free_page(mapping, page)
            put_page(page)
              if (put_page_testzero(page)) -> false
    - inode now has no pages and can be freed including embedded address_space
    
                                                      if (mapping && !mapping->a_ops->migratepage)
    - we've dereferenced mapping which is potentially already free.
    
    The race is theoretically possible but unlikely.  Before the
    delete_from_page_cache, truncate_cleanup_page is called so the page is
    likely to be !PageDirty or PageWriteback which gets skipped by the only
    caller that checks the mappping in __isolate_lru_page.  Even if the race
    occurs, a substantial amount of work has to happen during a tiny window
    with no preemption but it could potentially be done using a virtual
    machine to artifically slow one CPU or halt it during the critical
    window.
    
    This patch should eliminate the race with truncation by try-locking the
    page before derefencing mapping and aborting if the lock was not
    acquired.  There was a suggestion from Huang Ying to use RCU as a
    side-effect to prevent mapping being freed.  However, I do not like the
    solution as it's an unconventional means of preserving a mapping and
    it's not a context where rcu_read_lock is obviously protecting rcu data.
    
    Link: http://lkml.kernel.org/r/20180104102512.2qos3h5vqzeisrek@techsingularity.net
    Fixes: c82449352854 ("mm: compaction: make isolate_lru_page() filter-aware again")
    Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
    Acked-by: Minchan Kim <minchan@kernel.org>
    Cc: "Huang, Ying" <ying.huang@intel.com>
    Cc: Jan Kara <jack@suse.cz>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 97c79000d27d4d937357be46797b691f060ddd68
Author: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Date:   Wed Jan 31 16:17:43 2018 -0800

    asm-generic: provide generic_pmdp_establish()
    
    [ Upstream commit c58f0bb77ed8bf93dfdde762b01cb67eebbdfc29 ]
    
    Patch series "Do not lose dirty bit on THP pages", v4.
    
    Vlastimil noted that pmdp_invalidate() is not atomic and we can lose
    dirty and access bits if CPU sets them after pmdp dereference, but
    before set_pmd_at().
    
    The bug can lead to data loss, but the race window is tiny and I haven't
    seen any reports that suggested that it happens in reality.  So I don't
    think it worth sending it to stable.
    
    Unfortunately, there's no way to address the issue in a generic way.  We
    need to fix all architectures that support THP one-by-one.
    
    All architectures that have THP supported have to provide atomic
    pmdp_invalidate() that returns previous value.
    
    If generic implementation of pmdp_invalidate() is used, architecture
    needs to provide atomic pmdp_estabish().
    
    pmdp_estabish() is not used out-side generic implementation of
    pmdp_invalidate() so far, but I think this can change in the future.
    
    This patch (of 12):
    
    This is an implementation of pmdp_establish() that is only suitable for
    an architecture that doesn't have hardware dirty/accessed bits.  In this
    case we can't race with CPU which sets these bits and non-atomic
    approach is fine.
    
    Link: http://lkml.kernel.org/r/20171213105756.69879-2-kirill.shutemov@linux.intel.com
    Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Cc: Andrea Arcangeli <aarcange@redhat.com>
    Cc: Michal Hocko <mhocko@kernel.org>
    Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
    Cc: Catalin Marinas <catalin.marinas@arm.com>
    Cc: David Daney <david.daney@cavium.com>
    Cc: David Miller <davem@davemloft.net>
    Cc: H. Peter Anvin <hpa@zytor.com>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Ingo Molnar <mingo@kernel.org>
    Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
    Cc: Nitin Gupta <nitin.m.gupta@oracle.com>
    Cc: Ralf Baechle <ralf@linux-mips.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Vineet Gupta <vgupta@synopsys.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1a60f2ecb8ca9508ae634b2ade36c338ab1d298e
Author: Yisheng Xie <xieyisheng1@huawei.com>
Date:   Wed Jan 31 16:16:15 2018 -0800

    mm/mempolicy: add nodes_empty check in SYSC_migrate_pages
    
    [ Upstream commit 0486a38bcc4749808edbc848f1bcf232042770fc ]
    
    As in manpage of migrate_pages, the errno should be set to EINVAL when
    none of the node IDs specified by new_nodes are on-line and allowed by
    the process's current cpuset context, or none of the specified nodes
    contain memory.  However, when test by following case:
    
            new_nodes = 0;
            old_nodes = 0xf;
            ret = migrate_pages(pid, old_nodes, new_nodes, MAX);
    
    The ret will be 0 and no errno is set.  As the new_nodes is empty, we
    should expect EINVAL as documented.
    
    To fix the case like above, this patch check whether target nodes AND
    current task_nodes is empty, and then check whether AND
    node_states[N_MEMORY] is empty.
    
    Link: http://lkml.kernel.org/r/1510882624-44342-4-git-send-email-xieyisheng1@huawei.com
    Signed-off-by: Yisheng Xie <xieyisheng1@huawei.com>
    Acked-by: Vlastimil Babka <vbabka@suse.cz>
    Cc: Andi Kleen <ak@linux.intel.com>
    Cc: Chris Salls <salls@cs.ucsb.edu>
    Cc: Christopher Lameter <cl@linux.com>
    Cc: David Rientjes <rientjes@google.com>
    Cc: Ingo Molnar <mingo@kernel.org>
    Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
    Cc: Tan Xiaojun <tanxiaojun@huawei.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7f81272f69d72564374ee8348a3f624a8532c388
Author: Yisheng Xie <xieyisheng1@huawei.com>
Date:   Wed Jan 31 16:16:11 2018 -0800

    mm/mempolicy: fix the check of nodemask from user
    
    [ Upstream commit 56521e7a02b7b84a5e72691a1fb15570e6055545 ]
    
    As Xiaojun reported the ltp of migrate_pages01 will fail on arm64 system
    which has 4 nodes[0...3], all have memory and CONFIG_NODES_SHIFT=2:
    
      migrate_pages01    0  TINFO  :  test_invalid_nodes
      migrate_pages01   14  TFAIL  :  migrate_pages_common.c:45: unexpected failure - returned value = 0, expected: -1
      migrate_pages01   15  TFAIL  :  migrate_pages_common.c:55: call succeeded unexpectedly
    
    In this case the test_invalid_nodes of migrate_pages01 will call:
    SYSC_migrate_pages as:
    
      migrate_pages(0, , {0x0000000000000001}, 64, , {0x0000000000000010}, 64) = 0
    
    The new nodes specifies one or more node IDs that are greater than the
    maximum supported node ID, however, the errno is not set to EINVAL as
    expected.
    
    As man pages of set_mempolicy[1], mbind[2], and migrate_pages[3]
    mentioned, when nodemask specifies one or more node IDs that are greater
    than the maximum supported node ID, the errno should set to EINVAL.
    However, get_nodes only check whether the part of bits
    [BITS_PER_LONG*BITS_TO_LONGS(MAX_NUMNODES), maxnode) is zero or not, and
    remain [MAX_NUMNODES, BITS_PER_LONG*BITS_TO_LONGS(MAX_NUMNODES)
    unchecked.
    
    This patch is to check the bits of [MAX_NUMNODES, maxnode) in get_nodes
    to let migrate_pages set the errno to EINVAL when nodemask specifies one
    or more node IDs that are greater than the maximum supported node ID,
    which follows the manpage's guide.
    
    [1] http://man7.org/linux/man-pages/man2/set_mempolicy.2.html
    [2] http://man7.org/linux/man-pages/man2/mbind.2.html
    [3] http://man7.org/linux/man-pages/man2/migrate_pages.2.html
    
    Link: http://lkml.kernel.org/r/1510882624-44342-3-git-send-email-xieyisheng1@huawei.com
    Signed-off-by: Yisheng Xie <xieyisheng1@huawei.com>
    Reported-by: Tan Xiaojun <tanxiaojun@huawei.com>
    Acked-by: Vlastimil Babka <vbabka@suse.cz>
    Cc: Andi Kleen <ak@linux.intel.com>
    Cc: Chris Salls <salls@cs.ucsb.edu>
    Cc: Christopher Lameter <cl@linux.com>
    Cc: David Rientjes <rientjes@google.com>
    Cc: Ingo Molnar <mingo@kernel.org>
    Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 15ac59a84750b3afc0a2b6f2636c4f7e6cbd6d5e
Author: piaojun <piaojun@huawei.com>
Date:   Wed Jan 31 16:14:59 2018 -0800

    ocfs2/acl: use 'ip_xattr_sem' to protect getting extended attribute
    
    [ Upstream commit 16c8d569f5704a84164f30ff01b29879f3438065 ]
    
    The race between *set_acl and *get_acl will cause getting incomplete
    xattr data as below:
    
      processA                                    processB
    
      ocfs2_set_acl
        ocfs2_xattr_set
          __ocfs2_xattr_set_handle
    
                                                  ocfs2_get_acl_nolock
                                                    ocfs2_xattr_get_nolock:
    
    processB may get incomplete xattr data if processA hasn't set_acl done.
    
    So we should use 'ip_xattr_sem' to protect getting extended attribute in
    ocfs2_get_acl_nolock(), as other processes could be changing it
    concurrently.
    
    Link: http://lkml.kernel.org/r/5A5DDCFF.7030001@huawei.com
    Signed-off-by: Jun Piao <piaojun@huawei.com>
    Reviewed-by: Alex Chen <alex.chen@huawei.com>
    Cc: Mark Fasheh <mfasheh@versity.com>
    Cc: Joel Becker <jlbec@evilplan.org>
    Cc: Junxiao Bi <junxiao.bi@oracle.com>
    Cc: Joseph Qi <jiangqi903@gmail.com>
    Cc: Changwei Ge <ge.changwei@h3c.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2c09ffcb3d0025443d346bd8ef5a75f44e157dbd
Author: piaojun <piaojun@huawei.com>
Date:   Wed Jan 31 16:14:44 2018 -0800

    ocfs2: return -EROFS to mount.ocfs2 if inode block is invalid
    
    [ Upstream commit 025bcbde3634b2c9b316f227fed13ad6ad6817fb ]
    
    If metadata is corrupted such as 'invalid inode block', we will get
    failed by calling 'mount()' and then set filesystem readonly as below:
    
      ocfs2_mount
        ocfs2_initialize_super
          ocfs2_init_global_system_inodes
            ocfs2_iget
              ocfs2_read_locked_inode
                ocfs2_validate_inode_block
                  ocfs2_error
                    ocfs2_handle_error
                      ocfs2_set_ro_flag(osb, 0);  // set readonly
    
    In this situation we need return -EROFS to 'mount.ocfs2', so that user
    can fix it by fsck.  And then mount again.  In addition, 'mount.ocfs2'
    should be updated correspondingly as it only return 1 for all errno.
    And I will post a patch for 'mount.ocfs2' too.
    
    Link: http://lkml.kernel.org/r/5A4302FA.2010606@huawei.com
    Signed-off-by: Jun Piao <piaojun@huawei.com>
    Reviewed-by: Alex Chen <alex.chen@huawei.com>
    Reviewed-by: Joseph Qi <jiangqi903@gmail.com>
    Reviewed-by: Changwei Ge <ge.changwei@h3c.com>
    Reviewed-by: Gang He <ghe@suse.com>
    Cc: Mark Fasheh <mfasheh@versity.com>
    Cc: Joel Becker <jlbec@evilplan.org>
    Cc: Junxiao Bi <junxiao.bi@oracle.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3de8b7dae45e065d70cba014e4d8c288db9beb55
Author: Leon Romanovsky <leonro@mellanox.com>
Date:   Sun Jan 28 11:25:30 2018 +0200

    RDMA/mlx5: Avoid memory leak in case of XRCD dealloc failure
    
    [ Upstream commit b081808a66345ba725b77ecd8d759bee874cd937 ]
    
    Failure in XRCD FW deallocation command leaves memory leaked and
    returns error to the user which he can't do anything about it.
    
    This patch changes behavior to always free memory and always return
    success to the user.
    
    Fixes: e126ba97dba9 ("mlx5: Add driver for Mellanox Connect-IB adapters")
    Reviewed-by: Majd Dibbiny <majd@mellanox.com>
    Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
    Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>
    Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 42c43e351272ce7f2bfe811c19b6b555a5a37bee
Author: Jake Daryll Obina <jake.obina@gmail.com>
Date:   Fri Sep 22 00:00:14 2017 +0800

    jffs2: Fix use-after-free bug in jffs2_iget()'s error handling path
    
    [ Upstream commit 5bdd0c6f89fba430e18d636493398389dadc3b17 ]
    
    If jffs2_iget() fails for a newly-allocated inode, jffs2_do_clear_inode()
    can get called twice in the error handling path, the first call in
    jffs2_iget() itself and the second through iget_failed(). This can result
    to a use-after-free error in the second jffs2_do_clear_inode() call, such
    as shown by the oops below wherein the second jffs2_do_clear_inode() call
    was trying to free node fragments that were already freed in the first
    jffs2_do_clear_inode() call.
    
    [   78.178860] jffs2: error: (1904) jffs2_do_read_inode_internal: CRC failed for read_inode of inode 24 at physical location 0x1fc00c
    [   78.178914] Unable to handle kernel paging request at virtual address 6b6b6b6b6b6b6b7b
    [   78.185871] pgd = ffffffc03a567000
    [   78.188794] [6b6b6b6b6b6b6b7b] *pgd=0000000000000000, *pud=0000000000000000
    [   78.194968] Internal error: Oops: 96000004 [#1] PREEMPT SMP
    ...
    [   78.513147] PC is at rb_first_postorder+0xc/0x28
    [   78.516503] LR is at jffs2_kill_fragtree+0x28/0x90 [jffs2]
    [   78.520672] pc : [<ffffff8008323d28>] lr : [<ffffff8000eb1cc8>] pstate: 60000105
    [   78.526757] sp : ffffff800cea38f0
    [   78.528753] x29: ffffff800cea38f0 x28: ffffffc01f3f8e80
    [   78.532754] x27: 0000000000000000 x26: ffffff800cea3c70
    [   78.536756] x25: 00000000dc67c8ae x24: ffffffc033d6945d
    [   78.540759] x23: ffffffc036811740 x22: ffffff800891a5b8
    [   78.544760] x21: 0000000000000000 x20: 0000000000000000
    [   78.548762] x19: ffffffc037d48910 x18: ffffff800891a588
    [   78.552764] x17: 0000000000000800 x16: 0000000000000c00
    [   78.556766] x15: 0000000000000010 x14: 6f2065646f6e695f
    [   78.560767] x13: 6461657220726f66 x12: 2064656c69616620
    [   78.564769] x11: 435243203a6c616e x10: 7265746e695f6564
    [   78.568771] x9 : 6f6e695f64616572 x8 : ffffffc037974038
    [   78.572774] x7 : bbbbbbbbbbbbbbbb x6 : 0000000000000008
    [   78.576775] x5 : 002f91d85bd44a2f x4 : 0000000000000000
    [   78.580777] x3 : 0000000000000000 x2 : 000000403755e000
    [   78.584779] x1 : 6b6b6b6b6b6b6b6b x0 : 6b6b6b6b6b6b6b6b
    ...
    [   79.038551] [<ffffff8008323d28>] rb_first_postorder+0xc/0x28
    [   79.042962] [<ffffff8000eb5578>] jffs2_do_clear_inode+0x88/0x100 [jffs2]
    [   79.048395] [<ffffff8000eb9ddc>] jffs2_evict_inode+0x3c/0x48 [jffs2]
    [   79.053443] [<ffffff8008201ca8>] evict+0xb0/0x168
    [   79.056835] [<ffffff8008202650>] iput+0x1c0/0x200
    [   79.060228] [<ffffff800820408c>] iget_failed+0x30/0x3c
    [   79.064097] [<ffffff8000eba0c0>] jffs2_iget+0x2d8/0x360 [jffs2]
    [   79.068740] [<ffffff8000eb0a60>] jffs2_lookup+0xe8/0x130 [jffs2]
    [   79.073434] [<ffffff80081f1a28>] lookup_slow+0x118/0x190
    [   79.077435] [<ffffff80081f4708>] walk_component+0xfc/0x28c
    [   79.081610] [<ffffff80081f4dd0>] path_lookupat+0x84/0x108
    [   79.085699] [<ffffff80081f5578>] filename_lookup+0x88/0x100
    [   79.089960] [<ffffff80081f572c>] user_path_at_empty+0x58/0x6c
    [   79.094396] [<ffffff80081ebe14>] vfs_statx+0xa4/0x114
    [   79.098138] [<ffffff80081ec44c>] SyS_newfstatat+0x58/0x98
    [   79.102227] [<ffffff800808354c>] __sys_trace_return+0x0/0x4
    [   79.106489] Code: d65f03c0 f9400001 b40000e1 aa0103e0 (f9400821)
    
    The jffs2_do_clear_inode() call in jffs2_iget() is unnecessary since
    iget_failed() will eventually call jffs2_do_clear_inode() if needed, so
    just remove it.
    
    Fixes: 5451f79f5f81 ("iget: stop JFFS2 from using iget() and read_inode()")
    Reviewed-by: Richard Weinberger <richard@nod.at>
    Signed-off-by: Jake Daryll Obina <jake.obina@gmail.com>
    Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit eb8c17a260118af4c45d5697d7c8c4477477edb5
Author: Dan Carpenter <dan.carpenter@oracle.com>
Date:   Wed Jan 10 12:39:03 2018 +0300

    HID: roccat: prevent an out of bounds read in kovaplus_profile_activated()
    
    [ Upstream commit 7ad81482cad67cbe1ec808490d1ddfc420c42008 ]
    
    We get the "new_profile_index" value from the mouse device when we're
    handling raw events.  Smatch taints it as untrusted data and complains
    that we need a bounds check.  This seems like a reasonable warning
    otherwise there is a small read beyond the end of the array.
    
    Fixes: 0e70f97f257e ("HID: roccat: Add support for Kova[+] mouse")
    Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
    Acked-by: Silvan Jegen <s.jegen@gmail.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 92bd116c71159727ce26363d5951447437d1d73a
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Thu Jan 18 14:16:38 2018 +0100

    scsi: fas216: fix sense buffer initialization
    
    [ Upstream commit 96d5eaa9bb74d299508d811d865c2c41b38b0301 ]
    
    While testing with the ARM specific memset() macro removed, I ran into a
    compiler warning that shows an old bug:
    
    drivers/scsi/arm/fas216.c: In function 'fas216_rq_sns_done':
    drivers/scsi/arm/fas216.c:2014:40: error: argument to 'sizeof' in 'memset' call is the same expression as the destination; did you mean to provide an explicit length? [-Werror=sizeof-pointer-memaccess]
    
    It turns out that the definition of the scsi_cmd structure changed back
    in linux-2.6.25, so now we clear only four bytes (sizeof(pointer))
    instead of 96 (SCSI_SENSE_BUFFERSIZE). I did not check whether we
    actually need to initialize the buffer here, but it's clear that if we
    do it, we should use the correct size.
    
    Fixes: de25deb18016 ("[SCSI] use dynamically allocated sense buffer")
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f1becd4a6fd5223df0acf335e0588a0a8b7df748
Author: Nikolay Borisov <nborisov@suse.com>
Date:   Tue Dec 12 11:14:49 2017 +0200

    btrfs: Fix out of bounds access in btrfs_search_slot
    
    [ Upstream commit 9ea2c7c9da13c9073e371c046cbbc45481ecb459 ]
    
    When modifying a tree where the root is at BTRFS_MAX_LEVEL - 1 then
    the level variable is going to be 7 (this is the max height of the
    tree). On the other hand btrfs_cow_block is always called with
    "level + 1" as an index into the nodes and slots arrays. This leads to
    an out of bounds access. Admittdely this will be benign since an OOB
    access of the nodes array will likely read the 0th element from the
    slots array, which in this case is going to be 0 (since we start CoW at
    the top of the tree). The OOB access into the slots array in turn will
    read the 0th and 1st values of the locks array, which would both be 0
    at the time. However, this benign behavior relies on the fact that the
    path being passed hasn't been initialised, if it has already been used to
    query a btree then it could potentially have populated the nodes/slots arrays.
    
    Fix it by explicitly checking if we are at level 7 (the maximum allowed
    index in nodes/slots arrays) and explicitly call the CoW routine with
    NULL for parent's node/slot.
    
    Signed-off-by: Nikolay Borisov <nborisov@suse.com>
    Fixes-coverity-id: 711515
    Reviewed-by: David Sterba <dsterba@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 81efefe2b5fec9937cc0e3c9d718cfdbb6195d65
Author: Ulf Magnusson <ulfalizer@gmail.com>
Date:   Sun Oct 8 19:35:45 2017 +0200

    kconfig: Fix expr_free() E_NOT leak
    
    [ Upstream commit 5b1374b3b3c2fc4f63a398adfa446fb8eff791a4 ]
    
    Only the E_NOT operand and not the E_NOT node itself was freed, due to
    accidentally returning too early in expr_free(). Outline of leak:
    
            switch (e->type) {
            ...
            case E_NOT:
                    expr_free(e->left.expr);
                    return;
            ...
            }
            *Never reached, 'e' leaked*
            free(e);
    
    Fix by changing the 'return' to a 'break'.
    
    Summary from Valgrind on 'menuconfig' (ARCH=x86) before the fix:
    
            LEAK SUMMARY:
               definitely lost: 44,448 bytes in 1,852 blocks
               ...
    
    Summary after the fix:
    
            LEAK SUMMARY:
               definitely lost: 1,608 bytes in 67 blocks
               ...
    
    Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
    Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 219badd36abe659d6903a88ed508f48b7e35ffb5
Author: Ulf Magnusson <ulfalizer@gmail.com>
Date:   Sun Oct 8 19:35:44 2017 +0200

    kconfig: Fix automatic menu creation mem leak
    
    [ Upstream commit ae7440ef0c8013d68c00dad6900e7cce5311bb1c ]
    
    expr_trans_compare() always allocates and returns a new expression,
    giving the following leak outline:
    
            ...
            *Allocate*
            basedep = expr_trans_compare(basedep, E_UNEQUAL, &symbol_no);
            ...
            for (menu = parent->next; menu; menu = menu->next) {
                    ...
                    *Copy*
                    dep2 = expr_copy(basedep);
                    ...
                    *Free copy*
                    expr_free(dep2);
            }
            *basedep lost!*
    
    Fix by freeing 'basedep' after the loop.
    
    Summary from Valgrind on 'menuconfig' (ARCH=x86) before the fix:
    
            LEAK SUMMARY:
               definitely lost: 344,376 bytes in 14,349 blocks
               ...
    
    Summary after the fix:
    
            LEAK SUMMARY:
               definitely lost: 44,448 bytes in 1,852 blocks
               ...
    
    Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
    Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 02d458948dcf25e99eb8e40e7e05d56fa38c5dfd
Author: Ulf Magnusson <ulfalizer@gmail.com>
Date:   Sun Oct 8 19:11:21 2017 +0200

    kconfig: Don't leak main menus during parsing
    
    [ Upstream commit 0724a7c32a54e3e50d28e19e30c59014f61d4e2c ]
    
    If a 'mainmenu' entry appeared in the Kconfig files, two things would
    leak:
    
            - The 'struct property' allocated for the default "Linux Kernel
              Configuration" prompt.
    
            - The string for the T_WORD/T_WORD_QUOTE prompt after the
              T_MAINMENU token, allocated on the heap in zconf.l.
    
    To fix it, introduce a new 'no_mainmenu_stmt' nonterminal that matches
    if there's no 'mainmenu' and adds the default prompt. That means the
    prompt only gets allocated once regardless of whether there's a
    'mainmenu' statement or not, and managing it becomes simple.
    
    Summary from Valgrind on 'menuconfig' (ARCH=x86) before the fix:
    
            LEAK SUMMARY:
               definitely lost: 344,568 bytes in 14,352 blocks
               ...
    
    Summary after the fix:
    
            LEAK SUMMARY:
               definitely lost: 344,440 bytes in 14,350 blocks
               ...
    
    Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
    Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b107e54a1c829cc3b182d785104cdb284ae0f9b1
Author: Guenter Roeck <linux@roeck-us.net>
Date:   Sun Dec 24 13:04:07 2017 -0800

    watchdog: sp5100_tco: Fix watchdog disable bit
    
    [ Upstream commit f541c09ebfc61697b586b38c9ebaf4b70defb278 ]
    
    According to all published information, the watchdog disable bit for SB800
    compatible controllers is bit 1 of PM register 0x48, not bit 2. For the
    most part that doesn't matter in practice, since the bit has to be cleared
    to enable watchdog address decoding, which is the default setting, but it
    still needs to be fixed.
    
    Cc: Zoltán Böszörményi <zboszor@pr.hu>
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit da6f78a888752b88d16e62d64014d0425ee8b840
Author: Jan Chochol <jan@chochol.info>
Date:   Fri Jan 5 08:39:12 2018 +0100

    nfs: Do not convert nfs_idmap_cache_timeout to jiffies
    
    [ Upstream commit cbebc6ef4fc830f4040d4140bf53484812d5d5d9 ]
    
    Since commit 57e62324e469 ("NFS: Store the legacy idmapper result in the
    keyring") nfs_idmap_cache_timeout changed units from jiffies to seconds.
    Unfortunately sysctl interface was not updated accordingly.
    
    As a effect updating /proc/sys/fs/nfs/idmap_cache_timeout with some
    value will incorrectly multiply this value by HZ.
    Also reading /proc/sys/fs/nfs/idmap_cache_timeout will show real value
    divided by HZ.
    
    Fixes: 57e62324e469 ("NFS: Store the legacy idmapper result in the keyring")
    Signed-off-by: Jan Chochol <jan@chochol.info>
    Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit db21a7b1383cd41d5ea28f7ad131b6120c8a01a1
Author: mulhern <amulhern@redhat.com>
Date:   Mon Nov 27 10:02:39 2017 -0500

    dm thin: fix documentation relative to low water mark threshold
    
    [ Upstream commit 9b28a1102efc75d81298198166ead87d643a29ce ]
    
    Fixes:
    1. The use of "exceeds" when the opposite of exceeds, falls below,
    was meant.
    2. Properly speaking, a table can not exceed a threshold.
    
    It emphasizes the important point, which is that it is the userspace
    daemon's responsibility to check for low free space when a device
    is resumed, since it won't get a special event indicating low free
    space in that situation.
    
    Signed-off-by: mulhern <amulhern@redhat.com>
    Signed-off-by: Mike Snitzer <snitzer@redhat.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 19a4ddc5e909e8d2e6a82e9d4d7fd66c2a0898a1
Author: Steven Rostedt (VMware) <rostedt@goodmis.org>
Date:   Thu Jan 11 19:47:51 2018 -0500

    tools lib traceevent: Fix get_field_str() for dynamic strings
    
    [ Upstream commit d777f8de99b05d399c0e4e51cdce016f26bd971b ]
    
    If a field is a dynamic string, get_field_str() returned just the
    offset/size value and not the string. Have it parse the offset/size
    correctly to return the actual string. Otherwise filtering fails when
    trying to filter fields that are dynamic strings.
    
    Reported-by: Gopanapalli Pradeep <prap_hai@yahoo.com>
    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
    Acked-by: Namhyung Kim <namhyung@kernel.org>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Link: http://lkml.kernel.org/r/20180112004823.146333275@goodmis.org
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0806f6eff0ee2e9d31a52ed6345a21bfef0cf2d8
Author: Alex Williamson <alex.williamson@redhat.com>
Date:   Tue Jan 16 10:05:26 2018 -0700

    PCI: Add function 1 DMA alias quirk for Marvell 9128
    
    [ Upstream commit aa008206634363ef800fbd5f0262016c9ff81dea ]
    
    The Marvell 9128 is the original device generating bug 42679, from which
    many other Marvell DMA alias quirks have been sourced, but we didn't have
    positive confirmation of the fix on 9128 until now.
    
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=42679
    Link: https://www.spinics.net/lists/kvm/msg161459.html
    Reported-by: Binarus <lists@binarus.de>
    Tested-by: Binarus <lists@binarus.de>
    Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ec8e8efa397d3373a75b7384937e06c2c379190c
Author: Anna-Maria Gleixner <anna-maria@linutronix.de>
Date:   Thu Dec 21 11:41:37 2017 +0100

    tracing/hrtimer: Fix tracing bugs by taking all clock bases and modes into account
    
    [ Upstream commit 91633eed73a3ac37aaece5c8c1f93a18bae616a9 ]
    
    So far only CLOCK_MONOTONIC and CLOCK_REALTIME were taken into account as
    well as HRTIMER_MODE_ABS/REL in the hrtimer_init tracepoint. The query for
    detecting the ABS or REL timer modes is not valid anymore, it got broken
    by the introduction of HRTIMER_MODE_PINNED.
    
    HRTIMER_MODE_PINNED is not evaluated in the hrtimer_init() call, but for the
    sake of completeness print all given modes.
    
    Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
    Cc: Christoph Hellwig <hch@lst.de>
    Cc: John Stultz <john.stultz@linaro.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: keescook@chromium.org
    Link: http://lkml.kernel.org/r/20171221104205.7269-9-anna-maria@linutronix.de
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 682c26722c27c87e3ab8343026572f607600420f
Author: Paolo Bonzini <pbonzini@redhat.com>
Date:   Thu Oct 26 15:45:47 2017 +0200

    kvm: x86: fix KVM_XEN_HVM_CONFIG ioctl
    
    [ Upstream commit 51776043afa415435c7e4636204fbe4f7edc4501 ]
    
    This ioctl is obsolete (it was used by Xenner as far as I know) but
    still let's not break it gratuitously...  Its handler is copying
    directly into struct kvm.  Go through a bounce buffer instead, with
    the added benefit that we can actually do something useful with the
    flags argument---the previous code was exiting with -EINVAL but still
    doing the copy.
    
    This technically is a userspace ABI breakage, but since no one should be
    using the ioctl, it's a good occasion to see if someone actually
    complains.
    
    Cc: kernel-hardening@lists.openwall.com
    Cc: Kees Cook <keescook@chromium.org>
    Cc: Radim Krčmář <rkrcmar@redhat.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Kees Cook <keescook@chromium.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3e622a5e0df812edc2fe9367f03cf897b355eef7
Author: Dan Carpenter <dan.carpenter@oracle.com>
Date:   Mon Jan 15 11:08:38 2018 +0300

    ASoC: au1x: Fix timeout tests in au1xac97c_ac97_read()
    
    [ Upstream commit 123af9043e93cb6f235207d260d50f832cdb5439 ]
    
    The loop timeout doesn't work because it's a post op and ends with "tmo"
    set to -1.  I changed it from a post-op to a pre-op and I changed the
    initial the starting value from 5 to 6 so we still iterate 5 times.  I
    left the other as it was because it's a large number.
    
    Fixes: b3c70c9ea62a ("ASoC: Alchemy AC97C/I2SC audio support")
    Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a56126d94d4c7962ad2244a5002a4af63fb734f4
Author: Hector Martin <marcan@marcan.st>
Date:   Fri Nov 3 20:28:57 2017 +0900

    firewire-ohci: work around oversized DMA reads on JMicron controllers
    
    [ Upstream commit 188775181bc05f29372b305ef96485840e351fde ]
    
    At least some JMicron controllers issue buggy oversized DMA reads when
    fetching context descriptors, always fetching 0x20 bytes at once for
    descriptors which are only 0x10 bytes long. This is often harmless, but
    can cause page faults on modern systems with IOMMUs:
    
    DMAR: [DMA Read] Request device [05:00.0] fault addr fff56000 [fault reason 06] PTE Read access is not set
    firewire_ohci 0000:05:00.0: DMA context IT0 has stopped, error code: evt_descriptor_read
    
    This works around the problem by always leaving 0x10 padding bytes at
    the end of descriptor buffer pages, which should be harmless to do
    unconditionally for controllers in case others have the same behavior.
    
    Signed-off-by: Hector Martin <marcan@marcan.st>
    Reviewed-by: Clemens Ladisch <clemens@ladisch.de>
    Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 50ecbf90142cbfc7cc0194d4f71cf9673e03ab33
Author: zhongjiang <zhongjiang@huawei.com>
Date:   Mon Jul 10 15:52:57 2017 -0700

    kernel/signal.c: avoid undefined behaviour in kill_something_info
    
    commit 4ea77014af0d6205b05503d1c7aac6eace11d473 upstream.
    
    When running kill(72057458746458112, 0) in userspace I hit the following
    issue.
    
      UBSAN: Undefined behaviour in kernel/signal.c:1462:11
      negation of -2147483648 cannot be represented in type 'int':
      CPU: 226 PID: 9849 Comm: test Tainted: G    B          ---- -------   3.10.0-327.53.58.70.x86_64_ubsan+ #116
      Hardware name: Huawei Technologies Co., Ltd. RH8100 V3/BC61PBIA, BIOS BLHSV028 11/11/2014
      Call Trace:
        dump_stack+0x19/0x1b
        ubsan_epilogue+0xd/0x50
        __ubsan_handle_negate_overflow+0x109/0x14e
        SYSC_kill+0x43e/0x4d0
        SyS_kill+0xe/0x10
        system_call_fastpath+0x16/0x1b
    
    Add code to avoid the UBSAN detection.
    
    [akpm@linux-foundation.org: tweak comment]
    Link: http://lkml.kernel.org/r/1496670008-59084-1-git-send-email-zhongjiang@huawei.com
    Signed-off-by: zhongjiang <zhongjiang@huawei.com>
    Cc: Oleg Nesterov <oleg@redhat.com>
    Cc: Michal Hocko <mhocko@kernel.org>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Cc: Xishi Qiu <qiuxishi@huawei.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit bbab099bb86bb3ae9acd316879fa27647bdb4dab
Author: Joe Jin <joe.jin@oracle.com>
Date:   Thu May 17 12:33:28 2018 -0700

    xen-swiotlb: fix the check condition for xen_swiotlb_free_coherent
    
    commit 4855c92dbb7b3b85c23e88ab7ca04f99b9677b41 upstream.
    
    When run raidconfig from Dom0 we found that the Xen DMA heap is reduced,
    but Dom Heap is increased by the same size. Tracing raidconfig we found
    that the related ioctl() in megaraid_sas will call dma_alloc_coherent()
    to apply memory. If the memory allocated by Dom0 is not in the DMA area,
    it will exchange memory with Xen to meet the requiment. Later drivers
    call dma_free_coherent() to free the memory, on xen_swiotlb_free_coherent()
    the check condition (dev_addr + size - 1 <= dma_mask) is always false,
    it prevents calling xen_destroy_contiguous_region() to return the memory
    to the Xen DMA heap.
    
    This issue introduced by commit 6810df88dcfc2 "xen-swiotlb: When doing
    coherent alloc/dealloc check before swizzling the MFNs.".
    
    Signed-off-by: Joe Jin <joe.jin@oracle.com>
    Tested-by: John Sobecki <john.sobecki@oracle.com>
    Reviewed-by: Rzeszutek Wilk <konrad.wilk@oracle.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit db660dc8382a55c958275dcc9f125b7f4ec13818
Author: Tejun Heo <tj@kernel.org>
Date:   Tue May 8 14:21:56 2018 -0700

    libata: Blacklist some Sandisk SSDs for NCQ
    
    commit 322579dcc865b94b47345ad1b6002ad167f85405 upstream.
    
    Sandisk SSDs SD7SN6S256G and SD8SN8U256G are regularly locking up
    regularly under sustained moderate load with NCQ enabled.  Blacklist
    for now.
    
    Signed-off-by: Tejun Heo <tj@kernel.org>
    Reported-by: Dave Jones <davej@codemonkey.org.uk>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b90b64116b1136c9c965e019283daf6100a6d1ac
Author: Al Viro <viro@zeniv.linux.org.uk>
Date:   Fri May 4 08:23:01 2018 -0400

    do d_instantiate/unlock_new_inode combinations safely
    
    commit 1e2e547a93a00ebc21582c06ca3c6cfea2a309ee upstream.
    
    For anything NFS-exported we do _not_ want to unlock new inode
    before it has grown an alias; original set of fixes got the
    ordering right, but missed the nasty complication in case of
    lockdep being enabled - unlock_new_inode() does
            lockdep_annotate_inode_mutex_key(inode)
    which can only be done before anyone gets a chance to touch
    ->i_mutex.  Unfortunately, flipping the order and doing
    unlock_new_inode() before d_instantiate() opens a window when
    mkdir can race with open-by-fhandle on a guessed fhandle, leading
    to multiple aliases for a directory inode and all the breakage
    that follows from that.
    
            Correct solution: a new primitive (d_instantiate_new())
    combining these two in the right order - lockdep annotate, then
    d_instantiate(), then the rest of unlock_new_inode().  All
    combinations of d_instantiate() with unlock_new_inode() should
    be converted to that.
    
    Cc: stable@kernel.org   # 2.6.29 and later
    Tested-by: Mike Marshall <hubcap@omnibond.com>
    Reviewed-by: Andreas Dilger <adilger@dilger.ca>
    Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit fac7c7ecdec9bd1fbe18ae30f9026e301666c7a7
Author: Al Viro <viro@zeniv.linux.org.uk>
Date:   Sun May 20 16:46:23 2018 -0400

    aio: fix io_destroy(2) vs. lookup_ioctx() race
    
    commit baf10564fbb66ea222cae66fbff11c444590ffd9 upstream.
    
    kill_ioctx() used to have an explicit RCU delay between removing the
    reference from ->ioctx_table and percpu_ref_kill() dropping the refcount.
    At some point that delay had been removed, on the theory that
    percpu_ref_kill() itself contained an RCU delay.  Unfortunately, that was
    the wrong kind of RCU delay and it didn't care about rcu_read_lock() used
    by lookup_ioctx().  As the result, we could get ctx freed right under
    lookup_ioctx().  Tejun has fixed that in a6d7cff472e ("fs/aio: Add explicit
    RCU grace period when freeing kioctx"); however, that fix is not enough.
    
    Suppose io_destroy() from one thread races with e.g. io_setup() from another;
    CPU1 removes the reference from current->mm->ioctx_table[...] just as CPU2
    has picked it (under rcu_read_lock()).  Then CPU1 proceeds to drop the
    refcount, getting it to 0 and triggering a call of free_ioctx_users(),
    which proceeds to drop the secondary refcount and once that reaches zero
    calls free_ioctx_reqs().  That does
            INIT_RCU_WORK(&ctx->free_rwork, free_ioctx);
            queue_rcu_work(system_wq, &ctx->free_rwork);
    and schedules freeing the whole thing after RCU delay.
    
    In the meanwhile CPU2 has gotten around to percpu_ref_get(), bumping the
    refcount from 0 to 1 and returned the reference to io_setup().
    
    Tejun's fix (that queue_rcu_work() in there) guarantees that ctx won't get
    freed until after percpu_ref_get().  Sure, we'd increment the counter before
    ctx can be freed.  Now we are out of rcu_read_lock() and there's nothing to
    stop freeing of the whole thing.  Unfortunately, CPU2 assumes that since it
    has grabbed the reference, ctx is *NOT* going away until it gets around to
    dropping that reference.
    
    The fix is obvious - use percpu_ref_tryget_live() and treat failure as miss.
    It's not costlier than what we currently do in normal case, it's safe to
    call since freeing *is* delayed and it closes the race window - either
    lookup_ioctx() comes before percpu_ref_kill() (in which case ctx->users
    won't reach 0 until the caller of lookup_ioctx() drops it) or lookup_ioctx()
    fails, ctx->users is unaffected and caller of lookup_ioctx() doesn't see
    the object in question at all.
    
    Cc: stable@kernel.org
    Fixes: a6d7cff472e "fs/aio: Add explicit RCU grace period when freeing kioctx"
    Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6d292165c2d9f6db6177cf6b97e578f372c4ecaf
Author: Al Viro <viro@zeniv.linux.org.uk>
Date:   Sun May 6 12:15:20 2018 -0400

    affs_lookup(): close a race with affs_remove_link()
    
    commit 30da870ce4a4e007c901858a96e9e394a1daa74a upstream.
    
    we unlock the directory hash too early - if we are looking at secondary
    link and primary (in another directory) gets removed just as we unlock,
    we could have the old primary moved in place of the secondary, leaving
    us to look into freed entry (and leaving our dentry with ->d_fsdata
    pointing to a freed entry).
    
    Cc: stable@vger.kernel.org # 2.4.4+
    Acked-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f69c8ff5746086ea69628c9379c3fe76fab477e2
Author: Colin Ian King <colin.king@canonical.com>
Date:   Mon May 14 18:23:50 2018 +0100

    KVM: Fix spelling mistake: "cop_unsuable" -> "cop_unusable"
    
    commit ba3696e94d9d590d9a7e55f68e81c25dba515191 upstream.
    
    Trivial fix to spelling mistake in debugfs_entries text.
    
    Fixes: 669e846e6c4e ("KVM/MIPS32: MIPS arch specific APIs for KVM")
    Signed-off-by: Colin Ian King <colin.king@canonical.com>
    Cc: Ralf Baechle <ralf@linux-mips.org>
    Cc: linux-mips@linux-mips.org
    Cc: kernel-janitors@vger.kernel.org
    Cc: <stable@vger.kernel.org> # 3.10+
    Signed-off-by: James Hogan <jhogan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5a19b376c190623e0c32207a50d255a208726790
Author: Maciej W. Rozycki <macro@mips.com>
Date:   Mon May 14 16:49:43 2018 +0100

    MIPS: Fix ptrace(2) PTRACE_PEEKUSR and PTRACE_POKEUSR accesses to o32 FGRs
    
    commit 9a3a92ccfe3620743d4ae57c987dc8e9c5f88996 upstream.
    
    Check the TIF_32BIT_FPREGS task setting of the tracee rather than the
    tracer in determining the layout of floating-point general registers in
    the floating-point context, correcting access to odd-numbered registers
    for o32 tracees where the setting disagrees between the two processes.
    
    Fixes: 597ce1723e0f ("MIPS: Support for 64-bit FP with O32 binaries")
    Signed-off-by: Maciej W. Rozycki <macro@mips.com>
    Cc: Ralf Baechle <ralf@linux-mips.org>
    Cc: linux-mips@linux-mips.org
    Cc: <stable@vger.kernel.org> # 3.14+
    Signed-off-by: James Hogan <jhogan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0c5878302740ab783e7eebaa6b71223c8965a40b
Author: Maciej W. Rozycki <macro@mips.com>
Date:   Mon Apr 30 15:56:47 2018 +0100

    MIPS: ptrace: Expose FIR register through FP regset
    
    commit 71e909c0cdad28a1df1fa14442929e68615dee45 upstream.
    
    Correct commit 7aeb753b5353 ("MIPS: Implement task_user_regset_view.")
    and expose the FIR register using the unused 4 bytes at the end of the
    NT_PRFPREG regset.  Without that register included clients cannot use
    the PTRACE_GETREGSET request to retrieve the complete FPU register set
    and have to resort to one of the older interfaces, either PTRACE_PEEKUSR
    or PTRACE_GETFPREGS, to retrieve the missing piece of data.  Also the
    register is irreversibly missing from core dumps.
    
    This register is architecturally hardwired and read-only so the write
    path does not matter.  Ignore data supplied on writes then.
    
    Fixes: 7aeb753b5353 ("MIPS: Implement task_user_regset_view.")
    Signed-off-by: James Hogan <jhogan@kernel.org>
    Signed-off-by: Maciej W. Rozycki <macro@mips.com>
    Cc: Ralf Baechle <ralf@linux-mips.org>
    Cc: linux-mips@linux-mips.org
    Cc: <stable@vger.kernel.org> # 3.13+
    Patchwork: https://patchwork.linux-mips.org/patch/19273/
    Signed-off-by: James Hogan <jhogan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>