10 Oct, 2018

36 commits

  • [ Upstream commit 6c18b27d6e5c6a7206364eae2b47bc8d8b2fa68f ]

    If the driver fails to properly prepare for the channel
    switch, mac80211 will disconnect. If the CSA IE had mode
    set to 1, it means that the clients are not allowed to send
    any Tx on the current channel, and that includes the
    deauthentication frame.

    Make sure that we don't send the deauthentication frame in
    this case.

    In iwlwifi, this caused a failure to flush queues since the
    firmware already closed the queues after having parsed the
    CSA IE. Then mac80211 would wait until the deauthentication
    frame would go out (drv_flush(drop=false)) and that would
    never happen.

    Signed-off-by: Emmanuel Grumbach
    Signed-off-by: Luca Coelho
    Signed-off-by: Johannes Berg
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Emmanuel Grumbach
     
  • [ Upstream commit 0007e94355fdb71a1cf5dba0754155cba08f0666 ]

    When performing a channel switch flow for a managed interface, the
    flow did not update the bandwidth of the AP station and the rate
    scale algorithm. In case of a channel width downgrade, this would
    result with the rate scale algorithm using a bandwidth that does not
    match the interface channel configuration.

    Fix this by updating the AP station bandwidth and rate scaling algorithm
    before the actual channel change in case of a bandwidth downgrade, or
    after the actual channel change in case of a bandwidth upgrade.

    Signed-off-by: Ilan Peer
    Signed-off-by: Luca Coelho
    Signed-off-by: Johannes Berg
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Ilan Peer
     
  • [ Upstream commit f3ffb6c3a28963657eb8b02a795d75f2ebbd5ef4 ]

    We hit a problem with iwlwifi that was caused by a bug in
    mac80211. A bug in iwlwifi caused the firwmare to crash in
    certain cases in channel switch. Because of that bug,
    drv_pre_channel_switch would fail and trigger the restart
    flow.
    Now we had the hw restart worker which runs on the system's
    workqueue and the csa_connection_drop_work worker that runs
    on mac80211's workqueue that can run together. This is
    obviously problematic since the restart work wants to
    reconfigure the connection, while the csa_connection_drop_work
    worker does the exact opposite: it tries to disconnect.

    Fix this by cancelling the csa_connection_drop_work worker
    in the restart worker.

    Note that this can sound racy: we could have:

    driver iface_work CSA_work restart_work
    +++++++++++++++++++++++++++++++++++++++++++++
    |

    -CS FAILED-->
    | |
    | cancel_work(CSA)
    schedule |
    CSA work |
    | |
    Race between those 2

    But this is not possible because we flush the workqueue
    in the restart worker before we cancel the CSA worker.
    That would be bullet proof if we could guarantee that
    we schedule the CSA worker only from the iface_work
    which runs on the workqueue (and not on the system's
    workqueue), but unfortunately we do have an instance
    in which we schedule the CSA work outside the context
    of the workqueue (ieee80211_chswitch_done).

    Note also that we should probably cancel other workers
    like beacon_connection_loss_work and possibly others
    for different types of interfaces, at the very least,
    IBSS should suffer from the exact same problem, but for
    now, do the minimum to fix the actual bug that was actually
    experienced and reproduced.

    Signed-off-by: Emmanuel Grumbach
    Signed-off-by: Luca Coelho
    Signed-off-by: Johannes Berg
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Emmanuel Grumbach
     
  • [ Upstream commit 8442938c3a2177ba16043b3a935f2c78266ad399 ]

    The "chandef->center_freq1" variable is a u32 but "freq" is a u16 so we
    are truncating away the high bits. I noticed this bug because in commit
    9cf0a0b4b64a ("cfg80211: Add support for 60GHz band channels 5 and 6")
    we made "freq
    Signed-off-by: Johannes Berg
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Dan Carpenter
     
  • [ Upstream commit 66eb02d839e8495ae6b612e2d09ff599374b80e2 ]

    Initialize 'n' to 2 in order to take into account also the first
    packet in the estimation of max_subframe limit for a given A-MSDU
    since frag_tail pointer is NULL when ieee80211_amsdu_aggregate
    routine analyzes the second frame.

    Fixes: 6e0456b54545 ("mac80211: add A-MSDU tx support")
    Signed-off-by: Lorenzo Bianconi
    Signed-off-by: Johannes Berg
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Lorenzo Bianconi
     
  • [ Upstream commit c15e3f19a6d5c89b1209dc94b40e568177cb0921 ]

    When a Mac client saves an item containing a backslash to a file server
    the backslash is represented in the CIFS/SMB protocol as as U+F026.
    Before this change, listing a directory containing an item with a
    backslash in its name will return that item with the backslash
    represented with a true backslash character (U+005C) because
    convert_sfm_character mapped U+F026 to U+005C when interpretting the
    CIFS/SMB protocol response. However, attempting to open or stat the
    path using a true backslash will result in an error because
    convert_to_sfm_char does not map U+005C back to U+F026 causing the
    CIFS/SMB request to be made with the backslash represented as U+005C.

    This change simply prevents the U+F026 to U+005C conversion from
    happenning. This is analogous to how the code does not do any
    translation of UNI_SLASH (U+F000).

    Signed-off-by: Jon Kuhn
    Signed-off-by: Steve French
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Jon Kuhn
     
  • [ Upstream commit 16fe10cf92783ed9ceb182d6ea2b8adf5e8ec1b8 ]

    The kernel module may sleep with holding a spinlock.

    The function call paths (from bottom to top) in Linux-4.16 are:

    [FUNC] usleep_range
    drivers/net/ethernet/cadence/macb_main.c, 648:
    usleep_range in macb_halt_tx
    drivers/net/ethernet/cadence/macb_main.c, 730:
    macb_halt_tx in macb_tx_error_task
    drivers/net/ethernet/cadence/macb_main.c, 721:
    _raw_spin_lock_irqsave in macb_tx_error_task

    To fix this bug, usleep_range() is replaced with udelay().

    This bug is found by my static analysis tool DSAC.

    Signed-off-by: Jia-Ju Bai
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Jia-Ju Bai
     
  • [ Upstream commit 4c85609b08c4761eca0a40fd7beb06bc650f252d ]

    This driver currently emits a STOP if the next message is not
    I2C_MD_RD. It should not do it because it disturbs the I2C_RDWR
    ioctl, where read/write transactions are combined without STOP
    between.

    Issue STOP only when the message is the last one _or_ flagged with
    I2C_M_STOP.

    Fixes: 6a62974b667f ("i2c: uniphier_f: add UniPhier FIFO-builtin I2C driver")
    Signed-off-by: Masahiro Yamada
    Signed-off-by: Wolfram Sang
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Masahiro Yamada
     
  • [ Upstream commit 38f5d8d8cbb2ffa2b54315118185332329ec891c ]

    This driver currently emits a STOP if the next message is not
    I2C_MD_RD. It should not do it because it disturbs the I2C_RDWR
    ioctl, where read/write transactions are combined without STOP
    between.

    Issue STOP only when the message is the last one _or_ flagged with
    I2C_M_STOP.

    Fixes: dd6fd4a32793 ("i2c: uniphier: add UniPhier FIFO-less I2C driver")
    Signed-off-by: Masahiro Yamada
    Signed-off-by: Wolfram Sang
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Masahiro Yamada
     
  • [ Upstream commit 1d0ffd264204eba1861865560f1f7f7a92919384 ]

    In raid10 reshape_request it gets max_sectors in read_balance. If the underlayer disks
    have bad blocks, the max_sectors is less than last. It will call goto read_more many
    times. It calls raise_barrier(conf, sectors_done != 0) every time. In this condition
    sectors_done is not 0. So the value passed to the argument force of raise_barrier is
    true.

    In raise_barrier it checks conf->barrier when force is true. If force is true and
    conf->barrier is 0, it panic. In this case reshape_request submits bio to under layer
    disks. And in the callback function of the bio it calls lower_barrier. If the bio
    finishes before calling raise_barrier again, it can trigger the BUG_ON.

    Add one pair of raise_barrier/lower_barrier to fix this bug.

    Signed-off-by: Xiao Ni
    Suggested-by: Neil Brown
    Signed-off-by: Shaohua Li
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Xiao Ni
     
  • [ Upstream commit e254de6bcf3f5b6e78a92ac95fb91acef8adfe1a ]

    We don't support reshape yet if an array supports log device. Previously we
    determine the fact by checking ->log. However, ->log could be NULL after a log
    device is removed, but the array is still marked to support log device. Don't
    allow reshape in this case too. User can disable log device support by setting
    'consistency_policy' to 'resync' then do reshape.

    Reported-by: Xiao Ni
    Tested-by: Xiao Ni
    Signed-off-by: Shaohua Li
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Shaohua Li
     
  • [ Upstream commit 3fcbb8260a87efb691d837e8cd24e81f65b3eb70 ]

    In 4.19-rc1, Eugeniy reported weird boot and IO errors on ARC HSDK

    | INFO: task syslogd:77 blocked for more than 10 seconds.
    | Not tainted 4.19.0-rc1-00007-gf213acea4e88 #40
    | "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this
    | message.
    | syslogd D 0 77 76 0x00000000
    |
    | Stack Trace:
    | __switch_to+0x0/0xac
    | __schedule+0x1b2/0x730
    | io_schedule+0x5c/0xc0
    | __lock_page+0x98/0xdc
    | find_lock_entry+0x38/0x100
    | shmem_getpage_gfp.isra.3+0x82/0xbfc
    | shmem_fault+0x46/0x138
    | handle_mm_fault+0x5bc/0x924
    | do_page_fault+0x100/0x2b8
    | ret_from_exception+0x0/0x8

    He bisected to 84c6591103db ("locking/atomics,
    asm-generic/bitops/lock.h: Rewrite using atomic_fetch_*()")

    This commit however only unmasked the real issue introduced by commit
    4aef66c8ae9 ("locking/atomic, arch/arc: Fix build") which missed the
    retry-if-scond-failed branch in atomic_fetch_##op() macros.

    The bisected commit started using atomic_fetch_##op() macros for building
    the rest of atomics.

    Fixes: 4aef66c8ae9 ("locking/atomic, arch/arc: Fix build")
    Reported-by: Eugeniy Paltsev
    Acked-by: Peter Zijlstra (Intel)
    Signed-off-by: Will Deacon
    Signed-off-by: Vineet Gupta
    [vgupta: wrote changelog]
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Will Deacon
     
  • [ Upstream commit d49b48f088c323dbacae44dfbe56d9c985c8a2a1 ]

    gpiochip_add_data_with_key() adds the gpiochip to the gpio_devices list
    before of_gpiochip_add() is called, but it's only the latter which sets
    the ->of_xlate function pointer. gpiochip_find() can be called by
    someone else between these two actions, and it can find the chip and
    call of_gpiochip_match_node_and_xlate() which leads to the following
    crash due to a NULL ->of_xlate().

    Unhandled prefetch abort: page domain fault (0x01b) at 0x00000000
    Modules linked in: leds_gpio(+) gpio_generic(+)
    CPU: 0 PID: 830 Comm: insmod Not tainted 4.18.0+ #43
    Hardware name: ARM-Versatile Express
    PC is at (null)
    LR is at of_gpiochip_match_node_and_xlate+0x2c/0x38
    Process insmod (pid: 830, stack limit = 0x(ptrval))
    (of_gpiochip_match_node_and_xlate) from (gpiochip_find+0x48/0x84)
    (gpiochip_find) from (of_get_named_gpiod_flags+0xa8/0x238)
    (of_get_named_gpiod_flags) from (gpiod_get_from_of_node+0x2c/0xc8)
    (gpiod_get_from_of_node) from (devm_fwnode_get_index_gpiod_from_child+0xb8/0x144)
    (devm_fwnode_get_index_gpiod_from_child) from (gpio_led_probe+0x208/0x3c4 [leds_gpio])
    (gpio_led_probe [leds_gpio]) from (platform_drv_probe+0x48/0x9c)
    (platform_drv_probe) from (really_probe+0x1d0/0x3d4)
    (really_probe) from (driver_probe_device+0x78/0x1c0)
    (driver_probe_device) from (__driver_attach+0x120/0x13c)
    (__driver_attach) from (bus_for_each_dev+0x68/0xb4)
    (bus_for_each_dev) from (bus_add_driver+0x1a8/0x268)
    (bus_add_driver) from (driver_register+0x78/0x10c)
    (driver_register) from (do_one_initcall+0x54/0x1fc)
    (do_one_initcall) from (do_init_module+0x64/0x1f4)
    (do_init_module) from (load_module+0x2198/0x26ac)
    (load_module) from (sys_finit_module+0xe0/0x110)
    (sys_finit_module) from (ret_fast_syscall+0x0/0x54)

    One way to fix this would be to rework the hairy registration sequence
    in gpiochip_add_data_with_key(), but since I'd probably introduce a
    couple of new bugs if I attempted that, simply add a check for a
    non-NULL of_xlate function pointer in
    of_gpiochip_match_node_and_xlate(). This works since the driver looking
    for the gpio will simply fail to find the gpio and defer its probe and
    be reprobed when the driver which is registering the gpiochip has fully
    completed its probe.

    Signed-off-by: Vincent Whitchurch
    Signed-off-by: Linus Walleij
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Vincent Whitchurch
     
  • [ Upstream commit 617c66b9f236d20f11cecbb3f45e6d5675b2fae1 ]

    When filtering by guest, kvm_stat displays garbage when the guest is
    destroyed - see sample output below.
    We add code to remove the invalid paths from the providers, so at least
    no more garbage is displayed.
    Here's a sample output to illustrate:

    kvm statistics - pid 13986 (foo)

    Event Total %Total CurAvg/s
    diagnose_258 -2 0.0 0
    deliver_program_interruption -3 0.0 0
    diagnose_308 -4 0.0 0
    halt_poll_invalid -91 0.0 -6
    deliver_service_signal -244 0.0 -16
    halt_successful_poll -250 0.1 -17
    exit_pei -285 0.1 -19
    exit_external_request -312 0.1 -21
    diagnose_9c -328 0.1 -22
    userspace_handled -713 0.1 -47
    halt_attempted_poll -939 0.2 -62
    deliver_emergency_signal -3126 0.6 -208
    halt_wakeup -7199 1.5 -481
    exit_wait_state -7379 1.5 -493
    diagnose_500 -56499 11.5 -3757
    exit_null -85491 17.4 -5685
    diagnose_44 -133300 27.1 -8874
    exit_instruction -195898 39.8 -13037
    Total -492063

    Signed-off-by: Stefan Raspl
    Signed-off-by: Radim Krčmář
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Stefan Raspl
     
  • [ Upstream commit 58f33cfe73076b6497bada4f7b5bda961ed68083 ]

    Python3 returns a float for a regular division - switch to a division
    operator that returns an integer.
    Furthermore, filters return a generator object instead of the actual
    list - wrap result in yet another list, which makes it still work in
    both, Python2 and 3.

    Signed-off-by: Stefan Raspl
    Signed-off-by: Radim Krčmář
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Stefan Raspl
     
  • [ Upstream commit aa58acf325b4aadeecae2bfc90658273b47dbace ]

    In the error path of changing the SKB headroom of the second
    A-MSDU subframe, we would not account for the already-changed
    length of the first frame that just got converted to be in
    A-MSDU format and thus is a bit longer now.

    Fix this by doing the necessary accounting.

    It would be possible to reorder the operations, but that would
    make the code more complex (to calculate the necessary pad),
    and the headroom expansion should not fail frequently enough
    to make that worthwhile.

    Fixes: 6e0456b54545 ("mac80211: add A-MSDU tx support")
    Signed-off-by: Johannes Berg
    Acked-by: Lorenzo Bianconi
    Signed-off-by: Johannes Berg
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Johannes Berg
     
  • [ Upstream commit 1eb507903665442360a959136dfa3234c43db085 ]

    Do not start to aggregate packets in a A-MSDU frame (converting the
    first subframe to A-MSDU, adding the header) if max_tx_fragments or
    max_amsdu_subframes limits are already exceeded by it. In particular,
    this happens when drivers set the limit to 1 to avoid A-MSDUs at all.

    Signed-off-by: Lorenzo Bianconi
    [reword commit message to be more precise]
    Signed-off-by: Johannes Berg
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Lorenzo Bianconi
     
  • [ Upstream commit 4f0223bfe9c3e62d8f45a85f1ef1b18a8a263ef9 ]

    nl80211_update_ft_ies() tried to validate NL80211_ATTR_IE with
    is_valid_ie_attr() before dereferencing it, but that helper function
    returns true in case of NULL pointer (i.e., attribute not included).
    This can result to dereferencing a NULL pointer. Fix that by explicitly
    checking that NL80211_ATTR_IE is included.

    Fixes: 355199e02b83 ("cfg80211: Extend support for IEEE 802.11r Fast BSS Transition")
    Signed-off-by: Arunk Khandavalli
    Signed-off-by: Jouni Malinen
    Signed-off-by: Johannes Berg
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Arunk Khandavalli
     
  • [ Upstream commit 455c4401fe7a538facaffb35b906ce19f1ece474 ]

    If there are packets in hardware when changing the speed
    or duplex, it may cause hardware hang up.

    This patch adds netif_carrier_off before change speed and
    duplex in ethtool_ops.set_link_ksettings, and adds
    netif_carrier_on after complete the change.

    Signed-off-by: Peng Li
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Peng Li
     
  • [ Upstream commit 31fabbee8f5c658c3fa1603c66e9e4f51ea8c2c6 ]

    If there are packets in hardware when changing the speed
    or duplex, it may cause hardware hang up.

    This patch adds the code for waiting chip to clean the all
    pkts(TX & RX) in chip when the driver uses the function named
    "adjust link".

    This patch cleans the pkts as follows:
    1) close rx of chip, close tx of protocol stack.
    2) wait rcb, ppe, mac to clean.
    3) adjust link
    4) open rx of chip, open tx of protocol stack.

    Signed-off-by: Peng Li
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Peng Li
     
  • [ Upstream commit 78d3a92edbfb02e8cb83173cad84c3f2d5e1f070 ]

    GpioInt ACPI event handlers may see there IRQ triggered immediately
    after requesting the IRQ (esp. level triggered ones). This means that they
    may run before any other (builtin) drivers have had a chance to register
    their OpRegion handlers, leading to errors like this:

    [ 1.133274] ACPI Error: No handler for Region [PMOP] ((____ptrval____)) [UserDefinedRegion] (20180531/evregion-132)
    [ 1.133286] ACPI Error: Region UserDefinedRegion (ID=141) has no handler (20180531/exfldio-265)
    [ 1.133297] ACPI Error: Method parse/execution failed \_SB.GPO2._L01, AE_NOT_EXIST (20180531/psparse-516)

    We already defer the manual initial trigger of edge triggered interrupts
    by running it from a late_initcall handler, this commit replaces this with
    deferring the entire acpi_gpiochip_request_interrupts() call till then,
    fixing the problem of some OpRegions not being registered yet.

    Note that this removes the need to have a list of edge triggered handlers
    which need to run, since the entire acpi_gpiochip_request_interrupts() call
    is now delayed, acpi_gpiochip_request_interrupt() can call these directly
    now.

    Acked-by: Mika Westerberg
    Signed-off-by: Hans de Goede
    Signed-off-by: Linus Walleij
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Hans de Goede
     
  • [ Upstream commit 993b9bc5c47fda86f8ab4e53d68c6fea5ff2764a ]

    The commit ca876c7483b6

    ("gpiolib-acpi: make sure we trigger edge events at least once on boot")

    added a initial value check for pin which is about to be locked as IRQ.
    Unfortunately, not all GPIO drivers can do that atomically. Thus,
    switch to cansleep version of the call. Otherwise we have a warning:

    ...
    WARNING: CPU: 2 PID: 1408 at drivers/gpio/gpiolib.c:2883 gpiod_get_value+0x46/0x50
    ...
    RIP: 0010:gpiod_get_value+0x46/0x50
    ...

    The change tested on Intel Broxton with Whiskey Cove PMIC GPIO controller.

    Fixes: ca876c7483b6 ("gpiolib-acpi: make sure we trigger edge events at least once on boot")
    Signed-off-by: Andy Shevchenko
    Cc: Hans de Goede
    Cc: Benjamin Tissoires
    Acked-by: Mika Westerberg
    Signed-off-by: Linus Walleij
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Andy Shevchenko
     
  • [ Upstream commit 166ac9d55b0ab70b644e429be1f217fe8393cbd7 ]

    When building building AMSDU from non-linear SKB, we hit a
    kernel panic when trying to push the padding to the tail.
    Instead, put the padding at the head of the next subframe.
    This also fixes the A-MSDU subframes to not have the padding
    accounted in the length field and not have pad at all for
    the last subframe, both required by the spec.

    Fixes: 6e0456b54545 ("mac80211: add A-MSDU tx support")
    Signed-off-by: Sara Sharon
    Reviewed-by: Lorenzo Bianconi
    Signed-off-by: Johannes Berg
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Sara Sharon
     
  • [ Upstream commit 1f631c3201fe5491808df143d8fcba81b3197ffd ]

    IEEE 802.11-2016 14.10.8.3 HWMP sequence numbering says:
    If it is a target mesh STA, it shall update its own HWMP SN to
    maximum (current HWMP SN, target HWMP SN in the PREQ element) + 1
    immediately before it generates a PREP element in response to a
    PREQ element.

    Signed-off-by: Yuan-Chi Pang
    Signed-off-by: Johannes Berg
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Yuan-Chi Pang
     
  • [ Upstream commit 6537886cdc9a637711fd6da980dbb87c2c87c9aa ]

    This fixes:
    [BUG] gpio: gpio-adp5588: A possible sleep-in-atomic-context bug
    in adp5588_gpio_write()
    [BUG] gpio: gpio-adp5588: A possible sleep-in-atomic-context bug
    in adp5588_gpio_direction_input()

    Reported-by: Jia-Ju Bai
    Signed-off-by: Michael Hennerich
    Signed-off-by: Linus Walleij
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Michael Hennerich
     
  • [ Upstream commit d7c863a2f65e48f442379f4ee1846d52e0c5d24d ]

    The mac80211_hwsim driver intends to say that it supports up to four
    STBC receive streams, but instead it ends up saying something undefined.
    The IEEE80211_VHT_CAP_RXSTBC_X macros aren't independent bits that can
    be ORed together, but values. In this case, _4 is the appropriate one
    to use.

    Signed-off-by: Danek Duvall
    Signed-off-by: Johannes Berg
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Danek Duvall
     
  • [ Upstream commit 67d1ba8a6dc83d90cd58b89fa6cbf9ae35a0cf7f ]

    The mod mask for VHT capabilities intends to say that you can override
    the number of STBC receive streams, and it does, but only by accident.
    The IEEE80211_VHT_CAP_RXSTBC_X aren't bits to be set, but values (albeit
    left-shifted). ORing the bits together gets the right answer, but we
    should use the _MASK macro here instead.

    Signed-off-by: Danek Duvall
    Signed-off-by: Johannes Berg
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Danek Duvall
     
  • [ Upstream commit 89809b028b6f54187b7d81a0c69b35d394c52e62 ]

    Reported-by: Colin Ian King
    Signed-off-by: Varun Prakash
    Signed-off-by: Martin K. Petersen
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Varun Prakash
     
  • [ Upstream commit 801660b040d132f67fac6a95910ad307c5929b49 ]

    Test case btrfs/164 reports use-after-free:

    [ 6712.084324] general protection fault: 0000 [#1] PREEMPT SMP
    ..
    [ 6712.195423] btrfs_update_commit_device_size+0x75/0xf0 [btrfs]
    [ 6712.201424] btrfs_commit_transaction+0x57d/0xa90 [btrfs]
    [ 6712.206999] btrfs_rm_device+0x627/0x850 [btrfs]
    [ 6712.211800] btrfs_ioctl+0x2b03/0x3120 [btrfs]

    Reason for this is that btrfs_shrink_device adds the resized device to
    the fs_devices::resized_devices after it has called the last commit
    transaction.

    So the list fs_devices::resized_devices is not empty when
    btrfs_shrink_device returns. Now the parent function
    btrfs_rm_device calls:

    btrfs_close_bdev(device);
    call_rcu(&device->rcu, free_device_rcu);

    and then does the transactio ncommit. It goes through the
    fs_devices::resized_devices in btrfs_update_commit_device_size and
    leads to use-after-free.

    Fix this by making sure btrfs_shrink_device calls the last needed
    btrfs_commit_transaction before the return. This is consistent with what
    the grow counterpart does and this makes sure the on-disk state is
    persistent when the function returns.

    Reported-by: Lu Fengqi
    Tested-by: Lu Fengqi
    Signed-off-by: Anand Jain
    Reviewed-by: David Sterba
    [ update changelog ]
    Signed-off-by: David Sterba
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Anand Jain
     
  • [ Upstream commit 46dec40fb741f00f1864580130779aeeaf24fb3d ]

    This fixes a bug which causes guest virtual addresses to get translated
    to guest real addresses incorrectly when the guest is using the HPT MMU
    and has more than 256GB of RAM, or more specifically has a HPT larger
    than 2GB. This has showed up in testing as a failure of the host to
    emulate doorbell instructions correctly on POWER9 for HPT guests with
    more than 256GB of RAM.

    The bug is that the HPTE index in kvmppc_mmu_book3s_64_hv_xlate()
    is stored as an int, and in forming the HPTE address, the index gets
    shifted left 4 bits as an int before being signed-extended to 64 bits.
    The simple fix is to make the variable a long int, matching the
    return type of kvmppc_hv_find_lock_hpte(), which is what calculates
    the index.

    Fixes: 697d3899dcb4 ("KVM: PPC: Implement MMIO emulation support for Book3S HV guests")
    Signed-off-by: Paul Mackerras
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Paul Mackerras
     
  • [ Upstream commit 484004339d4514fde425f6e8a9f6a6cc979bb0c3 ]

    Syzbot continues to try to create mac80211_hwsim radios, and
    manages to pass parameters that are later checked with WARN_ON
    in cfg80211 - catch another one in hwsim directly.

    Reported-by: syzbot+2a12f11c306afe871c1f@syzkaller.appspotmail.com
    Signed-off-by: Johannes Berg
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Johannes Berg
     
  • [ Upstream commit 77cfaf52eca5cac30ed029507e0cab065f888995 ]

    The TXQ teardown code can reference the vif data structures that are
    stored in the netdev private memory area if there are still packets on
    the queue when it is being freed. Since the TXQ teardown code is run
    after the netdevs are freed, this can lead to a use-after-free. Fix this
    by moving the TXQ teardown code to earlier in ieee80211_unregister_hw().

    Reported-by: Ben Greear
    Tested-by: Ben Greear
    Signed-off-by: Toke Høiland-Jørgensen
    Signed-off-by: Johannes Berg
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Toke Høiland-Jørgensen
     
  • commit 46c2797826cc6d1ae36fcbd966e76f9fa1907eef upstream.

    Signed-off-by: Len Brown
    Cc: Alakesh Haloi
    Signed-off-by: Greg Kroah-Hartman

    Len Brown
     
  • commit e0bf2d4982fe7d9ddaf550dd023803ea286f47fc upstream.

    Apparently, this driver (or the hardware) does not support character
    length settings. It's apparently running in 8-bit mode, but it makes
    userspace believe it's in 5-bit mode. That makes tcsetattr with CS8
    incorrectly fail, breaking e.g. getty from busybox, thus the login shell
    on ttyMVx.

    Fix by hard-wiring CS8 into c_cflag.

    Signed-off-by: Jan Kiszka
    Fixes: 30530791a7a0 ("serial: mvebu-uart: initial support for Armada-3700 serial port")
    Cc: stable # 4.6+
    Signed-off-by: Greg Kroah-Hartman

    Jan Kiszka
     
  • commit b3fc2ab37e27f8d6588a4755382346ba2335a7c7 upstream.

    Needs ATPX rather than _PR3.

    Bug: https://bugzilla.kernel.org/show_bug.cgi?id=200517
    Reviewed-by: Junwei Zhang
    Signed-off-by: Alex Deucher
    Cc: stable@vger.kernel.org
    Signed-off-by: Sudip Mukherjee
    Signed-off-by: Greg Kroah-Hartman

    Alex Deucher
     
  • commit c4ff91dd40e2253ab6dd028011469c2c694e1e19 upstream.

    The current use of result is or'ing in values and checking for
    a non-zero result, however, result is not initialized to zero
    so it potentially contains garbage to start with. Fix this by
    initializing it to the first return from the call to
    vega10_program_didt_config_registers.

    Detected by cppcheck:
    "(error) Uninitialized variable: result"

    Fixes: 9b7b8154cdb8 ("drm/amd/powerplay: added didt support for vega10")
    Signed-off-by: Colin Ian King
    Acked-by: Huang Rui
    [Fix the subject as Colin's comment]
    Signed-off-by: Huang Rui
    Signed-off-by: Alex Deucher
    Cc: stable@vger.kernel.org
    Signed-off-by: Sudip Mukherjee
    Signed-off-by: Greg Kroah-Hartman

    Colin Ian King
     

04 Oct, 2018

4 commits

  • Greg Kroah-Hartman
     
  • commit ad608fbcf166fec809e402d548761768f602702c upstream.

    The event subscriptions are added to the subscribed event list while
    holding a spinlock, but that lock is subsequently released while still
    accessing the subscription object. This makes it possible to unsubscribe
    the event --- and freeing the subscription object's memory --- while
    the subscription object is simultaneously accessed.

    Prevent this by adding a mutex to serialise the event subscription and
    unsubscription. This also gives a guarantee to the callback ops that the
    add op has returned before the del op is called.

    This change also results in making the elems field less special:
    subscriptions are only added to the event list once they are fully
    initialised.

    Signed-off-by: Sakari Ailus
    Reviewed-by: Hans Verkuil
    Reviewed-by: Laurent Pinchart
    Cc: stable@vger.kernel.org # for 4.14 and up
    Fixes: c3b5b0241f62 ("V4L/DVB: V4L: Events: Add backend")
    Signed-off-by: Mauro Carvalho Chehab
    Signed-off-by: Greg Kroah-Hartman

    Sakari Ailus
     
  • commit 2a3f93459d689d990b3ecfbe782fec89b97d3279 upstream.

    Not all execution modes are valid for a guest, and some of them
    depend on what the HW actually supports. Let's verify that what
    userspace provides is compatible with both the VM settings and
    the HW capabilities.

    Cc:
    Fixes: 0d854a60b1d7 ("arm64: KVM: enable initialization of a 32bit vcpu")
    Reviewed-by: Christoffer Dall
    Reviewed-by: Mark Rutland
    Reviewed-by: Dave Martin
    Signed-off-by: Marc Zyngier
    Signed-off-by: Will Deacon
    Signed-off-by: Greg Kroah-Hartman

    Marc Zyngier
     
  • [ Upstream commit ff924c5a1ec7548825cc2d07980b03be4224ffac ]

    Fix the section mismatch warning in arch/x86/mm/pti.c:

    WARNING: vmlinux.o(.text+0x6972a): Section mismatch in reference from the function pti_clone_pgtable() to the function .init.text:pti_user_pagetable_walk_pte()
    The function pti_clone_pgtable() references
    the function __init pti_user_pagetable_walk_pte().
    This is often because pti_clone_pgtable lacks a __init
    annotation or the annotation of pti_user_pagetable_walk_pte is wrong.
    FATAL: modpost: Section mismatches detected.

    Fixes: 85900ea51577 ("x86/pti: Map the vsyscall page if needed")
    Reported-by: kbuild test robot
    Signed-off-by: Randy Dunlap
    Signed-off-by: Thomas Gleixner
    Cc: Andy Lutomirski
    Link: https://lkml.kernel.org/r/43a6d6a3-d69d-5eda-da09-0b1c88215a2a@infradead.org
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Randy Dunlap