Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Declare flash partitions in top level .dts files instead of .dtsi file. #36

Open
wants to merge 4,282 commits into
base: master
Choose a base branch
from
This pull request is big! We’re only showing the most recent 250 commits.

Commits on Sep 9, 2017

  1. USB: musb: fix external abort on suspend

    commit 082df8b upstream.
    
    Make sure that the controller is runtime resumed when system suspending
    to avoid an external abort when accessing the interrupt registers:
    
      Unhandled fault: external abort on non-linefetch (0x1008) at 0xd025840a
      ...
      [<c05481a4>] (musb_default_readb) from [<c0545abc>] (musb_disable_interrupts+0x84/0xa8)
      [<c0545abc>] (musb_disable_interrupts) from [<c0546b08>] (musb_suspend+0x38/0xb8)
      [<c0546b08>] (musb_suspend) from [<c04a57f8>] (platform_pm_suspend+0x3c/0x64)
    
    This is easily reproduced on a BBB by enabling the peripheral port only
    (as the host port may enable the shared clock) and keeping it
    disconnected so that the controller is runtime suspended. (Well, you
    would also need to the not-yet-merged am33xx-suspend patches by Dave
    Gerlach to be able to suspend the BBB.)
    
    This is a regression that was introduced by commit 1c4d0b4 ("usb:
    musb: Remove pm_runtime_set_irq_safe") which allowed the parent glue
    device to runtime suspend and thereby exposed a couple of older issues:
    
    Register accesses without explicitly making sure the controller is
    runtime resumed during suspend was first introduced by commit c338412
    ("usb: musb: unconditionally save and restore the context on suspend")
    in 3.14.
    
    Commit a1fc192 ("usb: musb: core: make sure musb is in RPM_ACTIVE on
    resume") later started setting the RPM status to active during resume,
    and this was also implicitly relying on the parent always being active.
    Since commit 71723f9 ("PM / runtime: print error when activating a
    child to unactive parent") this now also results in the following
    warning:
    
      musb-hdrc musb-hdrc.0: runtime PM trying to activate child device
        musb-hdrc.0 but parent (47401400.usb) is not active
    
    This patch has been verified on 4.13-rc2, 4.12 and 4.9 using a BBB
    (the dsps glue would always be active also in 4.8).
    
    Fixes: c338412 ("usb: musb: unconditionally save and restore the context on suspend")
    Fixes: a1fc192 ("usb: musb: core: make sure musb is in RPM_ACTIVE on resume")
    Fixes: 1c4d0b4 ("usb: musb: Remove pm_runtime_set_irq_safe")
    Cc: Alan Stern <[email protected]>
    Cc: Daniel Mack <[email protected]>
    Cc: Dave Gerlach <[email protected]>
    Cc: Rafael J. Wysocki <[email protected]>
    Cc: Sebastian Andrzej Siewior <[email protected]>
    Cc: Tony Lindgren <[email protected]>
    Signed-off-by: Johan Hovold <[email protected]>
    Signed-off-by: Bin Liu <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    jhovold authored and gregkh committed Sep 9, 2017
    Configuration menu
    Copy the full SHA
    80cdcd7 View commit details
    Browse the repository at this point in the history
  2. USB: core: Avoid race of async_completed() w/ usbdev_release()

    commit ed62ca2 upstream.
    
    While running reboot tests w/ a specific set of USB devices (and
    slub_debug enabled), I found that once every few hours my device would
    be crashed with a stack that looked like this:
    
    [   14.012445] BUG: spinlock bad magic on CPU#0, modprobe/2091
    [   14.012460]  lock: 0xffffffc0cb055978, .magic: ffffffc0, .owner: cryption contexts: %lu/%lu
    [   14.012460] /1025536097, .owner_cpu: 0
    [   14.012466] CPU: 0 PID: 2091 Comm: modprobe Not tainted 4.4.79 #352
    [   14.012468] Hardware name: Google Kevin (DT)
    [   14.012471] Call trace:
    [   14.012483] [<....>] dump_backtrace+0x0/0x160
    [   14.012487] [<....>] show_stack+0x20/0x28
    [   14.012494] [<....>] dump_stack+0xb4/0xf0
    [   14.012500] [<....>] spin_dump+0x8c/0x98
    [   14.012504] [<....>] spin_bug+0x30/0x3c
    [   14.012508] [<....>] do_raw_spin_lock+0x40/0x164
    [   14.012515] [<....>] _raw_spin_lock_irqsave+0x64/0x74
    [   14.012521] [<....>] __wake_up+0x2c/0x60
    [   14.012528] [<....>] async_completed+0x2d0/0x300
    [   14.012534] [<....>] __usb_hcd_giveback_urb+0xc4/0x138
    [   14.012538] [<....>] usb_hcd_giveback_urb+0x54/0xf0
    [   14.012544] [<....>] xhci_irq+0x1314/0x1348
    [   14.012548] [<....>] usb_hcd_irq+0x40/0x50
    [   14.012553] [<....>] handle_irq_event_percpu+0x1b4/0x3f0
    [   14.012556] [<....>] handle_irq_event+0x4c/0x7c
    [   14.012561] [<....>] handle_fasteoi_irq+0x158/0x1c8
    [   14.012564] [<....>] generic_handle_irq+0x30/0x44
    [   14.012568] [<....>] __handle_domain_irq+0x90/0xbc
    [   14.012572] [<....>] gic_handle_irq+0xcc/0x18c
    
    Investigation using kgdb() found that the wait queue that was passed
    into wake_up() had been freed (it was filled with slub_debug poison).
    
    I analyzed and instrumented the code and reproduced.  My current
    belief is that this is happening:
    
    1. async_completed() is called (from IRQ).  Moves "as" onto the
       completed list.
    2. On another CPU, proc_reapurbnonblock_compat() calls
       async_getcompleted().  Blocks on spinlock.
    3. async_completed() releases the lock; keeps running; gets blocked
       midway through wake_up().
    4. proc_reapurbnonblock_compat() => async_getcompleted() gets the
       lock; removes "as" from completed list and frees it.
    5. usbdev_release() is called.  Frees "ps".
    6. async_completed() finally continues running wake_up().  ...but
       wake_up() has a pointer to the freed "ps".
    
    The instrumentation that led me to believe this was based on adding
    some trace_printk() calls in a select few functions and then using
    kdb's "ftdump" at crash time.  The trace follows (NOTE: in the trace
    below I cheated a little bit and added a udelay(1000) in
    async_completed() after releasing the spinlock because I wanted it to
    trigger quicker):
    
    <...>-2104   0d.h2 13759034us!: async_completed at start: as=ffffffc0cc638200
    mtpd-2055    3.... 13759356us : async_getcompleted before spin_lock_irqsave
    mtpd-2055    3d..1 13759362us : async_getcompleted after list_del_init: as=ffffffc0cc638200
    mtpd-2055    3.... 13759371us+: proc_reapurbnonblock_compat: free_async(ffffffc0cc638200)
    mtpd-2055    3.... 13759422us+: async_getcompleted before spin_lock_irqsave
    mtpd-2055    3.... 13759479us : usbdev_release at start: ps=ffffffc0cc042080
    mtpd-2055    3.... 13759487us : async_getcompleted before spin_lock_irqsave
    mtpd-2055    3.... 13759497us!: usbdev_release after kfree(ps): ps=ffffffc0cc042080
    <...>-2104   0d.h2 13760294us : async_completed before wake_up(): as=ffffffc0cc638200
    
    To fix this problem we can just move the wake_up() under the ps->lock.
    There should be no issues there that I'm aware of.
    
    Signed-off-by: Douglas Anderson <[email protected]>
    Acked-by: Alan Stern <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    dianders authored and gregkh committed Sep 9, 2017
    Configuration menu
    Copy the full SHA
    afcfe06 View commit details
    Browse the repository at this point in the history
  3. staging/rts5208: fix incorrect shift to extract upper nybble

    commit 34ff1bf upstream.
    
    The mask of sns_key_info1 suggests the upper nybble is being extracted
    however the following shift of 8 bits is too large and always results in
    0.  Fix this by shifting only by 4 bits to correctly get the upper nybble.
    
    Detected by CoverityScan, CID#142891 ("Operands don't affect result")
    
    Fixes: fa590c2 ("staging: rts5208: add support for rts5208 and rts5288")
    Signed-off-by: Colin Ian King <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Colin Ian King authored and gregkh committed Sep 9, 2017
    Configuration menu
    Copy the full SHA
    e58b04f View commit details
    Browse the repository at this point in the history
  4. iio: adc: ti-ads1015: fix incorrect data rate setting update

    commit 0d106b7 upstream.
    
    The ti-ads1015 driver has eight iio voltage channels and each iio channel
    can hold own sampling frequency information.
    
    The ADS1015 device only have a single config register which contains an
    input multiplexer selection, PGA and data rate settings.  So the driver
    should load the correct settings when the input multiplexer selection is
    changed.
    
    However, regardless of which channlel is currently selected, changing any
    iio channel's sampling frequency information immediately overwrites the
    current data rate setting in the config register.
    
    It breaks the current data rate setting if the different channel's sampling
    frequency information is changed because the data rate setting is not
    reloaded when the input multiplexer is switched.
    
    This removes the unexpected config register update and correctly load the
    data rate setting before getting adc result.
    
    Cc: Daniel Baluta <[email protected]>
    Signed-off-by: Akinobu Mita <[email protected]>
    Signed-off-by: Jonathan Cameron <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    mita authored and gregkh committed Sep 9, 2017
    Configuration menu
    Copy the full SHA
    177d84e View commit details
    Browse the repository at this point in the history
  5. iio: adc: ti-ads1015: fix scale information for ADS1115

    commit 8d0e8e7 upstream.
    
    The ti-ads1015 driver supports ADS1015 and ADS1115 devices.  The same
    scale information is used for both devices in this driver, however they
    have actually different values and the ADS1115's one is not correct.
    
    These devices have the same full-scale input voltage range for each PGA
    selection.  So instead of adding another hardcoded scale information,
    compute a correct scale on demand from each device's resolution.
    
    Cc: Daniel Baluta <[email protected]>
    Signed-off-by: Akinobu Mita <[email protected]>
    Signed-off-by: Jonathan Cameron <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    mita authored and gregkh committed Sep 9, 2017
    Configuration menu
    Copy the full SHA
    115af6c View commit details
    Browse the repository at this point in the history
  6. iio: adc: ti-ads1015: enable conversion when CONFIG_PM is not set

    commit e8245c6 upstream.
    
    The ADS1015 device have two operating modes, continuous conversion mode
    and single-shot mode.  This driver assumes that the continuous conversion
    mode is selected by runtime resume callback when the ADC result is
    requested.
    
    If CONFIG_PM is disabled, the device is always in the default single-shot
    mode and no one begins a single conversion.  So the conversion register
    doesn't contain valid ADC result.  Fix it by changing the continuous mode
    in probe function.
    
    Cc: Daniel Baluta <[email protected]>
    Signed-off-by: Akinobu Mita <[email protected]>
    Signed-off-by: Jonathan Cameron <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    mita authored and gregkh committed Sep 9, 2017
    Configuration menu
    Copy the full SHA
    c72ad1a View commit details
    Browse the repository at this point in the history
  7. iio: adc: ti-ads1015: avoid getting stale result after runtime resume

    commit 73e3e3f upstream.
    
    This driver assumes that the device is operating in the continuous
    conversion mode which performs the conversion continuously.  So this driver
    doesn't insert a wait time before reading the conversion register if the
    configuration is not changed from a previous request.
    
    This assumption is broken if the device is runtime suspended and entered
    a power-down state.  The forthcoming request causes reading a stale result
    from the conversion register as the device is runtime resumed just before.
    
    Fix it by adding a flag to detect that condition and insert a necessary
    wait time.
    
    Cc: Daniel Baluta <[email protected]>
    Signed-off-by: Akinobu Mita <[email protected]>
    Signed-off-by: Jonathan Cameron <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    mita authored and gregkh committed Sep 9, 2017
    Configuration menu
    Copy the full SHA
    1ed4565 View commit details
    Browse the repository at this point in the history
  8. iio: adc: ti-ads1015: don't return invalid value from buffer setup ca…

    …llbacks
    
    commit a6fe5e5 upstream.
    
    pm_runtime_get_sync() and pm_runtime_put_autosuspend() return 0 on
    success, 1 if the device's runtime PM status was already requested status
    or error code on failure.  So a positive return value doesn't indicate an
    error condition.
    
    However, any non-zero return values from buffer preenable and postdisable
    callbacks are recognized as an error and this driver reuses the return
    value from pm_runtime_get_sync() and pm_runtime_put_autosuspend() in
    these callbacks.  This change fixes the false error detections.
    
    Cc: Daniel Baluta <[email protected]>
    Signed-off-by: Akinobu Mita <[email protected]>
    Signed-off-by: Jonathan Cameron <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    mita authored and gregkh committed Sep 9, 2017
    Configuration menu
    Copy the full SHA
    ff4a98e View commit details
    Browse the repository at this point in the history
  9. iio: adc: ti-ads1015: add adequate wait time to get correct conversion

    commit 4744d4e upstream.
    
    This driver assumes that the device is operating in the continuous
    conversion mode which performs the conversion continuously.  So this driver
    inserts a wait time before reading the conversion register if the
    configuration is changed from a previous request.
    
    Currently, the wait time is only the period required for a single
    conversion that is calculated as the reciprocal of the sampling frequency.
    However we also need to wait for the the previous conversion to complete.
    Otherwise we probably get the conversion result for the previous
    configuration when the sampling frequency is lower.
    
    Cc: Daniel Baluta <[email protected]>
    Signed-off-by: Akinobu Mita <[email protected]>
    Signed-off-by: Jonathan Cameron <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    mita authored and gregkh committed Sep 9, 2017
    Configuration menu
    Copy the full SHA
    ffb58b8 View commit details
    Browse the repository at this point in the history
  10. driver core: bus: Fix a potential double free

    commit 0f9b011 upstream.
    
    The .release function of driver_ktype is 'driver_release()'.
    This function frees the container_of this kobject.
    
    So, this memory must not be freed explicitly in the error handling path of
    'bus_add_driver()'. Otherwise a double free will occur.
    
    Signed-off-by: Christophe JAILLET <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    tititiou36 authored and gregkh committed Sep 9, 2017
    Configuration menu
    Copy the full SHA
    5555eb9 View commit details
    Browse the repository at this point in the history
  11. intel_th: pci: Add Cannon Lake PCH-H support

    commit 84331e1 upstream.
    
    This adds Intel(R) Trace Hub PCI ID for Cannon Lake PCH-H.
    
    Signed-off-by: Alexander Shishkin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    virtuoso authored and gregkh committed Sep 9, 2017
    Configuration menu
    Copy the full SHA
    a22d561 View commit details
    Browse the repository at this point in the history
  12. intel_th: pci: Add Cannon Lake PCH-LP support

    commit efb3669 upstream.
    
    This adds Intel(R) Trace Hub PCI ID for Cannon Lake PCH-LP.
    
    Signed-off-by: Alexander Shishkin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    virtuoso authored and gregkh committed Sep 9, 2017
    Configuration menu
    Copy the full SHA
    d8b992d View commit details
    Browse the repository at this point in the history
  13. ath10k: fix memory leak in rx ring buffer allocation

    commit f35a7f9 upstream.
    
    The rx ring buffers are added to a hash table if
    firmware support full rx reorder. If the full rx
    reorder support flag is not set before allocating
    the rx ring buffers, none of the buffers are added
    to the hash table.
    
    There is a race condition between rx ring refill and
    rx buffer replenish from napi poll. The interrupts are
    enabled in hif start, before the rx ring is refilled during init.
    We replenish buffers from napi poll due to the interrupts which
    get enabled after hif start. Hence before the entire rx ring is
    refilled during the init, the napi poll replenishes a few buffers
    in steps of 100 buffers per attempt. During this rx ring replenish
    from napi poll, the rx reorder flag has not been set due to which
    the replenished buffers are not added to the hash table
    
    Set the rx full reorder support flag before we allocate
    the rx ring buffer to avoid the memory leak.
    
    Signed-off-by: Rakesh Pillai <[email protected]>
    Signed-off-by: Kalle Valo <[email protected]>
    Cc: Christian Lamparter <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Rakesh Pillai authored and gregkh committed Sep 9, 2017
    Configuration menu
    Copy the full SHA
    90a1e2e View commit details
    Browse the repository at this point in the history
  14. Input: trackpoint - assume 3 buttons when buttons detection fails

    commit 293b915 upstream.
    
    Trackpoint buttons detection fails on ThinkPad 570 and 470 series,
    this makes the middle button of the trackpoint to not being recogized.
    As I don't believe there is any trackpoint with less than 3 buttons this
    patch just assumes three buttons when the extended button information
    read fails.
    
    Signed-off-by: Oscar Campos <[email protected]>
    Acked-by: Peter Hutterer <[email protected]>
    Signed-off-by: Dmitry Torokhov <[email protected]>
    Signed-off-by: Aaron Ma <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    DamnWidget authored and gregkh committed Sep 9, 2017
    Configuration menu
    Copy the full SHA
    ed7a384 View commit details
    Browse the repository at this point in the history
  15. rtlwifi: rtl_pci_probe: Fix fail path of _rtl_pci_find_adapter

    commit fc81bab upstream.
    
    _rtl_pci_find_adapter fail path will jump to label fail3 for
    unsupported adapter types.
    
    However, on course for fail3 there will be call rtl_deinit_core
    before rtl_init_core.
    
    For the inclusion of checking pci_iounmap this fail can be moved to
    fail2.
    
    Fixes
    [    4.492963] BUG: unable to handle kernel NULL pointer dereference at           (null)
    [    4.493067] IP: rtl_deinit_core+0x31/0x90 [rtlwifi]
    
    Signed-off-by: Malcolm Priestley <[email protected]>
    Signed-off-by: Kalle Valo <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Malcolm Priestley authored and gregkh committed Sep 9, 2017
    Configuration menu
    Copy the full SHA
    b48f718 View commit details
    Browse the repository at this point in the history
  16. Bluetooth: Add support of 13d3:3494 RTL8723BE device

    commit a81d72d upstream.
    
    T: Bus=02 Lev=01 Prnt=01 Port=03 Cnt=03 Dev#= 4 Spd=12 MxCh= 0
    D: Ver= 2.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
    P: Vendor=13d3 ProdID=3494 Rev= 2.00
    S: Manufacturer=Realtek
    S: Product=Bluetooth Radio
    S: SerialNumber=00e04c000001
    C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=500mA
    I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms
    E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms
    E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms
    I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms
    E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms
    I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms
    E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms
    I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms
    E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms
    I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms
    E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms
    I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms
    E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms
    I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms
    E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms
    
    Signed-off-by: Dmitry Tunin <[email protected]>
    Signed-off-by: Marcel Holtmann <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    hanipouspilot authored and gregkh committed Sep 9, 2017
    Configuration menu
    Copy the full SHA
    7475626 View commit details
    Browse the repository at this point in the history
  17. iwlwifi: pci: add new PCI ID for 7265D

    commit 3f7a5e1 upstream.
    
    We have a new PCI subsystem ID for 7265D.  Add it to the list.
    
    Signed-off-by: Luca Coelho <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    lucacoelho authored and gregkh committed Sep 9, 2017
    Configuration menu
    Copy the full SHA
    23b7d4f View commit details
    Browse the repository at this point in the history
  18. dlm: avoid double-free on error path in dlm_device_{register,unregister}

    commit 55acdd9 upstream.
    
    Can be reproduced when running dlm_controld (tested on 4.4.x, 4.12.4):
     # seq 1 100 | xargs -P0 -n1 dlm_tool join
     # seq 1 100 | xargs -P0 -n1 dlm_tool leave
    
    misc_register fails due to duplicate sysfs entry, which causes
    dlm_device_register to free ls->ls_device.name.
    In dlm_device_deregister the name was freed again, causing memory
    corruption.
    
    According to the comment in dlm_device_deregister the name should've been
    set to NULL when registration fails,
    so this patch does that.
    
    sysfs: cannot create duplicate filename '/dev/char/10:1'
    ------------[ cut here ]------------
    warning: cpu: 1 pid: 4450 at fs/sysfs/dir.c:31 sysfs_warn_dup+0x56/0x70
    modules linked in: msr rfcomm dlm ccm bnep dm_crypt uvcvideo
    videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videobuf2_core videodev
    btusb media btrtl btbcm btintel bluetooth ecdh_generic intel_rapl
    x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel kvm
    snd_hda_codec_hdmi irqbypass crct10dif_pclmul crc32_pclmul
    ghash_clmulni_intel thinkpad_acpi pcbc nvram snd_seq_midi
    snd_seq_midi_event aesni_intel snd_hda_codec_realtek snd_hda_codec_generic
    snd_rawmidi aes_x86_64 crypto_simd glue_helper snd_hda_intel snd_hda_codec
    cryptd intel_cstate arc4 snd_hda_core snd_seq snd_seq_device snd_hwdep
    iwldvm intel_rapl_perf mac80211 joydev input_leds iwlwifi serio_raw
    cfg80211 snd_pcm shpchp snd_timer snd mac_hid mei_me lpc_ich mei soundcore
    sunrpc parport_pc ppdev lp parport autofs4 i915 psmouse
     e1000e ahci libahci i2c_algo_bit sdhci_pci ptp drm_kms_helper sdhci
    pps_core syscopyarea sysfillrect sysimgblt fb_sys_fops drm wmi video
    cpu: 1 pid: 4450 comm: dlm_test.exe not tainted 4.12.4-041204-generic
    hardware name: lenovo 232425u/232425u, bios g2et82ww (2.02 ) 09/11/2012
    task: ffff96b0cbabe140 task.stack: ffffb199027d0000
    rip: 0010:sysfs_warn_dup+0x56/0x70
    rsp: 0018:ffffb199027d3c58 eflags: 00010282
    rax: 0000000000000038 rbx: ffff96b0e2c49158 rcx: 0000000000000006
    rdx: 0000000000000000 rsi: 0000000000000086 rdi: ffff96b15e24dcc0
    rbp: ffffb199027d3c70 r08: 0000000000000001 r09: 0000000000000721
    r10: ffffb199027d3c00 r11: 0000000000000721 r12: ffffb199027d3cd1
    r13: ffff96b1592088f0 r14: 0000000000000001 r15: ffffffffffffffef
    fs:  00007f78069c0700(0000) gs:ffff96b15e240000(0000)
    knlgs:0000000000000000
    cs:  0010 ds: 0000 es: 0000 cr0: 0000000080050033
    cr2: 000000178625ed28 cr3: 0000000091d3e000 cr4: 00000000001406e0
    call trace:
     sysfs_do_create_link_sd.isra.2+0x9e/0xb0
     sysfs_create_link+0x25/0x40
     device_add+0x5a9/0x640
     device_create_groups_vargs+0xe0/0xf0
     device_create_with_groups+0x3f/0x60
     ? snprintf+0x45/0x70
     misc_register+0x140/0x180
     device_write+0x6a8/0x790 [dlm]
     __vfs_write+0x37/0x160
     ? apparmor_file_permission+0x1a/0x20
     ? security_file_permission+0x3b/0xc0
     vfs_write+0xb5/0x1a0
     sys_write+0x55/0xc0
     ? sys_fcntl+0x5d/0xb0
     entry_syscall_64_fastpath+0x1e/0xa9
    rip: 0033:0x7f78083454bd
    rsp: 002b:00007f78069bbd30 eflags: 00000293 orig_rax: 0000000000000001
    rax: ffffffffffffffda rbx: 0000000000000006 rcx: 00007f78083454bd
    rdx: 000000000000009c rsi: 00007f78069bee00 rdi: 0000000000000005
    rbp: 00007f77f8000a20 r08: 000000000000fcf0 r09: 0000000000000032
    r10: 0000000000000024 r11: 0000000000000293 r12: 00007f78069bde00
    r13: 00007f78069bee00 r14: 000000000000000a r15: 00007f78069bbd70
    code: 85 c0 48 89 c3 74 12 b9 00 10 00 00 48 89 c2 31 f6 4c 89 ef e8 2c c8
    ff ff 4c 89 e2 48 89 de 48 c7 c7 b0 8e 0c a8 e8 41 e8 ed ff <0f> ff 48 89
    df e8 00 d5 f4 ff 5b 41 5c 41 5d 5d c3 66 0f 1f 84
    ---[ end trace 40412246357cc9e0 ]---
    
    dlm: 59f24629-ae39-44e2-9030-397ebc2eda26: leaving the lockspace group...
    bug: unable to handle kernel null pointer dereference at 0000000000000001
    ip: [<ffffffff811a3b4a>] kmem_cache_alloc+0x7a/0x140
    pgd 0
    oops: 0000 [linux4sam#1] smp
    modules linked in: dlm 8021q garp mrp stp llc openvswitch nf_defrag_ipv6
    nf_conntrack libcrc32c iptable_filter dm_multipath crc32_pclmul dm_mod
    aesni_intel psmouse aes_x86_64 sg ablk_helper cryptd lrw gf128mul
    glue_helper i2c_piix4 nls_utf8 tpm_tis tpm isofs nfsd auth_rpcgss
    oid_registry nfs_acl lockd grace sunrpc xen_wdt ip_tables x_tables autofs4
    hid_generic usbhid hid sr_mod cdrom sd_mod ata_generic pata_acpi 8139too
    serio_raw ata_piix 8139cp mii uhci_hcd ehci_pci ehci_hcd libata
    scsi_dh_rdac scsi_dh_hp_sw scsi_dh_emc scsi_dh_alua scsi_mod ipv6
    cpu: 0 pid: 394 comm: systemd-udevd tainted: g w 4.4.0+0 linux4sam#1
    hardware name: xen hvm domu, bios 4.7.2-2.2 05/11/2017
    task: ffff880002410000 ti: ffff88000243c000 task.ti: ffff88000243c000
    rip: e030:[<ffffffff811a3b4a>] [<ffffffff811a3b4a>]
    kmem_cache_alloc+0x7a/0x140
    rsp: e02b:ffff88000243fd90 eflags: 00010202
    rax: 0000000000000000 rbx: ffff8800029864d0 rcx: 000000000007b36c
    rdx: 000000000007b36b rsi: 00000000024000c0 rdi: ffff880036801c00
    rbp: ffff88000243fdc0 r08: 0000000000018880 r09: 0000000000000054
    r10: 000000000000004a r11: ffff880034ace6c0 r12: 00000000024000c0
    r13: ffff880036801c00 r14: 0000000000000001 r15: ffffffff8118dcc2
    fs: 00007f0ab77548c0(0000) gs:ffff880036e00000(0000) knlgs:0000000000000000
    cs: e033 ds: 0000 es: 0000 cr0: 0000000080050033
    cr2: 0000000000000001 cr3: 000000000332d000 cr4: 0000000000040660
    stack:
    ffffffff8118dc90 ffff8800029864d0 0000000000000000 ffff88003430b0b0
    ffff880034b78320 ffff88003430b0b0 ffff88000243fdf8 ffffffff8118dcc2
    ffff8800349c6700 ffff8800029864d0 000000000000000b 00007f0ab7754b90
    call trace:
    [<ffffffff8118dc90>] ? anon_vma_fork+0x60/0x140
    [<ffffffff8118dcc2>] anon_vma_fork+0x92/0x140
    [<ffffffff8107033e>] copy_process+0xcae/0x1a80
    [<ffffffff8107128b>] _do_fork+0x8b/0x2d0
    [<ffffffff81071579>] sys_clone+0x19/0x20
    [<ffffffff815a30ae>] entry_syscall_64_fastpath+0x12/0x71
    ] code: f6 75 1c 4c 89 fa 44 89 e6 4c 89 ef e8 a7 e4 00 00 41 f7 c4 00 80
    00 00 49 89 c6 74 47 eb 32 49 63 45 20 48 8d 4a 01 4d 8b 45 00 <49> 8b 1c
    06 4c 89 f0 65 49 0f c7 08 0f 94 c0 84 c0 74 ac 49 63
    rip [<ffffffff811a3b4a>] kmem_cache_alloc+0x7a/0x140
    rsp <ffff88000243fd90>
    cr2: 0000000000000001
    --[ end trace 70cb9fd1b164a0e8 ]--
    
    Signed-off-by: Edwin Török <[email protected]>
    Signed-off-by: David Teigland <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    edwintorok authored and gregkh committed Sep 9, 2017
    Configuration menu
    Copy the full SHA
    5c23d3e View commit details
    Browse the repository at this point in the history
  19. mwifiex: correct channel stat buffer overflows

    commit 4b5dde2 upstream.
    
    mwifiex records information about various channels as it receives scan
    information. It does this by appending to a buffer that was sized
    to the max number of supported channels on any band, but there are
    numerous problems:
    
    (a) scans can return info from more than one band (e.g., both 2.4 and 5
        GHz), so the determined "max" is not large enough
    (b) some firmware appears to return multiple results for a given
        channel, so the max *really* isn't large enough
    (c) there is no bounds checking when stashing these stats, so problems
        (a) and (b) can easily lead to buffer overflows
    
    Let's patch this by setting a slightly-more-correct max (that accounts
    for a combination of both 2.4G and 5G bands) and adding a bounds check
    when writing to our statistics buffer.
    
    Due to problem (b), we still might not properly report all known survey
    information (e.g., with "iw <dev> survey dump"), since duplicate results
    (or otherwise "larger than expected" results) will cause some
    truncation. But that's a problem for a future bugfix.
    
    (And because of this known deficiency, only log the excess at the WARN
    level, since that isn't visible by default in this driver and would
    otherwise be a bit too noisy.)
    
    Fixes: bf35443 ("mwifiex: channel statistics support for mwifiex")
    Cc: Avinash Patil <[email protected]>
    Cc: Xinming Hu <[email protected]>
    Signed-off-by: Brian Norris <[email protected]>
    Reviewed-by: Dmitry Torokhov <[email protected]>
    Reviewed-by: Ganapathi Bhat <[email protected]>
    Signed-off-by: Kalle Valo <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    computersforpeace authored and gregkh committed Sep 9, 2017
    Configuration menu
    Copy the full SHA
    0e720cd View commit details
    Browse the repository at this point in the history
  20. MCB: add support for SC31 to mcb-lpc

    commit acf5e05 upstream.
    
    This patch adds the resources and DMI ID's for the MEN SC31,
    which uses a different address region to map the LPC bus than
    the one used for the existing SC24.
    
    Signed-off-by: Michael Moese <[email protected]>
    [jth add stable tag]
    Signed-off-by: Johannes Thumshirn <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Michael Moese authored and gregkh committed Sep 9, 2017
    Configuration menu
    Copy the full SHA
    c193bec View commit details
    Browse the repository at this point in the history
  21. s390/mm: avoid empty zero pages for KVM guests to avoid postcopy hangs

    commit fa41ba0 upstream.
    
    Right now there is a potential hang situation for postcopy migrations,
    if the guest is enabling storage keys on the target system during the
    postcopy process.
    
    For storage key virtualization, we have to forbid the empty zero page as
    the storage key is a property of the physical page frame.  As we enable
    storage key handling lazily we then drop all mappings for empty zero
    pages for lazy refaulting later on.
    
    This does not work with the postcopy migration, which relies on the
    empty zero page never triggering a fault again in the future. The reason
    is that postcopy migration will simply read a page on the target system
    if that page is a known zero page to fault in an empty zero page.  At
    the same time postcopy remembers that this page was already transferred
    - so any future userfault on that page will NOT be retransmitted again
    to avoid races.
    
    If now the guest enters the storage key mode while in postcopy, we will
    break this assumption of postcopy.
    
    The solution is to disable the empty zero page for KVM guests early on
    and not during storage key enablement. With this change, the postcopy
    migration process is guaranteed to start after no zero pages are left.
    
    As guest pages are very likely not empty zero pages anyway the memory
    overhead is also pretty small.
    
    While at it this also adds proper page table locking to the zero page
    removal.
    
    Signed-off-by: Christian Borntraeger <[email protected]>
    Acked-by: Janosch Frank <[email protected]>
    Signed-off-by: Martin Schwidefsky <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    borntraeger authored and gregkh committed Sep 9, 2017
    Configuration menu
    Copy the full SHA
    0788667 View commit details
    Browse the repository at this point in the history
  22. drm/nouveau/pci/msi: disable MSI on big-endian platforms by default

    commit bc60c90 upstream.
    
    It appears that MSI does not work on either G5 PPC nor on a E5500-based
    platform, where other hardware is reported to work fine with MSI.
    
    Both tests were conducted with NV4x hardware, so perhaps other (or even
    this) hardware can be made to work. It's still possible to force-enable
    with config=NvMSI=1 on load.
    
    Signed-off-by: Ilia Mirkin <[email protected]>
    Signed-off-by: Ben Skeggs <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    imirkin authored and gregkh committed Sep 9, 2017
    Configuration menu
    Copy the full SHA
    25bdc51 View commit details
    Browse the repository at this point in the history
  23. workqueue: Fix flag collision

    commit fbf1c41 upstream.
    
    Commit 0a94efb ("workqueue: implicit ordered attribute should be
    overridable") introduced a __WQ_ORDERED_EXPLICIT flag but gave it the
    same value as __WQ_LEGACY.  I don't believe these were intended to
    mean the same thing, so renumber __WQ_ORDERED_EXPLICIT.
    
    Fixes: 0a94efb ("workqueue: implicit ordered attribute should be ...")
    Signed-off-by: Ben Hutchings <[email protected]>
    Signed-off-by: Tejun Heo <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    bwhacks authored and gregkh committed Sep 9, 2017
    Configuration menu
    Copy the full SHA
    ec552ec View commit details
    Browse the repository at this point in the history
  24. cs5536: add support for IDE controller variant

    commit 591b6bb upstream.
    
    Several legacy devices such as Geode-based Cisco ASA appliances
    and DB800 development board do possess CS5536 IDE controller
    with different PCI id than existing one. Using pata_generic is
    not always feasible as at least DB800 requires MSR quirk from
    pata_cs5536 to be used with vendor firmware.
    
    Signed-off-by: Andrey Korolyov <[email protected]>
    Signed-off-by: Tejun Heo <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    xdel authored and gregkh committed Sep 9, 2017
    Configuration menu
    Copy the full SHA
    5b9c6a5 View commit details
    Browse the repository at this point in the history
  25. scsi: sg: protect against races between mmap() and SG_SET_RESERVED_SIZE

    commit 6a8dadc upstream.
    
    Take f_mutex around mmap() processing to protect against races with the
    SG_SET_RESERVED_SIZE ioctl.  Ensure the reserve buffer length remains
    consistent during the mapping operation, and set the "mmap called" flag
    to prevent further changes to the reserved buffer size as an atomic
    operation with the mapping.
    
    [mkp: fixed whitespace]
    
    Signed-off-by: Todd Poynor <[email protected]>
    Acked-by: Douglas Gilbert <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    toddpoynor authored and gregkh committed Sep 9, 2017
    Configuration menu
    Copy the full SHA
    b06e1ab View commit details
    Browse the repository at this point in the history
  26. scsi: sg: recheck MMAP_IO request length with lock held

    commit 8d26f49 upstream.
    
    Commit 1bc0eb0 ("scsi: sg: protect accesses to 'reserved' page
    array") adds needed concurrency protection for the "reserve" buffer.
    Some checks that are initially made outside the lock are replicated once
    the lock is taken to ensure the checks and resulting decisions are made
    using consistent state.
    
    The check that a request with flag SG_FLAG_MMAP_IO set fits in the
    reserve buffer also needs to be performed again under the lock to ensure
    the reserve buffer length compared against matches the value in effect
    when the request is linked to the reserve buffer.  An -ENOMEM should be
    returned in this case, instead of switching over to an indirect buffer
    as for non-MMAP_IO requests.
    
    Signed-off-by: Todd Poynor <[email protected]>
    Acked-by: Douglas Gilbert <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    toddpoynor authored and gregkh committed Sep 9, 2017
    Configuration menu
    Copy the full SHA
    7791b59 View commit details
    Browse the repository at this point in the history
  27. drm/bridge: adv7511: Use work_struct to defer hotplug handing to out …

    …of irq context
    
    commit 518cb70 upstream.
    
    I was recently seeing issues with EDID probing, where
    the logic to wait for the EDID read bit to be set by the
    IRQ wasn't happening and the code would time out and fail.
    
    Digging deeper, I found this was due to the fact that
    IRQs were disabled as we were running in IRQ context from
    the HPD signal.
    
    Thus this patch changes the logic to handle the HPD signal
    via a work_struct so we can be out of irq context.
    
    With this patch, the EDID probing on hotplug does not time
    out.
    
    Cc: David Airlie <[email protected]>
    Cc: Archit Taneja <[email protected]>
    Cc: Wolfram Sang <[email protected]>
    Cc: Lars-Peter Clausen <[email protected]>
    Cc: Laurent Pinchart <[email protected]>
    Cc: [email protected]
    Reviewed-by: Laurent Pinchart <[email protected]>
    Tested-by: Laurent Pinchart <[email protected]>
    Signed-off-by: John Stultz <[email protected]>
    Signed-off-by: Archit Taneja <[email protected]>
    Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
    Signed-off-by: Thong Ho <[email protected]>
    Signed-off-by: Nhan Nguyen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    johnstultz-work authored and gregkh committed Sep 9, 2017
    Configuration menu
    Copy the full SHA
    8b5a7e4 View commit details
    Browse the repository at this point in the history
  28. drm/bridge: adv7511: Switch to using drm_kms_helper_hotplug_event()

    commit 6d5104c upstream.
    
    In chasing down a previous issue with EDID probing from calling
    drm_helper_hpd_irq_event() from irq context, Laurent noticed
    that the DRM documentation suggests that
    drm_kms_helper_hotplug_event() should be used instead.
    
    Thus this patch replaces drm_helper_hpd_irq_event() with
    drm_kms_helper_hotplug_event(), which requires we update the
    connector.status entry and only call _hotplug_event() when the
    status changes.
    
    Cc: David Airlie <[email protected]>
    Cc: Archit Taneja <[email protected]>
    Cc: Wolfram Sang <[email protected]>
    Cc: Lars-Peter Clausen <[email protected]>
    Cc: Laurent Pinchart <[email protected]>
    Cc: [email protected]
    Reviewed-by: Laurent Pinchart <[email protected]>
    Tested-by: Laurent Pinchart <[email protected]>
    Signed-off-by: John Stultz <[email protected]>
    Signed-off-by: Archit Taneja <[email protected]>
    Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
    Signed-off-by: Thong Ho <[email protected]>
    Signed-off-by: Nhan Nguyen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    johnstultz-work authored and gregkh committed Sep 9, 2017
    Configuration menu
    Copy the full SHA
    8bc67f6 View commit details
    Browse the repository at this point in the history

Commits on Sep 10, 2017

  1. Linux 4.9.49

    gregkh committed Sep 10, 2017
    Configuration menu
    Copy the full SHA
    f07cb34 View commit details
    Browse the repository at this point in the history

Commits on Sep 11, 2017

  1. ARM: dts: at91-sama5d27_som1_ek: enable ulp1 support

    Add node to enable ulp1 i.e. fast restart support.
    
    Signed-off-by: Ludovic Desroches <[email protected]>
    ldesroches committed Sep 11, 2017
    Configuration menu
    Copy the full SHA
    2a66318 View commit details
    Browse the repository at this point in the history
  2. ARM: dts: at91-sama5d27_som1_ek: enable i2c0

    Signed-off-by: Ludovic Desroches <[email protected]>
    ldesroches committed Sep 11, 2017
    Configuration menu
    Copy the full SHA
    3211159 View commit details
    Browse the repository at this point in the history
  3. ARM: dts: at91-sama5d27_som1_ek: add aliases for i2c

    Add aliases for i2c devices to not rely on probe order for i2c device
    numbering.
    
    Signed-off-by: Ludovic Desroches <[email protected]>
    ldesroches committed Sep 11, 2017
    Configuration menu
    Copy the full SHA
    d797346 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    f01c017 View commit details
    Browse the repository at this point in the history

Commits on Sep 12, 2017

  1. ARM: dts: at91-sama5d2_xplained: add pinmuxing for pwm0

    Add pin muxing for pwm0 and set it as disabled since it is in conflict
    with the pins for leds.
    
    Signed-off-by: Claudiu Beznea <[email protected]>
    claudiubeznea committed Sep 12, 2017
    Configuration menu
    Copy the full SHA
    13f6e06 View commit details
    Browse the repository at this point in the history
  2. ARM: dts: at91: at91sam9x25ek: add pwm0

    Add the PWM0 interface and one output of channel 0 (on PC10) on this headless
    board. The output conflicts with LCD and ISI, so only enable it for this
    particular board of the series (ISI is enabled on at91sam9g25ek, as an example
    but we can do the other way around).
    
    Signed-off-by: Nicolas Ferre <[email protected]>
    noglitch committed Sep 12, 2017
    Configuration menu
    Copy the full SHA
    f2ba537 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    e976286 View commit details
    Browse the repository at this point in the history

Commits on Sep 13, 2017

  1. ARM: dts: at91: sama5d27_som1_ek: add pinmuxing for pwm0

    Add pin muxing for pwm0 and set it as disabled since it is in conflict
    with the pins for leds.
    
    Signed-off-by: Claudiu Beznea <[email protected]>
    claudiubeznea committed Sep 13, 2017
    Configuration menu
    Copy the full SHA
    be56dc7 View commit details
    Browse the repository at this point in the history
  2. ARM: dts: at91: sama5d2_xplained: keep naming convention for pwm

    Change pwm pin muxing name to keep, as much as possible, the naming
    convention used on the other Atmel/Microchip boards.
    
    Signed-off-by: Claudiu Beznea <[email protected]>
    claudiubeznea committed Sep 13, 2017
    Configuration menu
    Copy the full SHA
    e1587c3 View commit details
    Browse the repository at this point in the history
  3. clk: at91: pmc: Save SCSR during suspend

    The contents of the System Clock Status Register (SCSR) needs to be
    restored into the System Clock Enable Register (SCER).
    
    As the bootloader will restore some clocks by itself, the issue can be
    missed as only the USB controller, the LCD controller, the Image Sensor
    controller and the programmable clocks will be impacted.
    
    Fix the obvious typo in the suspend/resume code, as the IMR register
    does not need to be saved twice.
    
    Signed-off-by: Romain Izard <[email protected]>
    romain-izard-pro authored and noglitch committed Sep 13, 2017
    Configuration menu
    Copy the full SHA
    0d32b9e View commit details
    Browse the repository at this point in the history
  4. ARM: dts: at91-sama5d27_som1_ek: add drive strength for LCD base signals

    Set drive strength to medium for LCD base signals to avoid the
    "tearing effect".
    
    Signed-off-by: Ludovic Desroches <[email protected]>
    ldesroches committed Sep 13, 2017
    Configuration menu
    Copy the full SHA
    8324b8b View commit details
    Browse the repository at this point in the history
  5. ARM: dts: at91-sama5d2_xplained: add drive strength for LCD base signals

    Set drive strength to medium for LCD base signals to avoid the
    "tearing effect".
    
    Signed-off-by: Ludovic Desroches <[email protected]>
    ldesroches committed Sep 13, 2017
    Configuration menu
    Copy the full SHA
    ee3a54d View commit details
    Browse the repository at this point in the history
  6. pinctrl: dt-binding: at91-pio4: add drive-strength property

    Add the drive-strength property whose valid values are
    ATMEL_PIO_DRVSTR_LO, ATMEL_PIO_DRVSTR_ME, ATMEL_PIO_DRVSTR_HI.
    
    Signed-off-by: Ludovic Desroches <[email protected]>
    ldesroches committed Sep 13, 2017
    Configuration menu
    Copy the full SHA
    ee92ac1 View commit details
    Browse the repository at this point in the history
  7. pinctrl: at91-pio4: add support for drive-strength property

    Add support for the drive-strength property. Usually its value is
    expressed in mA. Since the numeric value depends on VDDIOP voltage,
    the controller uses low, medium and high to define the drive-strengh.
    
    The pio controller accepts two values for the low drive: 0 or 1. As most
    of the time it is not needed to change the drive, 0 is considered as the
    default value. The low-drive value won't be advertised through
    pinconf-pins file excepted if it has been set explicitly in the device
    tree.
    
    Signed-off-by: Ludovic Desroches <[email protected]>
    ldesroches committed Sep 13, 2017
    Configuration menu
    Copy the full SHA
    1d66dcd View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    ec3b3b7 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    690bee4 View commit details
    Browse the repository at this point in the history
  10. mtd: nand: mxc: Fix mxc_v1 ooblayout

    commit 3bff08d upstream.
    
    Commit a894cf6 ("mtd: nand: mxc: switch to mtd_ooblayout_ops")
    introduced a bug in the OOB layout description. Even if the driver claims
    that 3 ECC bytes are reserved to protect 512 bytes of data, it's actually
    5 ECC bytes to protect 512+6 bytes of data (some OOB bytes are also
    protected using extra ECC bytes).
    
    Fix the mxc_v1_ooblayout_{free,ecc}() functions to reflect this behavior.
    
    Signed-off-by: Boris Brezillon <[email protected]>
    Fixes: a894cf6 ("mtd: nand: mxc: switch to mtd_ooblayout_ops")
    Signed-off-by: Boris Brezillon <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Boris Brezillon authored and gregkh committed Sep 13, 2017
    Configuration menu
    Copy the full SHA
    8651620 View commit details
    Browse the repository at this point in the history
  11. mtd: nand: qcom: fix read failure without complete bootchain

    commit d8a9b32 upstream.
    
    The NAND page read fails without complete boot chain since
    NAND_DEV_CMD_VLD value is not proper. The default power on reset
    value for this register is
    
        0xe - ERASE_START_VALID | WRITE_START_VALID | READ_STOP_VALID
    
    The READ_START_VALID should be enabled for sending PAGE_READ
    command. READ_STOP_VALID should be cleared since normal NAND
    page read does not require READ_STOP command.
    
    Fixes: c76b78d ("mtd: nand: Qualcomm NAND controller driver")
    Reviewed-by: Archit Taneja <[email protected]>
    Signed-off-by: Abhishek Sahu <[email protected]>
    Signed-off-by: Boris Brezillon <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Abhishek Sahu authored and gregkh committed Sep 13, 2017
    Configuration menu
    Copy the full SHA
    f4a272d View commit details
    Browse the repository at this point in the history
  12. mtd: nand: qcom: fix config error for BCH

    commit 10777de upstream.
    
    The configuration for BCH is not correct in the current driver.
    The ECC_CFG_ECC_DISABLE bit defines whether to enable or disable the
    BCH ECC in which
    
    	0x1 : BCH_DISABLED
    	0x0 : BCH_ENABLED
    
    But currently host->bch_enabled is being assigned to BCH_DISABLED.
    
    Fixes: c76b78d ("mtd: nand: Qualcomm NAND controller driver")
    Signed-off-by: Abhishek Sahu <[email protected]>
    Reviewed-by: Archit Taneja <[email protected]>
    Signed-off-by: Boris Brezillon <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Abhishek Sahu authored and gregkh committed Sep 13, 2017
    Configuration menu
    Copy the full SHA
    b276bc6 View commit details
    Browse the repository at this point in the history
  13. nvme-fabrics: generate spec-compliant UUID NQNs

    commit 40a5fce upstream.
    
    The default host NQN, which is generated based on the host's UUID,
    does not follow the UUID-based NQN format laid out in the NVMe 1.3
    specification.  Remove the "NVMf:" portion of the NQN to match the spec.
    
    Signed-off-by: Daniel Verkamp <[email protected]>
    Reviewed-by: Max Gurtovoy <[email protected]>
    Signed-off-by: Christoph Hellwig <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    danielverkamp authored and gregkh committed Sep 13, 2017
    Configuration menu
    Copy the full SHA
    f52a535 View commit details
    Browse the repository at this point in the history
  14. btrfs: resume qgroup rescan on rw remount

    commit 6c6b5a3 upstream.
    
    Several distributions mount the "proper root" as ro during initrd and
    then remount it as rw before pivot_root(2). Thus, if a rescan had been
    aborted by a previous shutdown, the rescan would never be resumed.
    
    This issue would manifest itself as several btrfs ioctl(2)s causing the
    entire machine to hang when btrfs_qgroup_wait_for_completion was hit
    (due to the fs_info->qgroup_rescan_running flag being set but the rescan
    itself not being resumed). Notably, Docker's btrfs storage driver makes
    regular use of BTRFS_QUOTA_CTL_DISABLE and BTRFS_IOC_QUOTA_RESCAN_WAIT
    (causing this problem to be manifested on boot for some machines).
    
    Cc: Jeff Mahoney <[email protected]>
    Fixes: b382a32 ("Btrfs: fix qgroup rescan resume on mount")
    Signed-off-by: Aleksa Sarai <[email protected]>
    Reviewed-by: Nikolay Borisov <[email protected]>
    Tested-by: Nikolay Borisov <[email protected]>
    Signed-off-by: David Sterba <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    cyphar authored and gregkh committed Sep 13, 2017
    Configuration menu
    Copy the full SHA
    0f7dbc4 View commit details
    Browse the repository at this point in the history
  15. selftests/x86/fsgsbase: Test selectors 1, 2, and 3

    commit 23d98c2 upstream.
    
    Those are funny cases.  Make sure they work.
    
    (Something is screwy with signal handling if a selector is 1, 2, or 3.
    Anyone who wants to dive into that rabbit hole is welcome to do so.)
    
    Signed-off-by: Andy Lutomirski <[email protected]>
    Cc: Borislav Petkov <[email protected]>
    Cc: Borislav Petkov <[email protected]>
    Cc: Brian Gerst <[email protected]>
    Cc: Chang Seok <[email protected]>
    Cc: Denys Vlasenko <[email protected]>
    Cc: H. Peter Anvin <[email protected]>
    Cc: Josh Poimboeuf <[email protected]>
    Cc: Linus Torvalds <[email protected]>
    Cc: Peter Zijlstra <[email protected]>
    Cc: Thomas Gleixner <[email protected]>
    Signed-off-by: Ingo Molnar <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    amluto authored and gregkh committed Sep 13, 2017
    Configuration menu
    Copy the full SHA
    ebf381b View commit details
    Browse the repository at this point in the history
  16. mm/memory.c: fix mem_cgroup_oom_disable() call missing

    commit de0c799 upstream.
    
    Seen while reading the code, in handle_mm_fault(), in the case
    arch_vma_access_permitted() is failing the call to
    mem_cgroup_oom_disable() is not made.
    
    To fix that, move the call to mem_cgroup_oom_enable() after calling
    arch_vma_access_permitted() as it should not have entered the memcg OOM.
    
    Link: http://lkml.kernel.org/r/[email protected]
    Fixes: bae473a ("mm: introduce fault_env")
    Signed-off-by: Laurent Dufour <[email protected]>
    Acked-by: Kirill A. Shutemov <[email protected]>
    Acked-by: Michal Hocko <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Laurent Dufour authored and gregkh committed Sep 13, 2017
    Configuration menu
    Copy the full SHA
    3c8381d View commit details
    Browse the repository at this point in the history
  17. locktorture: Fix potential memory leak with rw lock test

    commit f4dbba5 upstream.
    
    When running locktorture module with the below commands with kmemleak enabled:
    
    $ modprobe locktorture torture_type=rw_lock_irq
    $ rmmod locktorture
    
    The below kmemleak got caught:
    
    root@10:~# echo scan > /sys/kernel/debug/kmemleak
    [  323.197029] kmemleak: 2 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
    root@10:~# cat /sys/kernel/debug/kmemleak
    unreferenced object 0xffffffc07592d500 (size 128):
      comm "modprobe", pid 368, jiffies 4294924118 (age 205.824s)
      hex dump (first 32 bytes):
        00 00 00 00 00 00 00 00 c3 7b 02 00 00 00 00 00  .........{......
        00 00 00 00 00 00 00 00 d7 9b 02 00 00 00 00 00  ................
      backtrace:
        [<ffffff80081e5a88>] create_object+0x110/0x288
        [<ffffff80086c6078>] kmemleak_alloc+0x58/0xa0
        [<ffffff80081d5acc>] __kmalloc+0x234/0x318
        [<ffffff80006fa130>] 0xffffff80006fa130
        [<ffffff8008083ae4>] do_one_initcall+0x44/0x138
        [<ffffff800817e28c>] do_init_module+0x68/0x1cc
        [<ffffff800811c848>] load_module+0x1a68/0x22e0
        [<ffffff800811d340>] SyS_finit_module+0xe0/0xf0
        [<ffffff80080836f0>] el0_svc_naked+0x24/0x28
        [<ffffffffffffffff>] 0xffffffffffffffff
    unreferenced object 0xffffffc07592d480 (size 128):
      comm "modprobe", pid 368, jiffies 4294924118 (age 205.824s)
      hex dump (first 32 bytes):
        00 00 00 00 00 00 00 00 3b 6f 01 00 00 00 00 00  ........;o......
        00 00 00 00 00 00 00 00 23 6a 01 00 00 00 00 00  ........#j......
      backtrace:
        [<ffffff80081e5a88>] create_object+0x110/0x288
        [<ffffff80086c6078>] kmemleak_alloc+0x58/0xa0
        [<ffffff80081d5acc>] __kmalloc+0x234/0x318
        [<ffffff80006fa22c>] 0xffffff80006fa22c
        [<ffffff8008083ae4>] do_one_initcall+0x44/0x138
        [<ffffff800817e28c>] do_init_module+0x68/0x1cc
        [<ffffff800811c848>] load_module+0x1a68/0x22e0
        [<ffffff800811d340>] SyS_finit_module+0xe0/0xf0
        [<ffffff80080836f0>] el0_svc_naked+0x24/0x28
        [<ffffffffffffffff>] 0xffffffffffffffff
    
    It is because cxt.lwsa and cxt.lrsa don't get freed in module_exit, so free
    them in lock_torture_cleanup() and free writer_tasks if reader_tasks is
    failed at memory allocation.
    
    Signed-off-by: Yang Shi <[email protected]>
    Signed-off-by: Paul E. McKenney <[email protected]>
    Reviewed-by: Josh Triplett <[email protected]>
    Cc: 石洋 <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Yang Shi authored and gregkh committed Sep 13, 2017
    Configuration menu
    Copy the full SHA
    d21f3ea View commit details
    Browse the repository at this point in the history
  18. ALSA: msnd: Optimize / harden DSP and MIDI loops

    commit 20e2b79 upstream.
    
    The ISA msnd drivers have loops fetching the ring-buffer head, tail
    and size values inside the loops.  Such codes are inefficient and
    fragile.
    
    This patch optimizes it, and also adds the sanity check to avoid the
    endless loops.
    
    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=196131
    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=196133
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: grygorii tertychnyi <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    tiwai authored and gregkh committed Sep 13, 2017
    Configuration menu
    Copy the full SHA
    03bea51 View commit details
    Browse the repository at this point in the history
  19. Bluetooth: Properly check L2CAP config option output buffer length

    commit e860d2c upstream.
    
    Validate the output buffer length for L2CAP config requests and responses
    to avoid overflowing the stack buffer used for building the option blocks.
    
    Signed-off-by: Ben Seri <[email protected]>
    Signed-off-by: Marcel Holtmann <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    benseri87 authored and gregkh committed Sep 13, 2017
    Configuration menu
    Copy the full SHA
    6300c8b View commit details
    Browse the repository at this point in the history
  20. ARM64: dts: marvell: armada-37xx: Fix GIC maintenance interrupt

    commit 95696d2 upstream.
    
    The GIC-500 integrated in the Armada-37xx SoCs is compliant with
    the GICv3 architecture, and thus provides a maintenance interrupt
    that is required for hypervisors to function correctly.
    
    With the interrupt provided in the DT, KVM now works as it should.
    Tested on an Espressobin system.
    
    Fixes: adbc369 ("arm64: dts: add the Marvell Armada 3700 family and a development board")
    Signed-off-by: Marc Zyngier <[email protected]>
    Signed-off-by: Gregory CLEMENT <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Marc Zyngier authored and gregkh committed Sep 13, 2017
    Configuration menu
    Copy the full SHA
    b40aa8b View commit details
    Browse the repository at this point in the history
  21. ARM: 8692/1: mm: abort uaccess retries upon fatal signal

    commit 746a272 upstream.
    
    When there's a fatal signal pending, arm's do_page_fault()
    implementation returns 0. The intent is that we'll return to the
    faulting userspace instruction, delivering the signal on the way.
    
    However, if we take a fatal signal during fixing up a uaccess, this
    results in a return to the faulting kernel instruction, which will be
    instantly retried, resulting in the same fault being taken forever. As
    the task never reaches userspace, the signal is not delivered, and the
    task is left unkillable. While the task is stuck in this state, it can
    inhibit the forward progress of the system.
    
    To avoid this, we must ensure that when a fatal signal is pending, we
    apply any necessary fixup for a faulting kernel instruction. Thus we
    will return to an error path, and it is up to that code to make forward
    progress towards delivering the fatal signal.
    
    Signed-off-by: Mark Rutland <[email protected]>
    Reviewed-by: Steve Capper <[email protected]>
    Signed-off-by: Russell King <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Mark Rutland authored and gregkh committed Sep 13, 2017
    Configuration menu
    Copy the full SHA
    301d91e View commit details
    Browse the repository at this point in the history
  22. NFS: Fix 2 use after free issues in the I/O code

    commit 196639e upstream.
    
    The writeback code wants to send a commit after processing the pages,
    which is why we want to delay releasing the struct path until after
    that's done.
    
    Also, the layout code expects that we do not free the inode before
    we've put the layout segments in pnfs_writehdr_free() and
    pnfs_readhdr_free()
    
    Fixes: 919e3bd ("NFS: Ensure we commit after writeback is complete")
    Fixes: 4714fb5 ("nfs: remove pgio_header refcount, related cleanup")
    Signed-off-by: Trond Myklebust <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    trondmypd authored and gregkh committed Sep 13, 2017
    Configuration menu
    Copy the full SHA
    a70912a View commit details
    Browse the repository at this point in the history
  23. NFS: Sync the correct byte range during synchronous writes

    commit e973b1a upstream.
    
    Since commit 1829065 ("NFS: Move buffered I/O locking into
    nfs_file_write()") nfs_file_write() has not flushed the correct byte
    range during synchronous writes.  generic_write_sync() expects that
    iocb->ki_pos points to the right edge of the range rather than the
    left edge.
    
    To replicate the problem, open a file with O_DSYNC, have the client
    write at increasing offsets, and then print the successful offsets.
    Block port 2049 partway through that sequence, and observe that the
    client application indicates successful writes in advance of what the
    server received.
    
    Fixes: 1829065 ("NFS: Move buffered I/O locking into nfs_file_write()")
    Signed-off-by: Jacob Strauss <[email protected]>
    Signed-off-by: Tarang Gupta <[email protected]>
    Tested-by: Tarang Gupta <[email protected]>
    Signed-off-by: Trond Myklebust <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    [email protected] authored and gregkh committed Sep 13, 2017
    Configuration menu
    Copy the full SHA
    3885bc6 View commit details
    Browse the repository at this point in the history
  24. xfs: XFS_IS_REALTIME_INODE() should be false if no rt device present

    commit b31ff3c upstream.
    
    If using a kernel with CONFIG_XFS_RT=y and we set the RHINHERIT flag on
    a directory in a filesystem that does not have a realtime device and
    create a new file in that directory, it gets marked as a real time file.
    When data is written and a fsync is issued, the filesystem attempts to
    flush a non-existent rt device during the fsync process.
    
    This results in a crash dereferencing a null buftarg pointer in
    xfs_blkdev_issue_flush():
    
      BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
      IP: xfs_blkdev_issue_flush+0xd/0x20
      .....
      Call Trace:
        xfs_file_fsync+0x188/0x1c0
        vfs_fsync_range+0x3b/0xa0
        do_fsync+0x3d/0x70
        SyS_fsync+0x10/0x20
        do_syscall_64+0x4d/0xb0
        entry_SYSCALL64_slow_path+0x25/0x25
    
    Setting RT inode flags does not require special privileges so any
    unprivileged user can cause this oops to occur.  To reproduce, confirm
    kernel is compiled with CONFIG_XFS_RT=y and run:
    
      # mkfs.xfs -f /dev/pmem0
      # mount /dev/pmem0 /mnt/test
      # mkdir /mnt/test/foo
      # xfs_io -c 'chattr +t' /mnt/test/foo
      # xfs_io -f -c 'pwrite 0 5m' -c fsync /mnt/test/foo/bar
    
    Or just run xfstests with MKFS_OPTIONS="-d rtinherit=1" and wait.
    
    Kernels built with CONFIG_XFS_RT=n are not exposed to this bug.
    
    Fixes: f538d4d ("[XFS] write barrier support")
    Signed-off-by: Richard Wareing <[email protected]>
    Signed-off-by: Dave Chinner <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    RichWpg authored and gregkh committed Sep 13, 2017
    Configuration menu
    Copy the full SHA
    5b82e0e View commit details
    Browse the repository at this point in the history
  25. Linux 4.9.50

    gregkh committed Sep 13, 2017
    Configuration menu
    Copy the full SHA
    4ad5dca View commit details
    Browse the repository at this point in the history

Commits on Sep 14, 2017

  1. ARM: dts: at91: at91-sama5d27_som1: add eeprom device

    There is an EEPROM on at91-sama5d27_som1 connected to i2c0. i2c0 node
    has to be moved from at91-sama5d27_som1_ek to at91-sama5d27_som1.
    
    Signed-off-by: Ludovic Desroches <[email protected]>
    ldesroches committed Sep 14, 2017
    Configuration menu
    Copy the full SHA
    b0f5ecb View commit details
    Browse the repository at this point in the history

Commits on Sep 19, 2017

  1. atmel_flexcom: Support backup mode

    The controller used by a flexcom module is configured at boot, and left
    alone after this. As the configuration will be lost after backup mode,
    restore the state of the flexcom driver on resume.
    
    Signed-off-by: Romain Izard <[email protected]>
    romain-izard-pro authored and Nicolas Ferre committed Sep 19, 2017
    Configuration menu
    Copy the full SHA
    29e0fab View commit details
    Browse the repository at this point in the history
  2. tty/serial: atmel: Prevent a warning on suspend

    The atmel serial port driver reported the following warning on suspend:
    atmel_usart f8020000.serial: ttyS1: Unable to drain transmitter
    
    As the ATMEL_US_TXEMPTY status bit in ATMEL_US_CSR is always cleared
    when the transmitter is disabled, we need to know the transmitter's
    state to return the real fifo state. And as ATMEL_US_CR is write-only,
    it is necessary to save the state of the transmitter in a local
    variable, and update the variable when TXEN and TXDIS is written in
    ATMEL_US_CR.
    
    After those changes, atmel_tx_empty can return "empty" on suspend, the
    warning in uart_suspend_port disappears, and suspending is 20ms shorter
    for each enabled Atmel serial port.
    
    Signed-off-by: Romain Izard <[email protected]>
    romain-izard-pro authored and Nicolas Ferre committed Sep 19, 2017
    Configuration menu
    Copy the full SHA
    93a7976 View commit details
    Browse the repository at this point in the history

Commits on Sep 20, 2017

  1. ipv6: accept 64k - 1 packet length in ip6_find_1stfragopt()

    [ Upstream commit 3de33e1 ]
    
    A packet length of exactly IPV6_MAXPLEN is allowed, we should
    refuse parsing options only if the size is 64KiB or more.
    
    While at it, remove one extra variable and one assignment which
    were also introduced by the commit that introduced the size
    check. Checking the sum 'offset + len' and only later adding
    'len' to 'offset' doesn't provide any advantage over directly
    summing to 'offset' and checking it.
    
    Fixes: 6399f1f ("ipv6: avoid overflow of offset in ip6_find_1stfragopt")
    Signed-off-by: Stefano Brivio <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    sbrivio-rh authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    dccb31b View commit details
    Browse the repository at this point in the history
  2. ipv6: add rcu grace period before freeing fib6_node

    [ Upstream commit c5cff85 ]
    
    We currently keep rt->rt6i_node pointing to the fib6_node for the route.
    And some functions make use of this pointer to dereference the fib6_node
    from rt structure, e.g. rt6_check(). However, as there is neither
    refcount nor rcu taken when dereferencing rt->rt6i_node, it could
    potentially cause crashes as rt->rt6i_node could be set to NULL by other
    CPUs when doing a route deletion.
    This patch introduces an rcu grace period before freeing fib6_node and
    makes sure the functions that dereference it takes rcu_read_lock().
    
    Note: there is no "Fixes" tag because this bug was there in a very
    early stage.
    
    Signed-off-by: Wei Wang <[email protected]>
    Acked-by: Eric Dumazet <[email protected]>
    Acked-by: Martin KaFai Lau <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    tracywwnj authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    7f8f23f View commit details
    Browse the repository at this point in the history
  3. ipv6: fix sparse warning on rt6i_node

    [ Upstream commit 4e587ea ]
    
    Commit c5cff85 adds rcu grace period before freeing fib6_node. This
    generates a new sparse warning on rt->rt6i_node related code:
      net/ipv6/route.c:1394:30: error: incompatible types in comparison
      expression (different address spaces)
      ./include/net/ip6_fib.h:187:14: error: incompatible types in comparison
      expression (different address spaces)
    
    This commit adds "__rcu" tag for rt6i_node and makes sure corresponding
    rcu API is used for it.
    After this fix, sparse no longer generates the above warning.
    
    Fixes: c5cff85 ("ipv6: add rcu grace period before freeing fib6_node")
    Signed-off-by: Wei Wang <[email protected]>
    Acked-by: Eric Dumazet <[email protected]>
    Acked-by: Martin KaFai Lau <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    tracywwnj authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    43c792a View commit details
    Browse the repository at this point in the history
  4. macsec: add genl family module alias

    [ Upstream commit 7836299 ]
    
    This helps tools such as wpa_supplicant can start even if the macsec
    module isn't loaded yet.
    
    Fixes: c09440f ("macsec: introduce IEEE 802.1AE driver")
    Signed-off-by: Sabrina Dubroca <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    qsn authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    4b4a194 View commit details
    Browse the repository at this point in the history
  5. udp: on peeking bad csum, drop packets even if not at head

    [ Upstream commit fd6055a ]
    
    When peeking, if a bad csum is discovered, the skb is unlinked from
    the queue with __sk_queue_drop_skb and the peek operation restarted.
    
    __sk_queue_drop_skb only drops packets that match the queue head.
    
    This fails if the skb was found after the head, using SO_PEEK_OFF
    socket option. This causes an infinite loop.
    
    We MUST drop this problematic skb, and we can simply check if skb was
    already removed by another thread, by looking at skb->next :
    
    This pointer is set to NULL by the  __skb_unlink() operation, that might
    have happened only under the spinlock protection.
    
    Many thanks to syzkaller team (and particularly Dmitry Vyukov who
    provided us nice C reproducers exhibiting the lockup) and Willem de
    Bruijn who provided first version for this patch and a test program.
    
    Fixes: 627d2d6 ("udp: enable MSG_PEEK at non-zero offset")
    Signed-off-by: Eric Dumazet <[email protected]>
    Reported-by: Dmitry Vyukov <[email protected]>
    Cc: Willem de Bruijn <[email protected]>
    Acked-by: Paolo Abeni <[email protected]>
    Acked-by: Willem de Bruijn <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Eric Dumazet authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    1e39e5c View commit details
    Browse the repository at this point in the history
  6. fsl/man: Inherit parent device and of_node

    [ Upstream commit a1a50c8 ]
    
    Junote Cai reported that he was not able to get a DSA setup involving the
    Freescale DPAA/FMAN driver to work and narrowed it down to
    of_find_net_device_by_node(). This function requires the network device's
    device reference to be correctly set which is the case here, though we have
    lost any device_node association there.
    
    The problem is that dpaa_eth_add_device() allocates a "dpaa-ethernet" platform
    device, and later on dpaa_eth_probe() is called but SET_NETDEV_DEV() won't be
    propagating &pdev->dev.of_node properly. Fix this by inherenting both the parent
    device and the of_node when dpaa_eth_add_device() creates the platform device.
    
    Fixes: 3933961 ("fsl/fman: Add FMan MAC driver")
    Signed-off-by: Florian Fainelli <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    ffainelli authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    4d8ee19 View commit details
    Browse the repository at this point in the history
  7. sctp: Avoid out-of-bounds reads from address storage

    [ Upstream commit ee6c88b ]
    
    inet_diag_msg_sctp{,l}addr_fill() and sctp_get_sctp_info() copy
    sizeof(sockaddr_storage) bytes to fill in sockaddr structs used
    to export diagnostic information to userspace.
    
    However, the memory allocated to store sockaddr information is
    smaller than that and depends on the address family, so we leak
    up to 100 uninitialized bytes to userspace. Just use the size of
    the source structs instead, in all the three cases this is what
    userspace expects. Zero out the remaining memory.
    
    Unused bytes (i.e. when IPv4 addresses are used) in source
    structs sctp_sockaddr_entry and sctp_transport are already
    cleared by sctp_add_bind_addr() and sctp_transport_new(),
    respectively.
    
    Noticed while testing KASAN-enabled kernel with 'ss':
    
    [ 2326.885243] BUG: KASAN: slab-out-of-bounds in inet_sctp_diag_fill+0x42c/0x6c0 [sctp_diag] at addr ffff881be8779800
    [ 2326.896800] Read of size 128 by task ss/9527
    [ 2326.901564] CPU: 0 PID: 9527 Comm: ss Not tainted 4.11.0-22.el7a.x86_64 linux4sam#1
    [ 2326.909236] Hardware name: Dell Inc. PowerEdge R730/072T6D, BIOS 2.4.3 01/17/2017
    [ 2326.917585] Call Trace:
    [ 2326.920312]  dump_stack+0x63/0x8d
    [ 2326.924014]  kasan_object_err+0x21/0x70
    [ 2326.928295]  kasan_report+0x288/0x540
    [ 2326.932380]  ? inet_sctp_diag_fill+0x42c/0x6c0 [sctp_diag]
    [ 2326.938500]  ? skb_put+0x8b/0xd0
    [ 2326.942098]  ? memset+0x31/0x40
    [ 2326.945599]  check_memory_region+0x13c/0x1a0
    [ 2326.950362]  memcpy+0x23/0x50
    [ 2326.953669]  inet_sctp_diag_fill+0x42c/0x6c0 [sctp_diag]
    [ 2326.959596]  ? inet_diag_msg_sctpasoc_fill+0x460/0x460 [sctp_diag]
    [ 2326.966495]  ? __lock_sock+0x102/0x150
    [ 2326.970671]  ? sock_def_wakeup+0x60/0x60
    [ 2326.975048]  ? remove_wait_queue+0xc0/0xc0
    [ 2326.979619]  sctp_diag_dump+0x44a/0x760 [sctp_diag]
    [ 2326.985063]  ? sctp_ep_dump+0x280/0x280 [sctp_diag]
    [ 2326.990504]  ? memset+0x31/0x40
    [ 2326.994007]  ? mutex_lock+0x12/0x40
    [ 2326.997900]  __inet_diag_dump+0x57/0xb0 [inet_diag]
    [ 2327.003340]  ? __sys_sendmsg+0x150/0x150
    [ 2327.007715]  inet_diag_dump+0x4d/0x80 [inet_diag]
    [ 2327.012979]  netlink_dump+0x1e6/0x490
    [ 2327.017064]  __netlink_dump_start+0x28e/0x2c0
    [ 2327.021924]  inet_diag_handler_cmd+0x189/0x1a0 [inet_diag]
    [ 2327.028045]  ? inet_diag_rcv_msg_compat+0x1b0/0x1b0 [inet_diag]
    [ 2327.034651]  ? inet_diag_dump_compat+0x190/0x190 [inet_diag]
    [ 2327.040965]  ? __netlink_lookup+0x1b9/0x260
    [ 2327.045631]  sock_diag_rcv_msg+0x18b/0x1e0
    [ 2327.050199]  netlink_rcv_skb+0x14b/0x180
    [ 2327.054574]  ? sock_diag_bind+0x60/0x60
    [ 2327.058850]  sock_diag_rcv+0x28/0x40
    [ 2327.062837]  netlink_unicast+0x2e7/0x3b0
    [ 2327.067212]  ? netlink_attachskb+0x330/0x330
    [ 2327.071975]  ? kasan_check_write+0x14/0x20
    [ 2327.076544]  netlink_sendmsg+0x5be/0x730
    [ 2327.080918]  ? netlink_unicast+0x3b0/0x3b0
    [ 2327.085486]  ? kasan_check_write+0x14/0x20
    [ 2327.090057]  ? selinux_socket_sendmsg+0x24/0x30
    [ 2327.095109]  ? netlink_unicast+0x3b0/0x3b0
    [ 2327.099678]  sock_sendmsg+0x74/0x80
    [ 2327.103567]  ___sys_sendmsg+0x520/0x530
    [ 2327.107844]  ? __get_locked_pte+0x178/0x200
    [ 2327.112510]  ? copy_msghdr_from_user+0x270/0x270
    [ 2327.117660]  ? vm_insert_page+0x360/0x360
    [ 2327.122133]  ? vm_insert_pfn_prot+0xb4/0x150
    [ 2327.126895]  ? vm_insert_pfn+0x32/0x40
    [ 2327.131077]  ? vvar_fault+0x71/0xd0
    [ 2327.134968]  ? special_mapping_fault+0x69/0x110
    [ 2327.140022]  ? __do_fault+0x42/0x120
    [ 2327.144008]  ? __handle_mm_fault+0x1062/0x17a0
    [ 2327.148965]  ? __fget_light+0xa7/0xc0
    [ 2327.153049]  __sys_sendmsg+0xcb/0x150
    [ 2327.157133]  ? __sys_sendmsg+0xcb/0x150
    [ 2327.161409]  ? SyS_shutdown+0x140/0x140
    [ 2327.165688]  ? exit_to_usermode_loop+0xd0/0xd0
    [ 2327.170646]  ? __do_page_fault+0x55d/0x620
    [ 2327.175216]  ? __sys_sendmsg+0x150/0x150
    [ 2327.179591]  SyS_sendmsg+0x12/0x20
    [ 2327.183384]  do_syscall_64+0xe3/0x230
    [ 2327.187471]  entry_SYSCALL64_slow_path+0x25/0x25
    [ 2327.192622] RIP: 0033:0x7f41d18fa3b0
    [ 2327.196608] RSP: 002b:00007ffc3b731218 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
    [ 2327.205055] RAX: ffffffffffffffda RBX: 00007ffc3b731380 RCX: 00007f41d18fa3b0
    [ 2327.213017] RDX: 0000000000000000 RSI: 00007ffc3b731340 RDI: 0000000000000003
    [ 2327.220978] RBP: 0000000000000002 R08: 0000000000000004 R09: 0000000000000040
    [ 2327.228939] R10: 00007ffc3b730f30 R11: 0000000000000246 R12: 0000000000000003
    [ 2327.236901] R13: 00007ffc3b731340 R14: 00007ffc3b7313d0 R15: 0000000000000084
    [ 2327.244865] Object at ffff881be87797e0, in cache kmalloc-64 size: 64
    [ 2327.251953] Allocated:
    [ 2327.254581] PID = 9484
    [ 2327.257215]  save_stack_trace+0x1b/0x20
    [ 2327.261485]  save_stack+0x46/0xd0
    [ 2327.265179]  kasan_kmalloc+0xad/0xe0
    [ 2327.269165]  kmem_cache_alloc_trace+0xe6/0x1d0
    [ 2327.274138]  sctp_add_bind_addr+0x58/0x180 [sctp]
    [ 2327.279400]  sctp_do_bind+0x208/0x310 [sctp]
    [ 2327.284176]  sctp_bind+0x61/0xa0 [sctp]
    [ 2327.288455]  inet_bind+0x5f/0x3a0
    [ 2327.292151]  SYSC_bind+0x1a4/0x1e0
    [ 2327.295944]  SyS_bind+0xe/0x10
    [ 2327.299349]  do_syscall_64+0xe3/0x230
    [ 2327.303433]  return_from_SYSCALL_64+0x0/0x6a
    [ 2327.308194] Freed:
    [ 2327.310434] PID = 4131
    [ 2327.313065]  save_stack_trace+0x1b/0x20
    [ 2327.317344]  save_stack+0x46/0xd0
    [ 2327.321040]  kasan_slab_free+0x73/0xc0
    [ 2327.325220]  kfree+0x96/0x1a0
    [ 2327.328530]  dynamic_kobj_release+0x15/0x40
    [ 2327.333195]  kobject_release+0x99/0x1e0
    [ 2327.337472]  kobject_put+0x38/0x70
    [ 2327.341266]  free_notes_attrs+0x66/0x80
    [ 2327.345545]  mod_sysfs_teardown+0x1a5/0x270
    [ 2327.350211]  free_module+0x20/0x2a0
    [ 2327.354099]  SyS_delete_module+0x2cb/0x2f0
    [ 2327.358667]  do_syscall_64+0xe3/0x230
    [ 2327.362750]  return_from_SYSCALL_64+0x0/0x6a
    [ 2327.367510] Memory state around the buggy address:
    [ 2327.372855]  ffff881be8779700: fc fc fc fc 00 00 00 00 00 00 00 00 fc fc fc fc
    [ 2327.380914]  ffff881be8779780: fb fb fb fb fb fb fb fb fc fc fc fc 00 00 00 00
    [ 2327.388972] >ffff881be8779800: 00 00 00 00 fc fc fc fc fb fb fb fb fb fb fb fb
    [ 2327.397031]                                ^
    [ 2327.401792]  ffff881be8779880: fc fc fc fc fb fb fb fb fb fb fb fb fc fc fc fc
    [ 2327.409850]  ffff881be8779900: 00 00 00 00 00 04 fc fc fc fc fc fc 00 00 00 00
    [ 2327.417907] ==================================================================
    
    This fixes CVE-2017-7558.
    
    References: https://bugzilla.redhat.com/show_bug.cgi?id=1480266
    Fixes: 8f840e4 ("sctp: add the sctp_diag.c file")
    Cc: Xin Long <[email protected]>
    Cc: Vlad Yasevich <[email protected]>
    Cc: Neil Horman <[email protected]>
    Signed-off-by: Stefano Brivio <[email protected]>
    Acked-by: Marcelo Ricardo Leitner <[email protected]>
    Reviewed-by: Xin Long <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    sbrivio-rh authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    08d56d8 View commit details
    Browse the repository at this point in the history
  8. qlge: avoid memcpy buffer overflow

    [ Upstream commit e58f958 ]
    
    gcc-8.0.0 (snapshot) points out that we copy a variable-length string
    into a fixed length field using memcpy() with the destination length,
    and that ends up copying whatever follows the string:
    
        inlined from 'ql_core_dump' at drivers/net/ethernet/qlogic/qlge/qlge_dbg.c:1106:2:
    drivers/net/ethernet/qlogic/qlge/qlge_dbg.c:708:2: error: 'memcpy' reading 15 bytes from a region of size 14 [-Werror=stringop-overflow=]
      memcpy(seg_hdr->description, desc, (sizeof(seg_hdr->description)) - 1);
    
    Changing it to use strncpy() will instead zero-pad the destination,
    which seems to be the right thing to do here.
    
    The bug is probably harmless, but it seems like a good idea to address
    it in stable kernels as well, if only for the purpose of building with
    gcc-8 without warnings.
    
    Fixes: a61f802 ("qlge: Add ethtool register dump function.")
    Signed-off-by: Arnd Bergmann <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    arndb authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    64dfc67 View commit details
    Browse the repository at this point in the history
  9. netvsc: fix deadlock betwen link status and removal

    [ Upstream commit 9b4e946 ]
    
    There is a deadlock possible when canceling the link status
    delayed work queue. The removal process is run with RTNL held,
    and the link status callback is acquring RTNL.
    
    Resolve the issue by using trylock and rescheduling.
    If cancel is in process, that block it from happening.
    
    Fixes: 122a5f6 ("staging: hv: use delayed_work for netvsc_send_garp()")
    Signed-off-by: Stephen Hemminger <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    shemminger authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    de2ecec View commit details
    Browse the repository at this point in the history
  10. cxgb4: Fix stack out-of-bounds read due to wrong size to t4_record_mb…

    …ox()
    
    [ Upstream commit 0f30868 ]
    
    Passing commands for logging to t4_record_mbox() with size
    MBOX_LEN, when the actual command size is actually smaller,
    causes out-of-bounds stack accesses in t4_record_mbox() while
    copying command words here:
    
    	for (i = 0; i < size / 8; i++)
    		entry->cmd[i] = be64_to_cpu(cmd[i]);
    
    Up to 48 bytes from the stack are then leaked to debugfs.
    
    This happens whenever we send (and log) commands described by
    structs fw_sched_cmd (32 bytes leaked), fw_vi_rxmode_cmd (48),
    fw_hello_cmd (48), fw_bye_cmd (48), fw_initialize_cmd (48),
    fw_reset_cmd (48), fw_pfvf_cmd (32), fw_eq_eth_cmd (16),
    fw_eq_ctrl_cmd (32), fw_eq_ofld_cmd (32), fw_acl_mac_cmd(16),
    fw_rss_glb_config_cmd(32), fw_rss_vi_config_cmd(32),
    fw_devlog_cmd(32), fw_vi_enable_cmd(48), fw_port_cmd(32),
    fw_sched_cmd(32), fw_devlog_cmd(32).
    
    The cxgb4vf driver got this right instead.
    
    When we call t4_record_mbox() to log a command reply, a MBOX_LEN
    size can be used though, as get_mbox_rpl() will fill cmd_rpl up
    completely.
    
    Fixes: 7f080c3 ("cxgb4: Add support to enable logging of firmware mailbox commands")
    Signed-off-by: Stefano Brivio <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    sbrivio-rh authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    2b3bd59 View commit details
    Browse the repository at this point in the history
  11. packet: Don't write vnet header beyond end of buffer

    [ Upstream commit edbd58b ]
    
    ... which may happen with certain values of tp_reserve and maclen.
    
    Fixes: 58d19b1 ("packet: vnet_hdr support for tpacket_rcv")
    Signed-off-by: Benjamin Poirier <[email protected]>
    Cc: Willem de Bruijn <[email protected]>
    Acked-by: Willem de Bruijn <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    gobenji authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    8c623e5 View commit details
    Browse the repository at this point in the history
  12. kcm: do not attach PF_KCM sockets to avoid deadlock

    [ Upstream commit 351050e ]
    
    syzkaller had no problem to trigger a deadlock, attaching a KCM socket
    to another one (or itself). (original syzkaller report was a very
    confusing lockdep splat during a sendmsg())
    
    It seems KCM claims to only support TCP, but no enforcement is done,
    so we might need to add additional checks.
    
    Fixes: ab7ac4e ("kcm: Kernel Connection Multiplexor module")
    Signed-off-by: Eric Dumazet <[email protected]>
    Reported-by: Dmitry Vyukov <[email protected]>
    Acked-by: Tom Herbert <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Eric Dumazet authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    af33da0 View commit details
    Browse the repository at this point in the history
  13. Revert "net: phy: Correctly process PHY_HALTED in phy_stop_machine()"

    [ Upstream commit ebc8254 ]
    
    This reverts commit 7ad813f ("net: phy:
    Correctly process PHY_HALTED in phy_stop_machine()") because it is
    creating the possibility for a NULL pointer dereference.
    
    David Daney provide the following call trace and diagram of events:
    
    When ndo_stop() is called we call:
    
     phy_disconnect()
        +---> phy_stop_interrupts() implies: phydev->irq = PHY_POLL;
        +---> phy_stop_machine()
        |      +---> phy_state_machine()
        |              +----> queue_delayed_work(): Work queued.
        +--->phy_detach() implies: phydev->attached_dev = NULL;
    
    Now at a later time the queued work does:
    
     phy_state_machine()
        +---->netif_carrier_off(phydev->attached_dev): Oh no! It is NULL:
    
     CPU 12 Unable to handle kernel paging request at virtual address
    0000000000000048, epc == ffffffff80de37ec, ra == ffffffff80c7c
    Oops[linux4sam#1]:
    CPU: 12 PID: 1502 Comm: kworker/12:1 Not tainted 4.9.43-Cavium-Octeon+ linux4sam#1
    Workqueue: events_power_efficient phy_state_machine
    task: 80000004021ed100 task.stack: 8000000409d70000
    $ 0   : 0000000000000000 ffffffff84720060 0000000000000048 0000000000000004
    $ 4   : 0000000000000000 0000000000000001 0000000000000004 0000000000000000
    $ 8   : 0000000000000000 0000000000000000 00000000ffff98f3 0000000000000000
    $12   : 8000000409d73fe0 0000000000009c00 ffffffff846547c8 000000000000af3b
    $16   : 80000004096bab68 80000004096babd0 0000000000000000 80000004096ba800
    $20   : 0000000000000000 0000000000000000 ffffffff81090000 0000000000000008
    $24   : 0000000000000061 ffffffff808637b0
    $28   : 8000000409d70000 8000000409d73cf0 80000000271bd300 ffffffff80c7804c
    Hi    : 000000000000002a
    Lo    : 000000000000003f
    epc   : ffffffff80de37ec netif_carrier_off+0xc/0x58
    ra    : ffffffff80c7804c phy_state_machine+0x48c/0x4f8
    Status: 14009ce3        KX SX UX KERNEL EXL IE
    Cause : 00800008 (ExcCode 02)
    BadVA : 0000000000000048
    PrId  : 000d9501 (Cavium Octeon III)
    Modules linked in:
    Process kworker/12:1 (pid: 1502, threadinfo=8000000409d70000,
    task=80000004021ed100, tls=0000000000000000)
    Stack : 8000000409a54000 80000004096bab68 80000000271bd300 80000000271c1e00
            0000000000000000 ffffffff808a1708 8000000409a54000 80000000271bd300
            80000000271bd320 8000000409a54030 ffffffff80ff0f00 0000000000000001
            ffffffff81090000 ffffffff808a1ac0 8000000402182080 ffffffff84650000
            8000000402182080 ffffffff84650000 ffffffff80ff0000 8000000409a54000
            ffffffff808a1970 0000000000000000 80000004099e8000 8000000402099240
            0000000000000000 ffffffff808a8598 0000000000000000 8000000408eeeb00
            8000000409a54000 00000000810a1d00 0000000000000000 8000000409d73de8
            8000000409d73de8 0000000000000088 000000000c009c00 8000000409d73e08
            8000000409d73e08 8000000402182080 ffffffff808a84d0 8000000402182080
            ...
    Call Trace:
    [<ffffffff80de37ec>] netif_carrier_off+0xc/0x58
    [<ffffffff80c7804c>] phy_state_machine+0x48c/0x4f8
    [<ffffffff808a1708>] process_one_work+0x158/0x368
    [<ffffffff808a1ac0>] worker_thread+0x150/0x4c0
    [<ffffffff808a8598>] kthread+0xc8/0xe0
    [<ffffffff808617f0>] ret_from_kernel_thread+0x14/0x1c
    
    The original motivation for this change originated from Marc Gonzales
    indicating that his network driver did not have its adjust_link callback
    executing with phydev->link = 0 while he was expecting it.
    
    PHYLIB has never made any such guarantees ever because phy_stop() merely just
    tells the workqueue to move into PHY_HALTED state which will happen
    asynchronously.
    
    Reported-by: Geert Uytterhoeven <[email protected]>
    Reported-by: David Daney <[email protected]>
    Fixes: 7ad813f ("net: phy: Correctly process PHY_HALTED in phy_stop_machine()")
    Signed-off-by: Florian Fainelli <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    ffainelli authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    a6e51fd View commit details
    Browse the repository at this point in the history
  14. tcp: initialize rcv_mss to TCP_MIN_MSS instead of 0

    [ Upstream commit 499350a ]
    
    When tcp_disconnect() is called, inet_csk_delack_init() sets
    icsk->icsk_ack.rcv_mss to 0.
    This could potentially cause tcp_recvmsg() => tcp_cleanup_rbuf() =>
    __tcp_select_window() call path to have division by 0 issue.
    So this patch initializes rcv_mss to TCP_MIN_MSS instead of 0.
    
    Reported-by: Andrey Konovalov  <[email protected]>
    Signed-off-by: Wei Wang <[email protected]>
    Signed-off-by: Eric Dumazet <[email protected]>
    Signed-off-by: Neal Cardwell <[email protected]>
    Signed-off-by: Yuchung Cheng <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    tracywwnj authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    a10c510 View commit details
    Browse the repository at this point in the history
  15. mlxsw: spectrum: Forbid linking to devices that have uppers

    [ Upstream commit 25cc72a ]
    
    The mlxsw driver relies on NETDEV_CHANGEUPPER events to configure the
    device in case a port is enslaved to a master netdev such as bridge or
    bond.
    
    Since the driver ignores events unrelated to its ports and their
    uppers, it's possible to engineer situations in which the device's data
    path differs from the kernel's.
    
    One example to such a situation is when a port is enslaved to a bond
    that is already enslaved to a bridge. When the bond was enslaved the
    driver ignored the event - as the bond wasn't one of its uppers - and
    therefore a bridge port instance isn't created in the device.
    
    Until such configurations are supported forbid them by checking that the
    upper device doesn't have uppers of its own.
    
    Fixes: 0d65fc1 ("mlxsw: spectrum: Implement LAG port join/leave")
    Signed-off-by: Ido Schimmel <[email protected]>
    Reported-by: Nogah Frankel <[email protected]>
    Tested-by: Nogah Frankel <[email protected]>
    Signed-off-by: Jiri Pirko <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    idosch authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    73ee5a7 View commit details
    Browse the repository at this point in the history
  16. bridge: switchdev: Clear forward mark when transmitting packet

    [ Upstream commit 79e99bd ]
    
    Commit 6bc506b ("bridge: switchdev: Add forward mark support for
    stacked devices") added the 'offload_fwd_mark' bit to the skb in order
    to allow drivers to indicate to the bridge driver that they already
    forwarded the packet in L2.
    
    In case the bit is set, before transmitting the packet from each port,
    the port's mark is compared with the mark stored in the skb's control
    block. If both marks are equal, we know the packet arrived from a switch
    device that already forwarded the packet and it's not re-transmitted.
    
    However, if the packet is transmitted from the bridge device itself
    (e.g., br0), we should clear the 'offload_fwd_mark' bit as the mark
    stored in the skb's control block isn't valid.
    
    This scenario can happen in rare cases where a packet was trapped during
    L3 forwarding and forwarded by the kernel to a bridge device.
    
    Fixes: 6bc506b ("bridge: switchdev: Add forward mark support for stacked devices")
    Signed-off-by: Ido Schimmel <[email protected]>
    Reported-by: Yotam Gigi <[email protected]>
    Tested-by: Yotam Gigi <[email protected]>
    Reviewed-by: Jiri Pirko <[email protected]>
    Acked-by: Nikolay Aleksandrov <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    idosch authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    b5a3ae8 View commit details
    Browse the repository at this point in the history
  17. Revert "net: use lib/percpu_counter API for fragmentation mem account…

    …ing"
    
    [ Upstream commit fb452a1 ]
    
    This reverts commit 6d7b857.
    
    There is a bug in fragmentation codes use of the percpu_counter API,
    that can cause issues on systems with many CPUs.
    
    The frag_mem_limit() just reads the global counter (fbc->count),
    without considering other CPUs can have upto batch size (130K) that
    haven't been subtracted yet.  Due to the 3MBytes lower thresh limit,
    this become dangerous at >=24 CPUs (3*1024*1024/130000=24).
    
    The correct API usage would be to use __percpu_counter_compare() which
    does the right thing, and takes into account the number of (online)
    CPUs and batch size, to account for this and call __percpu_counter_sum()
    when needed.
    
    We choose to revert the use of the lib/percpu_counter API for frag
    memory accounting for several reasons:
    
    1) On systems with CPUs > 24, the heavier fully locked
       __percpu_counter_sum() is always invoked, which will be more
       expensive than the atomic_t that is reverted to.
    
    Given systems with more than 24 CPUs are becoming common this doesn't
    seem like a good option.  To mitigate this, the batch size could be
    decreased and thresh be increased.
    
    2) The add_frag_mem_limit+sub_frag_mem_limit pairs happen on the RX
       CPU, before SKBs are pushed into sockets on remote CPUs.  Given
       NICs can only hash on L2 part of the IP-header, the NIC-RXq's will
       likely be limited.  Thus, a fair chance that atomic add+dec happen
       on the same CPU.
    
    Revert note that commit 1d6119b ("net: fix percpu memory leaks")
    removed init_frag_mem_limit() and instead use inet_frags_init_net().
    After this revert, inet_frags_uninit_net() becomes empty.
    
    Fixes: 6d7b857 ("net: use lib/percpu_counter API for fragmentation mem accounting")
    Fixes: 1d6119b ("net: fix percpu memory leaks")
    Signed-off-by: Jesper Dangaard Brouer <[email protected]>
    Acked-by: Florian Westphal <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    netoptimizer authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    5a7a40b View commit details
    Browse the repository at this point in the history
  18. Revert "net: fix percpu memory leaks"

    [ Upstream commit 5a63643 ]
    
    This reverts commit 1d6119b.
    
    After reverting commit 6d7b857 ("net: use lib/percpu_counter API
    for fragmentation mem accounting") then here is no need for this
    fix-up patch.  As percpu_counter is no longer used, it cannot
    memory leak it any-longer.
    
    Fixes: 6d7b857 ("net: use lib/percpu_counter API for fragmentation mem accounting")
    Fixes: 1d6119b ("net: fix percpu memory leaks")
    Signed-off-by: Jesper Dangaard Brouer <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    netoptimizer authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    1bcf187 View commit details
    Browse the repository at this point in the history
  19. gianfar: Fix Tx flow control deactivation

    [ Upstream commit 5d62167 ]
    
    The wrong register is checked for the Tx flow control bit,
    it should have been maccfg1 not maccfg2.
    This went unnoticed for so long probably because the impact is
    hardly visible, not to mention the tangled code from adjust_link().
    First, link flow control (i.e. handling of Rx/Tx link level pause frames)
    is disabled by default (needs to be enabled via 'ethtool -A').
    Secondly, maccfg2 always returns 0 for tx_flow_oldval (except for a few
    old boards), which results in Tx flow control remaining always on
    once activated.
    
    Fixes: 45b679c ("gianfar: Implement PAUSE frame generation support")
    Signed-off-by: Claudiu Manoil <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    claudiu-m authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    90406e6 View commit details
    Browse the repository at this point in the history
  20. vhost_net: correctly check tx avail during rx busy polling

    [ Upstream commit 8b949be ]
    
    We check tx avail through vhost_enable_notify() in the past which is
    wrong since it only checks whether or not guest has filled more
    available buffer since last avail idx synchronization which was just
    done by vhost_vq_avail_empty() before. What we really want is checking
    pending buffers in the avail ring. Fix this by calling
    vhost_vq_avail_empty() instead.
    
    This issue could be noticed by doing netperf TCP_RR benchmark as
    client from guest (but not host). With this fix, TCP_RR from guest to
    localhost restores from 1375.91 trans per sec to 55235.28 trans per
    sec on my laptop (Intel(R) Core(TM) i7-5600U CPU @ 2.60GHz).
    
    Fixes: 0308813 ("vhost_net: basic polling support")
    Signed-off-by: Jason Wang <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    jasowang authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    f5755c0 View commit details
    Browse the repository at this point in the history
  21. ip6_gre: update mtu properly in ip6gre_err

    [ Upstream commit 5c25f30 ]
    
    Now when probessing ICMPV6_PKT_TOOBIG, ip6gre_err only subtracts the
    offset of gre header from mtu info. The expected mtu of gre device
    should also subtract gre header. Otherwise, the next packets still
    can't be sent out.
    
    Jianlin found this issue when using the topo:
      client(ip6gre)<---->(nic1)route(nic2)<----->(ip6gre)server
    
    and reducing nic2's mtu, then both tcp and sctp's performance with
    big size data became 0.
    
    This patch is to fix it by also subtracting grehdr (tun->tun_hlen)
    from mtu info when updating gre device's mtu in ip6gre_err(). It
    also needs to subtract ETH_HLEN if gre dev'type is ARPHRD_ETHER.
    
    Reported-by: Jianlin Shi <[email protected]>
    Signed-off-by: Xin Long <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    lxin authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    ca7d8a3 View commit details
    Browse the repository at this point in the history
  22. ipv6: fix memory leak with multiple tables during netns destruction

    [ Upstream commit ba1cc08 ]
    
    fib6_net_exit only frees the main and local tables. If another table was
    created with fib6_alloc_table, we leak it when the netns is destroyed.
    
    Fix this in the same way ip_fib_net_exit cleans up tables, by walking
    through the whole hashtable of fib6_table's. We can get rid of the
    special cases for local and main, since they're also part of the
    hashtable.
    
    Reproducer:
        ip netns add x
        ip -net x -6 rule add from 6003:1::/64 table 100
        ip netns del x
    
    Reported-by: Jianlin Shi <[email protected]>
    Fixes: 58f09b7 ("[NETNS][IPV6] ip6_fib - make it per network namespace")
    Signed-off-by: Sabrina Dubroca <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    qsn authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    c9335db View commit details
    Browse the repository at this point in the history
  23. ipv6: fix typo in fib6_net_exit()

    [ Upstream commit 32a805b ]
    
    IPv6 FIB should use FIB6_TABLE_HASHSZ, not FIB_TABLE_HASHSZ.
    
    Fixes: ba1cc08 ("ipv6: fix memory leak with multiple tables during netns destruction")
    Signed-off-by: Eric Dumazet <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Eric Dumazet authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    bf8ed95 View commit details
    Browse the repository at this point in the history
  24. sctp: fix missing wake ups in some situations

    [ Upstream commit 7906b00 ]
    
    Commit fb586f2 ("sctp: delay calls to sk_data_ready() as much as
    possible") minimized the number of wake ups that are triggered in case
    the association receives a packet with multiple data chunks on it and/or
    when io_events are enabled and then commit 0970f5b ("sctp: signal
    sk_data_ready earlier on data chunks reception") moved the wake up to as
    soon as possible. It thus relies on the state machine running later to
    clean the flag that the event was already generated.
    
    The issue is that there are 2 call paths that calls
    sctp_ulpq_tail_event() outside of the state machine, causing the flag to
    linger and possibly omitting a needed wake up in the sequence.
    
    One of the call paths is when enabling SCTP_SENDER_DRY_EVENTS via
    setsockopt(SCTP_EVENTS), as noticed by Harald Welte. The other is when
    partial reliability triggers removal of chunks from the send queue when
    the application calls sendmsg().
    
    This commit fixes it by not setting the flag in case the socket is not
    owned by the user, as it won't be cleaned later. This works for
    user-initiated calls and also for rx path processing.
    
    Fixes: fb586f2 ("sctp: delay calls to sk_data_ready() as much as possible")
    Reported-by: Harald Welte <[email protected]>
    Signed-off-by: Marcelo Ricardo Leitner <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    marceloleitner authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    3f60dad View commit details
    Browse the repository at this point in the history
  25. ip_tunnel: fix setting ttl and tos value in collect_md mode

    [ Upstream commit 0f693f1 ]
    
    ttl and tos variables are declared and assigned, but are not used in
    iptunnel_xmit() function.
    
    Fixes: cfc7381 ("ip_tunnel: add collect_md mode to IPIP tunnel")
    Cc: Alexei Starovoitov <[email protected]>
    Signed-off-by: Haishuang Yan <[email protected]>
    Acked-by: Alexei Starovoitov <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Haishuang Yan authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    60b9412 View commit details
    Browse the repository at this point in the history
  26. f2fs: let fill_super handle roll-forward errors

    commit afd2b4d upstream.
    
    If we set CP_ERROR_FLAG in roll-forward error, f2fs is no longer to proceed
    any IOs due to f2fs_cp_error(). But, for example, if some stale data is involved
    on roll-forward process, we're able to get -ENOENT, getting fs stuck.
    If we get any error, let fill_super set SBI_NEED_FSCK and try to recover back
    to stable point.
    
    Reviewed-by: Chao Yu <[email protected]>
    Signed-off-by: Jaegeuk Kim <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Jaegeuk Kim authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    0f90297 View commit details
    Browse the repository at this point in the history
  27. f2fs: check hot_data for roll-forward recovery

    commit 125c9fb upstream.
    
    We need to check HOT_DATA to truncate any previous data block when doing
    roll-forward recovery.
    
    Reviewed-by: Chao Yu <[email protected]>
    Signed-off-by: Jaegeuk Kim <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Jaegeuk Kim authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    cc9618c View commit details
    Browse the repository at this point in the history
  28. x86/fsgsbase/64: Fully initialize FS and GS state in start_thread_common

    commit 767d035 upstream.
    
    execve used to leak FSBASE and GSBASE on AMD CPUs.  Fix it.
    
    The security impact of this bug is small but not quite zero -- it
    could weaken ASLR when a privileged task execs a less privileged
    program, but only if program changed bitness across the exec, or the
    child binary was highly unusual or actively malicious.  A child
    program that was compromised after the exec would not have access to
    the leaked base.
    
    Signed-off-by: Andy Lutomirski <[email protected]>
    Cc: Borislav Petkov <[email protected]>
    Cc: Borislav Petkov <[email protected]>
    Cc: Brian Gerst <[email protected]>
    Cc: Chang Seok <[email protected]>
    Cc: Denys Vlasenko <[email protected]>
    Cc: H. Peter Anvin <[email protected]>
    Cc: Josh Poimboeuf <[email protected]>
    Cc: Linus Torvalds <[email protected]>
    Cc: Peter Zijlstra <[email protected]>
    Cc: Thomas Gleixner <[email protected]>
    Signed-off-by: Ingo Molnar <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    amluto authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    c7d1dde View commit details
    Browse the repository at this point in the history
  29. x86/fsgsbase/64: Report FSBASE and GSBASE correctly in core dumps

    commit 9584d98 upstream.
    
    In ELF_COPY_CORE_REGS, we're copying from the current task, so
    accessing thread.fsbase and thread.gsbase makes no sense.  Just read
    the values from the CPU registers.
    
    In practice, the old code would have been correct most of the time
    simply because thread.fsbase and thread.gsbase usually matched the
    CPU registers.
    
    Signed-off-by: Andy Lutomirski <[email protected]>
    Cc: Borislav Petkov <[email protected]>
    Cc: Borislav Petkov <[email protected]>
    Cc: Brian Gerst <[email protected]>
    Cc: Chang Seok <[email protected]>
    Cc: Denys Vlasenko <[email protected]>
    Cc: H. Peter Anvin <[email protected]>
    Cc: Josh Poimboeuf <[email protected]>
    Cc: Linus Torvalds <[email protected]>
    Cc: Peter Zijlstra <[email protected]>
    Cc: Thomas Gleixner <[email protected]>
    Signed-off-by: Ingo Molnar <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    amluto authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    0caec70 View commit details
    Browse the repository at this point in the history
  30. x86/switch_to/64: Rewrite FS/GS switching yet again to fix AMD CPUs

    commit e137a4d upstream.
    
    Switching FS and GS is a mess, and the current code is still subtly
    wrong: it assumes that "Loading a nonzero value into FS sets the
    index and base", which is false on AMD CPUs if the value being
    loaded is 1, 2, or 3.
    
    (The current code came from commit 3e2b68d ("x86/asm,
    sched/x86: Rewrite the FS and GS context switch code"), which made
    it better but didn't fully fix it.)
    
    Rewrite it to be much simpler and more obviously correct.  This
    should fix it fully on AMD CPUs and shouldn't adversely affect
    performance.
    
    Signed-off-by: Andy Lutomirski <[email protected]>
    Cc: Borislav Petkov <[email protected]>
    Cc: Borislav Petkov <[email protected]>
    Cc: Brian Gerst <[email protected]>
    Cc: Chang Seok <[email protected]>
    Cc: Denys Vlasenko <[email protected]>
    Cc: H. Peter Anvin <[email protected]>
    Cc: Josh Poimboeuf <[email protected]>
    Cc: Linus Torvalds <[email protected]>
    Cc: Peter Zijlstra <[email protected]>
    Cc: Thomas Gleixner <[email protected]>
    Signed-off-by: Ingo Molnar <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    amluto authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    3fddeb8 View commit details
    Browse the repository at this point in the history
  31. xfs: Move handling of missing page into one place in xfs_find_get_des…

    …ired_pgoff()
    
    commit a54fba8 upstream.
    
    Currently several places in xfs_find_get_desired_pgoff() handle the case
    of a missing page. Make them all handled in one place after the loop has
    terminated.
    
    Signed-off-by: Jan Kara <[email protected]>
    Reviewed-by: Brian Foster <[email protected]>
    Reviewed-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    jankara authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    4c1d33c View commit details
    Browse the repository at this point in the history
  32. xfs: fix spurious spin_is_locked() assert failures on non-smp kernels

    commit 95989c4 upstream.
    
    The 0-day kernel test robot reports assertion failures on
    !CONFIG_SMP kernels due to failed spin_is_locked() checks. As it
    turns out, spin_is_locked() is hardcoded to return zero on
    !CONFIG_SMP kernels and so this function cannot be relied on to
    verify spinlock state in this configuration.
    
    To avoid this problem, replace the associated asserts with lockdep
    variants that do the right thing regardless of kernel configuration.
    Drop the one assert that checks for an unlocked lock as there is no
    suitable lockdep variant for that case. This moves the spinlock
    checks from XFS debug code to lockdep, but generally provides the
    same level of protection.
    
    Reported-by: kbuild test robot <[email protected]>
    Signed-off-by: Brian Foster <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Reviewed-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Brian Foster authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    85ab1b2 View commit details
    Browse the repository at this point in the history
  33. xfs: push buffer of flush locked dquot to avoid quotacheck deadlock

    commit 7912e7f upstream.
    
    Reclaim during quotacheck can lead to deadlocks on the dquot flush
    lock:
    
     - Quotacheck populates a local delwri queue with the physical dquot
       buffers.
     - Quotacheck performs the xfs_qm_dqusage_adjust() bulkstat and
       dirties all of the dquots.
     - Reclaim kicks in and attempts to flush a dquot whose buffer is
       already queud on the quotacheck queue. The flush succeeds but
       queueing to the reclaim delwri queue fails as the backing buffer is
       already queued. The flush unlock is now deferred to I/O completion
       of the buffer from the quotacheck queue.
     - The dqadjust bulkstat continues and dirties the recently flushed
       dquot once again.
     - Quotacheck proceeds to the xfs_qm_flush_one() walk which requires
       the flush lock to update the backing buffers with the in-core
       recalculated values. It deadlocks on the redirtied dquot as the
       flush lock was already acquired by reclaim, but the buffer resides
       on the local delwri queue which isn't submitted until the end of
       quotacheck.
    
    This is reproduced by running quotacheck on a filesystem with a
    couple million inodes in low memory (512MB-1GB) situations. This is
    a regression as of commit 43ff212 ("xfs: on-stack delayed write
    buffer lists"), which removed a trylock and buffer I/O submission
    from the quotacheck dquot flush sequence.
    
    Quotacheck first resets and collects the physical dquot buffers in a
    delwri queue. Then, it traverses the filesystem inodes via bulkstat,
    updates the in-core dquots, flushes the corrected dquots to the
    backing buffers and finally submits the delwri queue for I/O. Since
    the backing buffers are queued across the entire quotacheck
    operation, dquot reclaim cannot possibly complete a dquot flush
    before quotacheck completes.
    
    Therefore, quotacheck must submit the buffer for I/O in order to
    cycle the flush lock and flush the dirty in-core dquot to the
    buffer. Add a delwri queue buffer push mechanism to submit an
    individual buffer for I/O without losing the delwri queue status and
    use it from quotacheck to avoid the deadlock. This restores
    quotacheck behavior to as before the regression was introduced.
    
    Reported-by: Martin Svec <[email protected]>
    Signed-off-by: Brian Foster <[email protected]>
    Reviewed-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Brian Foster authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    7cb011b View commit details
    Browse the repository at this point in the history
  34. xfs: try to avoid blowing out the transaction reservation when bunmap…

    …ing a shared extent
    
    commit e1a4e37 upstream.
    
    In a pathological scenario where we are trying to bunmapi a single
    extent in which every other block is shared, it's possible that trying
    to unmap the entire large extent in a single transaction can generate so
    many EFIs that we overflow the transaction reservation.
    
    Therefore, use a heuristic to guess at the number of blocks we can
    safely unmap from a reflink file's data fork in an single transaction.
    This should prevent problems such as the log head slamming into the tail
    and ASSERTs that trigger because we've exceeded the transaction
    reservation.
    
    Note that since bunmapi can fail to unmap the entire range, we must also
    teach the deferred unmap code to roll into a new transaction whenever we
    get low on reservation.
    
    Signed-off-by: Darrick J. Wong <[email protected]>
    [hch: random edits, all bugs are my fault]
    Signed-off-by: Christoph Hellwig <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    djwong authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    ce83e49 View commit details
    Browse the repository at this point in the history
  35. xfs: release bli from transaction properly on fs shutdown

    commit 79e641c upstream.
    
    If a filesystem shutdown occurs with a buffer log item in the CIL
    and a log force occurs, the ->iop_unpin() handler is generally
    expected to tear down the bli properly. This entails freeing the bli
    memory and releasing the associated hold on the buffer so it can be
    released and the filesystem unmounted.
    
    If this sequence occurs while ->bli_refcount is elevated (i.e.,
    another transaction is open and attempting to modify the buffer),
    however, ->iop_unpin() may not be responsible for releasing the bli.
    Instead, the transaction may release the final ->bli_refcount
    reference and thus xfs_trans_brelse() is responsible for tearing
    down the bli.
    
    While xfs_trans_brelse() does drop the reference count, it only
    attempts to release the bli if it is clean (i.e., not in the
    CIL/AIL). If the filesystem is shutdown and the bli is sitting dirty
    in the CIL as noted above, this ends up skipping the last
    opportunity to release the bli. In turn, this leaves the hold on the
    buffer and causes an unmount hang. This can be reproduced by running
    generic/388 in repetition.
    
    Update xfs_trans_brelse() to handle this shutdown corner case
    correctly. If the final bli reference is dropped and the filesystem
    is shutdown, remove the bli from the AIL (if necessary) and release
    the bli to drop the buffer hold and ensure an unmount does not hang.
    
    Signed-off-by: Brian Foster <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Reviewed-by: Carlos Maiolino <[email protected]>
    Reviewed-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Brian Foster authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    6c0ecde View commit details
    Browse the repository at this point in the history
  36. xfs: remove bli from AIL before release on transaction abort

    commit 3d4b4a3 upstream.
    
    When a buffer is modified, logged and committed, it ultimately ends
    up sitting on the AIL with a dirty bli waiting for metadata
    writeback. If another transaction locks and invalidates the buffer
    (freeing an inode chunk, for example) in the meantime, the bli is
    flagged as stale, the dirty state is cleared and the bli remains in
    the AIL.
    
    If a shutdown occurs before the transaction that has invalidated the
    buffer is committed, the transaction is ultimately aborted. The log
    items are flagged as such and ->iop_unlock() handles the aborted
    items. Because the bli is clean (due to the invalidation),
    ->iop_unlock() unconditionally releases it. The log item may still
    reside in the AIL, however, which means the I/O completion handler
    may still run and attempt to access it. This results in assert
    failure due to the release of the bli while still present in the AIL
    and a subsequent NULL dereference and panic in the buffer I/O
    completion handling. This can be reproduced by running generic/388
    in repetition.
    
    To avoid this problem, update xfs_buf_item_unlock() to first check
    whether the bli is aborted and if so, remove it from the AIL before
    it is released. This ensures that the bli is no longer accessed
    during the shutdown sequence after it has been freed.
    
    Signed-off-by: Brian Foster <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Reviewed-by: Carlos Maiolino <[email protected]>
    Reviewed-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Brian Foster authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    8913492 View commit details
    Browse the repository at this point in the history
  37. xfs: don't allow bmap on rt files

    commit 61d819e upstream.
    
    bmap returns a dumb LBA address but not the block device that goes with
    that LBA.  Swapfiles don't care about this and will blindly assume that
    the data volume is the correct blockdev, which is totally bogus for
    files on the rt subvolume.  This results in the swap code doing IOs to
    arbitrary locations on the data device(!) if the passed in mapping is a
    realtime file, so just turn off bmap for rt files.
    
    Signed-off-by: Darrick J. Wong <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    djwong authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    621d0b7 View commit details
    Browse the repository at this point in the history
  38. xfs: free uncommitted transactions during log recovery

    commit 3977543 upstream.
    
    Log recovery allocates in-core transaction and member item data
    structures on-demand as it processes the on-disk log. Transactions
    are allocated on first encounter on-disk and stored in a hash table
    structure where they are easily accessible for subsequent lookups.
    Transaction items are also allocated on demand and are attached to
    the associated transactions.
    
    When a commit record is encountered in the log, the transaction is
    committed to the fs and the in-core structures are freed. If a
    filesystem crashes or shuts down before all in-core log buffers are
    flushed to the log, however, not all transactions may have commit
    records in the log. As expected, the modifications in such an
    incomplete transaction are not replayed to the fs. The in-core data
    structures for the partial transaction are never freed, however,
    resulting in a memory leak.
    
    Update xlog_do_recovery_pass() to first correctly initialize the
    hash table array so empty lists can be distinguished from populated
    lists on function exit. Update xlog_recover_free_trans() to always
    remove the transaction from the list prior to freeing the associated
    memory. Finally, walk the hash table of transaction lists as the
    last step before it goes out of scope and free any transactions that
    may remain on the lists. This prevents a memory leak of partial
    transactions in the log.
    
    Signed-off-by: Brian Foster <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Reviewed-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Brian Foster authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    171192c View commit details
    Browse the repository at this point in the history
  39. xfs: free cowblocks and retry on buffered write ENOSPC

    commit cf2cb78 upstream.
    
    XFS runs an eofblocks reclaim scan before returning an ENOSPC error to
    userspace for buffered writes. This facilitates aggressive speculative
    preallocation without causing user visible side effects such as
    premature ENOSPC.
    
    Run a cowblocks scan in the same situation to reclaim lingering COW fork
    preallocation throughout the filesystem.
    
    Signed-off-by: Brian Foster <[email protected]>
    Reviewed-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Brian Foster authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    b46382f View commit details
    Browse the repository at this point in the history
  40. xfs: don't crash on unexpected holes in dir/attr btrees

    commit cd87d86 upstream.
    
    In quite a few places we call xfs_da_read_buf with a mappedbno that we
    don't control, then assume that the function passes back either an error
    code or a buffer pointer.  Unfortunately, if mappedbno == -2 and bno
    maps to a hole, we get a return code of zero and a NULL buffer, which
    means that we crash if we actually try to use that buffer pointer.  This
    happens immediately when we set the buffer type for transaction context.
    
    Therefore, check that we have no error code and a non-NULL bp before
    trying to use bp.  This patch is a follow-up to an incomplete fix in
    96a3aef ("xfs: don't crash if reading a directory results in an
    unexpected hole").
    
    Signed-off-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    djwong authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    e76496f View commit details
    Browse the repository at this point in the history
  41. xfs: check _btree_check_block value

    commit 1e86eab upstream.
    
    Check the _btree_check_block return value for the firstrec and lastrec
    functions, since we have the ability to signal that the repositioning
    did not succeed.
    
    Fixes-coverity-id: 114067
    Fixes-coverity-id: 114068
    Signed-off-by: Darrick J. Wong <[email protected]>
    Reviewed-by: Brian Foster <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    djwong authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    a6247b0 View commit details
    Browse the repository at this point in the history
  42. xfs: set firstfsb to NULLFSBLOCK before feeding it to _bmapi_write

    commit 4c1a67b upstream.
    
    We must initialize the firstfsb parameter to _bmapi_write so that it
    doesn't incorrectly treat stack garbage as a restriction on which AGs
    it can search for free space.
    
    Fixes-coverity-id: 1402025
    Fixes-coverity-id: 1415167
    Signed-off-by: Darrick J. Wong <[email protected]>
    Reviewed-by: Brian Foster <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    djwong authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    c32b1ec View commit details
    Browse the repository at this point in the history
  43. xfs: check _alloc_read_agf buffer pointer before using

    commit 10479e2 upstream.
    
    In some circumstances, _alloc_read_agf can return an error code of zero
    but also a null AGF buffer pointer.  Check for this and jump out.
    
    Fixes-coverity-id: 1415250
    Fixes-coverity-id: 1415320
    Signed-off-by: Darrick J. Wong <[email protected]>
    Reviewed-by: Brian Foster <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    djwong authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    01bc132 View commit details
    Browse the repository at this point in the history
  44. xfs: fix quotacheck dquot id overflow infinite loop

    commit cfaf2d0 upstream.
    
    If a dquot has an id of U32_MAX, the next lookup index increment
    overflows the uint32_t back to 0. This starts the lookup sequence
    over from the beginning, repeats indefinitely and results in a
    livelock.
    
    Update xfs_qm_dquot_walk() to explicitly check for the lookup
    overflow and exit the loop.
    
    Signed-off-by: Brian Foster <[email protected]>
    Reviewed-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Brian Foster authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    81e27c9 View commit details
    Browse the repository at this point in the history
  45. xfs: fix multi-AG deadlock in xfs_bunmapi

    commit 5b094d6 upstream.
    
    Just like in the allocator we must avoid touching multiple AGs out of
    order when freeing blocks, as freeing still locks the AGF and can cause
    the same AB-BA deadlocks as in the allocation path.
    
    Signed-off-by: Christoph Hellwig <[email protected]>
    Reported-by: Nikolay Borisov <[email protected]>
    Reviewed-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Christoph Hellwig authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    2299801 View commit details
    Browse the repository at this point in the history
  46. xfs: Fix per-inode DAX flag inheritance

    commit 56bdf85 upstream.
    
    According to the commit that implemented per-inode DAX flag:
    commit 58f88ca ("xfs: introduce per-inode DAX enablement")
    the flag is supposed to act as "inherit flag".
    
    Currently this only works in the situations where parent directory
    already has a flag in di_flags set, otherwise inheritance does not
    work. This is because setting the XFS_DIFLAG2_DAX flag is done in a
    wrong branch designated for di_flags, not di_flags2.
    
    Fix this by moving the code to branch designated for setting di_flags2,
    which does test for flags in di_flags2.
    
    Fixes: 58f88ca ("xfs: introduce per-inode DAX enablement")
    Signed-off-by: Lukas Czerner <[email protected]>
    Reviewed-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Lukas Czerner authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    f90756d View commit details
    Browse the repository at this point in the history
  47. xfs: fix inobt inode allocation search optimization

    commit c44245b upstream.
    
    When we try to allocate a free inode by searching the inobt, we try to
    find the inode nearest the parent inode by searching chunks both left
    and right of the chunk containing the parent. As an optimization, we
    cache the leftmost and rightmost records that we previously searched; if
    we do another allocation with the same parent inode, we'll pick up the
    search where it last left off.
    
    There's a bug in the case where we found a free inode to the left of the
    parent's chunk: we need to update the cached left and right records, but
    because we already reassigned the right record to point to the left, we
    end up assigning the left record to both the cached left and right
    records.
    
    This isn't a correctness problem strictly, but it can result in the next
    allocation rechecking chunks unnecessarily or allocating inodes further
    away from the parent than it needs to. Fix it by swapping the record
    pointer after we update the cached left and right records.
    
    Fixes: bd16956 ("xfs: speed up free inode search")
    Signed-off-by: Omar Sandoval <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Reviewed-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    osandov authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    8edd73a View commit details
    Browse the repository at this point in the history
  48. xfs: clear MS_ACTIVE after finishing log recovery

    commit 8204f8d upstream.
    
    Way back when we established inode block-map redo log items, it was
    discovered that we needed to prevent the VFS from evicting inodes during
    log recovery because any given inode might be have bmap redo items to
    replay even if the inode has no link count and is ultimately deleted,
    and any eviction of an unlinked inode causes the inode to be truncated
    and freed too early.
    
    To make this possible, we set MS_ACTIVE so that inodes would not be torn
    down immediately upon release.  Unfortunately, this also results in the
    quota inodes not being released at all if a later part of the mount
    process should fail, because we never reclaim the inodes.  So, set
    MS_ACTIVE right before we do the last part of log recovery and clear it
    immediately after we finish the log recovery so that everything
    will be torn down properly if we abort the mount.
    
    Fixes: 17c12bc ("xfs: when replaying bmap operations, don't let unlinked inodes get reaped")
    Signed-off-by: Darrick J. Wong <[email protected]>
    Reviewed-by: Brian Foster <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    djwong authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    7fb3e5e View commit details
    Browse the repository at this point in the history
  49. xfs: don't leak quotacheck dquots when cow recovery

    commit 77aff8c upstream.
    
    If we fail a mount on account of cow recovery errors, it's possible that
    a previous quotacheck left some dquots in memory.  The bailout clause of
    xfs_mountfs forgets to purge these, and so we leak them.  Fix that.
    
    Signed-off-by: Darrick J. Wong <[email protected]>
    Reviewed-by: Brian Foster <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    djwong authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    e1a7b7e View commit details
    Browse the repository at this point in the history
  50. iomap: fix integer truncation issues in the zeroing and dirtying helpers

    commit e28ae8e upstream.
    
    Fix the min_t calls in the zeroing and dirtying helpers to perform the
    comparisms on 64-bit types, which prevents them from incorrectly
    being truncated, and larger zeroing operations being stuck in a never
    ending loop.
    
    Special thanks to Markus Stockhausen for spotting the bug.
    
    Reported-by: Paul Menzel <[email protected]>
    Tested-by: Paul Menzel <[email protected]>
    Signed-off-by: Christoph Hellwig <[email protected]>
    Reviewed-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Christoph Hellwig authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    ec0d46e View commit details
    Browse the repository at this point in the history
  51. xfs: write unmount record for ro mounts

    commit 757a69e upstream.
    
    There are dueling comments in the xfs code about intent
    for log writes when unmounting a readonly filesystem.
    
    In xfs_mountfs, we see the intent:
    
    /*
     * Now the log is fully replayed, we can transition to full read-only
     * mode for read-only mounts. This will sync all the metadata and clean
     * the log so that the recovery we just performed does not have to be
     * replayed again on the next mount.
     */
    
    and it calls xfs_quiesce_attr(), but by the time we get to
    xfs_log_unmount_write(), it returns early for a RDONLY mount:
    
     * Don't write out unmount record on read-only mounts.
    
    Because of this, sequential ro mounts of a filesystem with
    a dirty log will replay the log each time, which seems odd.
    
    Fix this by writing an unmount record even for RO mounts, as long
    as norecovery wasn't specified (don't write a clean log record
    if a dirty log may still be there!) and the log device is
    writable.
    
    Signed-off-by: Eric Sandeen <[email protected]>
    Reviewed-by: Brian Foster <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Reviewed-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    sandeen authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    01d38e3 View commit details
    Browse the repository at this point in the history
  52. xfs: toggle readonly state around xfs_log_mount_finish

    commit 6f4a1ee upstream.
    
    When we do log recovery on a readonly mount, unlinked inode
    processing does not happen due to the readonly checks in
    xfs_inactive(), which are trying to prevent any I/O on a
    readonly mount.
    
    This is misguided - we do I/O on readonly mounts all the time,
    for consistency; for example, log recovery.  So do the same
    RDONLY flag twiddling around xfs_log_mount_finish() as we
    do around xfs_log_mount(), for the same reason.
    
    This all cries out for a big rework but for now this is a
    simple fix to an obvious problem.
    
    Signed-off-by: Eric Sandeen <[email protected]>
    Reviewed-by: Brian Foster <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Reviewed-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    sandeen authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    9a3f752 View commit details
    Browse the repository at this point in the history
  53. xfs: remove xfs_trans_ail_delete_bulk

    commit 27af1bb upstream.
    
    xfs_iflush_done uses an on-stack variable length array to pass the log
    items to be deleted to xfs_trans_ail_delete_bulk.  On-stack VLAs are a
    nasty gcc extension that can lead to unbounded stack allocations, but
    fortunately we can easily avoid them by simply open coding
    xfs_trans_ail_delete_bulk in xfs_iflush_done, which is the only caller
    of it except for the single-item xfs_trans_ail_delete.
    
    Signed-off-by: Christoph Hellwig <[email protected]>
    Reviewed-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Christoph Hellwig authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    1ba0493 View commit details
    Browse the repository at this point in the history
  54. xfs: Add infrastructure needed for error propagation during buffer IO…

    … failure
    
    commit 0b80ae6 upstream.
    
    With the current code, XFS never re-submit a failed buffer for IO,
    because the failed item in the buffer is kept in the flush locked state
    forever.
    
    To be able to resubmit an log item for IO, we need a way to mark an item
    as failed, if, for any reason the buffer which the item belonged to
    failed during writeback.
    
    Add a new log item callback to be used after an IO completion failure
    and make the needed clean ups.
    
    Reviewed-by: Brian Foster <[email protected]>
    Signed-off-by: Carlos Maiolino <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Reviewed-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    cmaiolino authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    7942f60 View commit details
    Browse the repository at this point in the history
  55. xfs: Properly retry failed inode items in case of error during buffer…

    … writeback
    
    commit d3a304b upstream.
    
    When a buffer has been failed during writeback, the inode items into it
    are kept flush locked, and are never resubmitted due the flush lock, so,
    if any buffer fails to be written, the items in AIL are never written to
    disk and never unlocked.
    
    This causes unmount operation to hang due these items flush locked in AIL,
    but this also causes the items in AIL to never be written back, even when
    the IO device comes back to normal.
    
    I've been testing this patch with a DM-thin device, creating a
    filesystem larger than the real device.
    
    When writing enough data to fill the DM-thin device, XFS receives ENOSPC
    errors from the device, and keep spinning on xfsaild (when 'retry
    forever' configuration is set).
    
    At this point, the filesystem can not be unmounted because of the flush locked
    items in AIL, but worse, the items in AIL are never retried at all
    (once xfs_inode_item_push() will skip the items that are flush locked),
    even if the underlying DM-thin device is expanded to the proper size.
    
    This patch fixes both cases, retrying any item that has been failed
    previously, using the infra-structure provided by the previous patch.
    
    Reviewed-by: Brian Foster <[email protected]>
    Signed-off-by: Carlos Maiolino <[email protected]>
    Reviewed-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    cmaiolino authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    0800356 View commit details
    Browse the repository at this point in the history
  56. xfs: fix recovery failure when log record header wraps log end

    commit 284f1c2 upstream.
    
    The high-level log recovery algorithm consists of two loops that
    walk the physical log and process log records from the tail to the
    head. The first loop handles the case where the tail is beyond the
    head and processes records up to the end of the physical log. The
    subsequent loop processes records from the beginning of the physical
    log to the head.
    
    Because log records can wrap around the end of the physical log, the
    first loop mentioned above must handle this case appropriately.
    Records are processed from in-core buffers, which means that this
    algorithm must split the reads of such records into two partial
    I/Os: 1.) from the beginning of the record to the end of the log and
    2.) from the beginning of the log to the end of the record. This is
    further complicated by the fact that the log record header and log
    record data are read into independent buffers.
    
    The current handling of each buffer correctly splits the reads when
    either the header or data starts before the end of the log and wraps
    around the end. The data read does not correctly handle the case
    where the prior header read wrapped or ends on the physical log end
    boundary. blk_no is incremented to or beyond the log end after the
    header read to point to the record data, but the split data read
    logic triggers, attempts to read from an invalid log block and
    ultimately causes log recovery to fail. This can be reproduced
    fairly reliably via xfstests tests generic/047 and generic/388 with
    large iclog sizes (256k) and small (10M) logs.
    
    If the record header read has pushed beyond the end of the physical
    log, the subsequent data read is actually contiguous. Update the
    data read logic to detect the case where blk_no has wrapped, mod it
    against the log size to read from the correct address and issue one
    contiguous read for the log data buffer. The log record is processed
    as normal from the buffer(s), the loop exits after the current
    iteration and the subsequent loop picks up with the first new record
    after the start of the log.
    
    Signed-off-by: Brian Foster <[email protected]>
    Reviewed-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Brian Foster authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    3509392 View commit details
    Browse the repository at this point in the history
  57. xfs: always verify the log tail during recovery

    commit 5297ac1 upstream.
    
    Log tail verification currently only occurs when torn writes are
    detected at the head of the log. This was introduced because a
    change in the head block due to torn writes can lead to a change in
    the tail block (each log record header references the current tail)
    and the tail block should be verified before log recovery proceeds.
    
    Tail corruption is possible outside of torn write scenarios,
    however. For example, partial log writes can be detected and cleared
    during the initial head/tail block discovery process. If the partial
    write coincides with a tail overwrite, the log tail is corrupted and
    recovery fails.
    
    To facilitate correct handling of log tail overwites, update log
    recovery to always perform tail verification. This is necessary to
    detect potential tail overwrite conditions when torn writes may not
    have occurred. This changes normal (i.e., no torn writes) recovery
    behavior slightly to detect and return CRC related errors near the
    tail before actual recovery starts.
    
    Signed-off-by: Brian Foster <[email protected]>
    Reviewed-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Brian Foster authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    e34b72a View commit details
    Browse the repository at this point in the history
  58. xfs: fix log recovery corruption error due to tail overwrite

    commit 4a4f66e upstream.
    
    If we consider the case where the tail (T) of the log is pinned long
    enough for the head (H) to push and block behind the tail, we can
    end up blocked in the following state without enough free space (f)
    in the log to satisfy a transaction reservation:
    
    	0	phys. log	N
    	[-------HffT---H'--T'---]
    
    The last good record in the log (before H) refers to T. The tail
    eventually pushes forward (T') leaving more free space in the log
    for writes to H. At this point, suppose space frees up in the log
    for the maximum of 8 in-core log buffers to start flushing out to
    the log. If this pushes the head from H to H', these next writes
    overwrite the previous tail T. This is safe because the items logged
    from T to T' have been written back and removed from the AIL.
    
    If the next log writes (H -> H') happen to fail and result in
    partial records in the log, the filesystem shuts down having
    overwritten T with invalid data. Log recovery correctly locates H on
    the subsequent mount, but H still refers to the now corrupted tail
    T. This results in log corruption errors and recovery failure.
    
    Since the tail overwrite results from otherwise correct runtime
    behavior, it is up to log recovery to try and deal with this
    situation. Update log recovery tail verification to run a CRC pass
    from the first record past the tail to the head. This facilitates
    error detection at T and moves the recovery tail to the first good
    record past H' (similar to truncating the head on torn write
    detection). If corruption is detected beyond the range possibly
    affected by the max number of iclogs, the log is legitimately
    corrupted and log recovery failure is expected.
    
    Signed-off-by: Brian Foster <[email protected]>
    Reviewed-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Brian Foster authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    47db1fc View commit details
    Browse the repository at this point in the history
  59. xfs: handle -EFSCORRUPTED during head/tail verification

    commit a4c9b34 upstream.
    
    Torn write and tail overwrite detection both trigger only on
    -EFSBADCRC errors. While this is the most likely failure scenario
    for each condition, -EFSCORRUPTED is still possible in certain cases
    depending on what ends up on disk when a torn write or partial tail
    overwrite occurs. For example, an invalid log record h_len can lead
    to an -EFSCORRUPTED error when running the log recovery CRC pass.
    
    Therefore, update log head and tail verification to trigger the
    associated head/tail fixups in the event of -EFSCORRUPTED errors
    along with -EFSBADCRC. Also, -EFSCORRUPTED can currently be returned
    from xlog_do_recovery_pass() before rhead_blk is initialized if the
    first record encountered happens to be corrupted. This leads to an
    incorrect 'first_bad' return value. Initialize rhead_blk earlier in
    the function to address that problem as well.
    
    Signed-off-by: Brian Foster <[email protected]>
    Reviewed-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Brian Foster authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    7549e7c View commit details
    Browse the repository at this point in the history
  60. xfs: add log recovery tracepoint for head/tail

    commit e67d3d4 upstream.
    
    Torn write detection and tail overwrite detection can shift the log
    head and tail respectively in the event of CRC mismatch or
    corruption errors. Add a high-level log recovery tracepoint to dump
    the final log head/tail and make those values easily attainable in
    debug/diagnostic situations.
    
    Signed-off-by: Brian Foster <[email protected]>
    Reviewed-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Brian Foster authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    6b6505d View commit details
    Browse the repository at this point in the history
  61. xfs: stop searching for free slots in an inode chunk when there are none

    commit 2d32311 upstream.
    
    In a filesystem without finobt, the Space manager selects an AG to alloc a new
    inode, where xfs_dialloc_ag_inobt() will search the AG for the free slot chunk.
    
    When the new inode is in the same AG as its parent, the btree will be searched
    starting on the parent's record, and then retried from the top if no slot is
    available beyond the parent's record.
    
    To exit this loop though, xfs_dialloc_ag_inobt() relies on the fact that the
    btree must have a free slot available, once its callers relied on the
    agi->freecount when deciding how/where to allocate this new inode.
    
    In the case when the agi->freecount is corrupted, showing available inodes in an
    AG, when in fact there is none, this becomes an infinite loop.
    
    Add a way to stop the loop when a free slot is not found in the btree, making
    the function to fall into the whole AG scan which will then, be able to detect
    the corruption and shut the filesystem down.
    
    As pointed by Brian, this might impact performance, giving the fact we
    don't reset the search distance anymore when we reach the end of the
    tree, giving it fewer tries before falling back to the whole AG search, but
    it will only affect searches that start within 10 records to the end of the tree.
    
    Signed-off-by: Carlos Maiolino <[email protected]>
    Reviewed-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    cmaiolino authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    536932f View commit details
    Browse the repository at this point in the history
  62. xfs: evict all inodes involved with log redo item

    commit 799ea9e upstream.
    
    When we introduced the bmap redo log items, we set MS_ACTIVE on the
    mountpoint and XFS_IRECOVERY on the inode to prevent unlinked inodes
    from being truncated prematurely during log recovery.  This also had the
    effect of putting linked inodes on the lru instead of evicting them.
    
    Unfortunately, we neglected to find all those unreferenced lru inodes
    and evict them after finishing log recovery, which means that we leak
    them if anything goes wrong in the rest of xfs_mountfs, because the lru
    is only cleaned out on unmount.
    
    Therefore, evict unreferenced inodes in the lru list immediately
    after clearing MS_ACTIVE.
    
    Fixes: 17c12bc ("xfs: when replaying bmap operations, don't let unlinked inodes get reaped")
    Signed-off-by: Darrick J. Wong <[email protected]>
    Cc: [email protected]
    Reviewed-by: Brian Foster <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    djwong authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    63d184d View commit details
    Browse the repository at this point in the history
  63. xfs: check for race with xfs_reclaim_inode() in xfs_ifree_cluster()

    commit f2e9ad2 upstream.
    
    After xfs_ifree_cluster() finds an inode in the radix tree and verifies
    that the inode number is what it expected, xfs_reclaim_inode() can swoop
    in and free it. xfs_ifree_cluster() will then happily continue working
    on the freed inode. Most importantly, it will mark the inode stale,
    which will probably be overwritten when the inode slab object is
    reallocated, but if it has already been reallocated then we can end up
    with an inode spuriously marked stale.
    
    In 8a17d7d ("xfs: mark reclaimed inodes invalid earlier") we added
    a second check to xfs_iflush_cluster() to detect this race, but the
    similar RCU lookup in xfs_ifree_cluster() needs the same treatment.
    
    Signed-off-by: Omar Sandoval <[email protected]>
    Reviewed-by: Brian Foster <[email protected]>
    Reviewed-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    osandov authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    81286ad View commit details
    Browse the repository at this point in the history
  64. xfs: open-code xfs_buf_item_dirty()

    commit a4f6cf6 upstream.
    
    It checks a single flag and has one caller. It probably isn't worth
    its own function.
    
    Signed-off-by: Brian Foster <[email protected]>
    Reviewed-by: Darrick J. Wong <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Signed-off-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Brian Foster authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    0f5af7e View commit details
    Browse the repository at this point in the history
  65. xfs: remove unnecessary dirty bli format check for ordered bufs

    commit 6453c65 upstream.
    
    xfs_buf_item_unlock() historically checked the dirty state of the
    buffer by manually checking the buffer log formats for dirty
    segments. The introduction of ordered buffers invalidated this check
    because ordered buffers have dirty bli's but no dirty (logged)
    segments. The check was updated to accommodate ordered buffers by
    looking at the bli state first and considering the blf only if the
    bli is clean.
    
    This logic is safe but unnecessary. There is no valid case where the
    bli is clean yet the blf has dirty segments. The bli is set dirty
    whenever the blf is logged (via xfs_trans_log_buf()) and the blf is
    cleared in the only place BLI_DIRTY is cleared (xfs_trans_binval()).
    
    Remove the conditional blf dirty checks and replace with an assert
    that should catch any discrepencies between bli and blf dirty
    states. Refactor the old blf dirty check into a helper function to
    be used by the assert.
    
    Signed-off-by: Brian Foster <[email protected]>
    Reviewed-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Brian Foster authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    ba986b3 View commit details
    Browse the repository at this point in the history
  66. xfs: ordered buffer log items are never formatted

    commit e9385cc upstream.
    
    Ordered buffers pass through the logging infrastructure without ever
    being written to the log. The way this works is that the ordered
    buffer status is transferred to the log vector at commit time via
    the ->iop_size() callback. In xlog_cil_insert_format_items(),
    ordered log vectors bypass ->iop_format() processing altogether.
    
    Therefore it is unnecessary for xfs_buf_item_format() to handle
    ordered buffers. Remove the unnecessary logic and assert that an
    ordered buffer never reaches this point.
    
    Signed-off-by: Brian Foster <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Reviewed-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Brian Foster authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    93b6451 View commit details
    Browse the repository at this point in the history
  67. xfs: refactor buffer logging into buffer dirtying helper

    commit 9684010 upstream.
    
    xfs_trans_log_buf() is responsible for logging the dirty segments of
    a buffer along with setting all of the necessary state on the
    transaction, buffer, bli, etc., to ensure that the associated items
    are marked as dirty and prepared for I/O. We have a couple use cases
    that need to to dirty a buffer in a transaction without actually
    logging dirty ranges of the buffer.  One existing use case is
    ordered buffers, which are currently logged with arbitrary ranges to
    accomplish this even though the content of ordered buffers is never
    written to the log. Another pending use case is to relog an already
    dirty buffer across rolled transactions within the deferred
    operations infrastructure. This is required to prevent a held
    (XFS_BLI_HOLD) buffer from pinning the tail of the log.
    
    Refactor xfs_trans_log_buf() into a new function that contains all
    of the logic responsible to dirty the transaction, lidp, buffer and
    bli. This new function can be used in the future for the use cases
    outlined above. This patch does not introduce functional changes.
    
    Signed-off-by: Brian Foster <[email protected]>
    Reviewed-by: Allison Henderson <[email protected]>
    Reviewed-by: Darrick J. Wong <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Signed-off-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Brian Foster authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    19a87a9 View commit details
    Browse the repository at this point in the history
  68. xfs: don't log dirty ranges for ordered buffers

    commit 8dc518d upstream.
    
    Ordered buffers are attached to transactions and pushed through the
    logging infrastructure just like normal buffers with the exception
    that they are not actually written to the log. Therefore, we don't
    need to log dirty ranges of ordered buffers. xfs_trans_log_buf() is
    called on ordered buffers to set up all of the dirty state on the
    transaction, buffer and log item and prepare the buffer for I/O.
    
    Now that xfs_trans_dirty_buf() is available, call it from
    xfs_trans_ordered_buf() so the latter is now mutually exclusive with
    xfs_trans_log_buf(). This reflects the implementation of ordered
    buffers and helps eliminate confusion over the need to log ranges of
    ordered buffers just to set up internal log state.
    
    Signed-off-by: Brian Foster <[email protected]>
    Reviewed-by: Allison Henderson <[email protected]>
    Reviewed-by: Darrick J. Wong <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Signed-off-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Brian Foster authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    fe211e1 View commit details
    Browse the repository at this point in the history
  69. xfs: skip bmbt block ino validation during owner change

    commit 99c794c upstream.
    
    Extent swap uses xfs_btree_visit_blocks() to fix up bmbt block
    owners on v5 (!rmapbt) filesystems. The bmbt scan uses
    xfs_btree_lookup_get_block() to read bmbt blocks which verifies the
    current owner of the block against the parent inode of the bmbt.
    This works during extent swap because the bmbt owners are updated to
    the opposite inode number before the inode extent forks are swapped.
    
    The modified bmbt blocks are marked as ordered buffers which allows
    everything to commit in a single transaction. If the transaction
    commits to the log and the system crashes such that recovery of the
    extent swap is required, log recovery restarts the bmbt scan to fix
    up any bmbt blocks that may have not been written back before the
    crash. The log recovery bmbt scan occurs after the inode forks have
    been swapped, however. This causes the bmbt block owner verification
    to fail, leads to log recovery failure and requires xfs_repair to
    zap the log to recover.
    
    Define a new invalid inode owner flag to inform the btree block
    lookup mechanism that the current inode may be invalid with respect
    to the current owner of the bmbt block. Set this flag on the cursor
    used for change owner scans to allow this operation to work at
    runtime and during log recovery.
    
    Signed-off-by: Brian Foster <[email protected]>
    Fixes: bb3be7e ("xfs: check for bogus values in btree block headers")
    Cc: [email protected]
    Reviewed-by: Darrick J. Wong <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Signed-off-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Brian Foster authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    f9e583e View commit details
    Browse the repository at this point in the history
  70. xfs: move bmbt owner change to last step of extent swap

    commit 6fb10d6 upstream.
    
    The extent swap operation currently resets bmbt block owners before
    the inode forks are swapped. The bmbt buffers are marked as ordered
    so they do not have to be physically logged in the transaction.
    
    This use of ordered buffers is not safe as bmbt buffers may have
    been previously physically logged. The bmbt owner change algorithm
    needs to be updated to physically log buffers that are already dirty
    when/if they are encountered. This means that an extent swap will
    eventually require multiple rolling transactions to handle large
    btrees. In addition, all inode related changes must be logged before
    the bmbt owner change scan begins and can roll the transaction for
    the first time to preserve fs consistency via log recovery.
    
    In preparation for such fixes to the bmbt owner change algorithm,
    refactor the bmbt scan out of the extent fork swap code to the last
    operation before the transaction is committed. Update
    xfs_swap_extent_forks() to only set the inode log flags when an
    owner change scan is necessary. Update xfs_swap_extents() to trigger
    the owner change based on the inode log flags. Note that since the
    owner change now occurs after the extent fork swap, the inode btrees
    must be fixed up with the inode number of the current inode (similar
    to log recovery).
    
    Signed-off-by: Brian Foster <[email protected]>
    Reviewed-by: Darrick J. Wong <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Signed-off-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Brian Foster authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    a51e3e2 View commit details
    Browse the repository at this point in the history
  71. xfs: disallow marking previously dirty buffers as ordered

    commit a5814bc upstream.
    
    Ordered buffers are used in situations where the buffer is not
    physically logged but must pass through the transaction/logging
    pipeline for a particular transaction. As a result, ordered buffers
    are not unpinned and written back until the transaction commits to
    the log. Ordered buffers have a strict requirement that the target
    buffer must not be currently dirty and resident in the log pipeline
    at the time it is marked ordered. If a dirty+ordered buffer is
    committed, the buffer is reinserted to the AIL but not physically
    relogged at the LSN of the associated checkpoint. The buffer log
    item is assigned the LSN of the latest checkpoint and the AIL
    effectively releases the previously logged buffer content from the
    active log before the buffer has been written back. If the tail
    pushes forward and a filesystem crash occurs while in this state, an
    inconsistent filesystem could result.
    
    It is currently the caller responsibility to ensure an ordered
    buffer is not already dirty from a previous modification. This is
    unclear and error prone when not used in situations where it is
    guaranteed a buffer has not been previously modified (such as new
    metadata allocations).
    
    To facilitate general purpose use of ordered buffers, update
    xfs_trans_ordered_buf() to conditionally order the buffer based on
    state of the log item and return the status of the result. If the
    bli is dirty, do not order the buffer and return false. The caller
    must either physically log the buffer (having acquired the
    appropriate log reservation) or push it from the AIL to clean it
    before it can be marked ordered in the current transaction.
    
    Note that ordered buffers are currently only used in two situations:
    1.) inode chunk allocation where previously logged buffers are not
    possible and 2.) extent swap which will be updated to handle ordered
    buffer failures in a separate patch.
    
    Signed-off-by: Brian Foster <[email protected]>
    Reviewed-by: Darrick J. Wong <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Signed-off-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Brian Foster authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    e2bb926 View commit details
    Browse the repository at this point in the history
  72. xfs: relog dirty buffers during swapext bmbt owner change

    commit 2dd3d70 upstream.
    
    The owner change bmbt scan that occurs during extent swap operations
    does not handle ordered buffer failures. Buffers that cannot be
    marked ordered must be physically logged so previously dirty ranges
    of the buffer can be relogged in the transaction.
    
    Since the bmbt scan may need to process and potentially log a large
    number of blocks, we can't expect to complete this operation in a
    single transaction. Update extent swap to use a permanent
    transaction with enough log reservation to physically log a buffer.
    Update the bmbt scan to physically log any buffers that cannot be
    ordered and to terminate the scan with -EAGAIN. On -EAGAIN, the
    caller rolls the transaction and restarts the scan. Finally, update
    the bmbt scan helper function to skip bmbt blocks that already match
    the expected owner so they are not reprocessed after scan restarts.
    
    Signed-off-by: Brian Foster <[email protected]>
    Reviewed-by: Darrick J. Wong <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    [darrick: fix the xfs_trans_roll call]
    Signed-off-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Brian Foster authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    a46cf59 View commit details
    Browse the repository at this point in the history
  73. xfs: disable per-inode DAX flag

    commit 742d842 upstream.
    
    Currently flag switching can be used to easily crash the kernel.  Disable
    the per-inode DAX flag until that is sorted out.
    
    Signed-off-by: Christoph Hellwig <[email protected]>
    Reviewed-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Christoph Hellwig authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    0e8d7e3 View commit details
    Browse the repository at this point in the history
  74. xfs: fix incorrect log_flushed on fsync

    commit 47c7d0b upstream.
    
    When calling into _xfs_log_force{,_lsn}() with a pointer
    to log_flushed variable, log_flushed will be set to 1 if:
    1. xlog_sync() is called to flush the active log buffer
    AND/OR
    2. xlog_wait() is called to wait on a syncing log buffers
    
    xfs_file_fsync() checks the value of log_flushed after
    _xfs_log_force_lsn() call to optimize away an explicit
    PREFLUSH request to the data block device after writing
    out all the file's pages to disk.
    
    This optimization is incorrect in the following sequence of events:
    
     Task A                    Task B
     -------------------------------------------------------
     xfs_file_fsync()
       _xfs_log_force_lsn()
         xlog_sync()
            [submit PREFLUSH]
                               xfs_file_fsync()
                                 file_write_and_wait_range()
                                   [submit WRITE X]
                                   [endio  WRITE X]
                                 _xfs_log_force_lsn()
                                   xlog_wait()
            [endio  PREFLUSH]
    
    The write X is not guarantied to be on persistent storage
    when PREFLUSH request in completed, because write A was submitted
    after the PREFLUSH request, but xfs_file_fsync() of task A will
    be notified of log_flushed=1 and will skip explicit flush.
    
    If the system crashes after fsync of task A, write X may not be
    present on disk after reboot.
    
    This bug was discovered and demonstrated using Josef Bacik's
    dm-log-writes target, which can be used to record block io operations
    and then replay a subset of these operations onto the target device.
    The test goes something like this:
    - Use fsx to execute ops of a file and record ops on log device
    - Every now and then fsync the file, store md5 of file and mark
      the location in the log
    - Then replay log onto device for each mark, mount fs and compare
      md5 of file to stored value
    
    Cc: Christoph Hellwig <[email protected]>
    Cc: Josef Bacik <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Amir Goldstein <[email protected]>
    Reviewed-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    amir73il authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    f46a61f View commit details
    Browse the repository at this point in the history
  75. xfs: don't set v3 xflags for v2 inodes

    commit dd60687 upstream.
    
    Reject attempts to set XFLAGS that correspond to di_flags2 inode flags
    if the inode isn't a v3 inode, because di_flags2 only exists on v3.
    
    Signed-off-by: Christoph Hellwig <[email protected]>
    Reviewed-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Christoph Hellwig authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    bb69e8a View commit details
    Browse the repository at this point in the history
  76. xfs: open code end_buffer_async_write in xfs_finish_page_writeback

    commit 8353a81 upstream.
    
    Our loop in xfs_finish_page_writeback, which iterates over all buffer
    heads in a page and then calls end_buffer_async_write, which also
    iterates over all buffers in the page to check if any I/O is in flight
    is not only inefficient, but also potentially dangerous as
    end_buffer_async_write can cause the page and all buffers to be freed.
    
    Replace it with a single loop that does the work of end_buffer_async_write
    on a per-page basis.
    
    Signed-off-by: Christoph Hellwig <[email protected]>
    Reviewed-by: Brian Foster <[email protected]>
    Reviewed-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Christoph Hellwig authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    772003c View commit details
    Browse the repository at this point in the history
  77. xfs: use kmem_free to free return value of kmem_zalloc

    commit 6c37059 upstream.
    
    In function xfs_test_remount_options(), kfree() is used to free memory
    allocated by kmem_zalloc(). But it is better to use kmem_free().
    
    Signed-off-by: Pan Bian <[email protected]>
    Reviewed-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    SinkFinder authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    81cb6f1 View commit details
    Browse the repository at this point in the history
  78. md/raid5: release/flush io in raid5_do_work()

    commit 9c72a18 upstream.
    
    In raid5, there are scenarios where some ios are deferred to a later
    time, and some IO need a flush to complete. To make sure we make
    progress with these IOs, we need to call the following functions:
    
        flush_deferred_bios(conf);
        r5l_flush_stripe_to_raid(conf->log);
    
    Both of these functions are called in raid5d(), but missing in
    raid5_do_work(). As a result, these functions are not called
    when multi-threading (group_thread_cnt > 0) is enabled. This patch
    adds calls to these function to raid5_do_work().
    
    Note for stable branches:
    
      r5l_flush_stripe_to_raid(conf->log) is need for 4.4+
      flush_deferred_bios(conf) is only needed for 4.11+
    
    Signed-off-by: Song Liu <[email protected]>
    Signed-off-by: Shaohua Li <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    liu-song-6 authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    7b5fcb7 View commit details
    Browse the repository at this point in the history
  79. xfs: fix compiler warnings

    commit 7bf7a19 upstream.
    
    Fix up all the compiler warnings that have crept in.
    
    Signed-off-by: Darrick J. Wong <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Cc: Arnd Bergmann <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    djwong authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    ae04a8c View commit details
    Browse the repository at this point in the history
  80. ipv6: Fix may be used uninitialized warning in rt6_check

    commit 3614364 upstream.
    
    rt_cookie might be used uninitialized, fix this by
    initializing it.
    
    Fixes: c5cff85 ("ipv6: add rcu grace period before freeing fib6_node")
    Signed-off-by: Steffen Klassert <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Cc: Arnd Bergmann <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    klassert authored and gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    7829684 View commit details
    Browse the repository at this point in the history
  81. Linux 4.9.51

    gregkh committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    089d772 View commit details
    Browse the repository at this point in the history
  82. spi: atmel: print version only after successful registration

    Don't print the version at the beginning of atmel_spi_probe(). This avoids
    spamming the log whenever a deferred probe runs.
    
    Signed-off-by: Baruch Siach <[email protected]>
    Acked-by: Nicolas Ferre <[email protected]>
    Signed-off-by: Mark Brown <[email protected]>
    baruchsiach authored and Nicolas Ferre committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    9ab1f42 View commit details
    Browse the repository at this point in the history
  83. spi: atmel: fix corrupted data issue on SAM9 family SoCs

    This patch disables the use of the DMA for data transfer and forces the
    use of PIO transfers instead as a quick fixup to solve the cache aliasing
    issue on ARM9 based cores, which embeds a VIVT data cache.
    
    Indeed in the case of VIVT data caches, it is not safe to call dma_map_*()
    functions to map buffers for DMA transfers when those buffers have been
    allocated by vmalloc() or from any DMA-unsafe area.
    
    Further patches may propose a better solution based on the use of a bounce
    buffer at the SPI sub-system level but such solution needs more time to be
    discussed. Then the use of DMA transfers could be enabled again to improve
    the performances but before that, this patch already solves the issue.
    
    Signed-off-by: Cyrille Pitchen <[email protected]>
    Acked-by: Nicolas Ferre <[email protected]>
    Signed-off-by: Mark Brown <[email protected]>
    Cc: [email protected]
    CyrillePitchen authored and Nicolas Ferre committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    2958308 View commit details
    Browse the repository at this point in the history
  84. spi: atmel: factorize reusable code for SPI controller init

    The SPI controller configuration during the init can be reused, for the
    resume function for example.
    
    Let's move this configuration to a separate function.
    
    Signed-off-by: Quentin Schulz <[email protected]>
    Acked-by: Nicolas Ferre <[email protected]>
    Signed-off-by: Mark Brown <[email protected]>
    QSchulz authored and Nicolas Ferre committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    9e3628d View commit details
    Browse the repository at this point in the history
  85. spi: atmel: add deepest PM support to SAMA5D2

    This adds deepest (Backup+Self-Refresh) PM support to the ATMEL SAMA5D2
    SoC's SPI controller.
    
    When resuming from deepest state, it is required to restore MR register
    as the registers are lost since VDD core has been shut down when
    entering deepest state on the SAMA5D2.
    
    Signed-off-by: Quentin Schulz <[email protected]>
    Acked-by: Alexandre Belloni <[email protected]>
    Acked-by: Nicolas Ferre <[email protected]>
    Signed-off-by: Mark Brown <[email protected]>
    QSchulz authored and Nicolas Ferre committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    3ae0b25 View commit details
    Browse the repository at this point in the history
  86. Merge branches 'at91-4.9-trunk/base_spi' and 'at91-4.9-trunk/b+sr' in…

    …to linux-4.9-at91
    noglitch authored and Nicolas Ferre committed Sep 20, 2017
    Configuration menu
    Copy the full SHA
    f000ae3 View commit details
    Browse the repository at this point in the history

Commits on Sep 21, 2017

  1. clk: at91: pmc: don't use timeout when resuming

    When resuming the PMC, a call to regmap_read_poll_timeout() is used to
    check if the UPLL is locked. Unfortunately, the timekeeping subsystem
    may not be resumed yet.
    Most of the time, the UPLL should be locked when resuming the PMC. If
    it's not the case, print a warning. We don't want to stay in an infinite
    loop if only peripherals using the UTMI clock won't work. Moreover, it
    doesn't necessary lead to an issue. If the UPLL is locked before
    peripherals use it, it won't be an issue.
    If some unexpected behaviors are encountered for peripherals using the
    UTMI clock, then the PMC_SR register should be checked manually to see
    if the UPLL is locked or not.
    
    Signed-off-by: Ludovic Desroches <[email protected]>
    ldesroches committed Sep 21, 2017
    Configuration menu
    Copy the full SHA
    3d101b1 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c4c3360 View commit details
    Browse the repository at this point in the history

Commits on Sep 22, 2017

  1. mmc: sdhci-of-at91: do not advertise SDR104 mode support

    There are several issues with SDR104 mode and tuning so remove it from
    the capabilities of the host controller.
    
    Signed-off-by: Ludovic Desroches <[email protected]>
    ldesroches committed Sep 22, 2017
    Configuration menu
    Copy the full SHA
    f1e90f5 View commit details
    Browse the repository at this point in the history
  2. mmc: sdhci: remove tuning failure log for DDR50 mode

    In SD 3.0 spec, there is no tuning for the DDR50 mode. In SD 3.0.1 spec,
    tuning can be performed for the DDR50 mode. Most of the SD card are
    only compliant with SD 3.0 spec. It leads to get some logs because the
    tuning procedure, which is not supported, has failed. This log is
    useless most of the time.
    
    Signed-off-by: Ludovic Desroches <[email protected]>
    ldesroches committed Sep 22, 2017
    Configuration menu
    Copy the full SHA
    4efdc35 View commit details
    Browse the repository at this point in the history
  3. Revert "Makefile: linux4sam_5.7-rc6"

    This reverts commit 328eb56.
    noglitch committed Sep 22, 2017
    Configuration menu
    Copy the full SHA
    8593077 View commit details
    Browse the repository at this point in the history
  4. Merge tag 'v4.9.48' into linux-4.9-at91

    This is the 4.9.48 stable release
    noglitch committed Sep 22, 2017
    Configuration menu
    Copy the full SHA
    53d68c9 View commit details
    Browse the repository at this point in the history
  5. Merge tag 'v4.9.49' into linux-4.9-at91

    This is the 4.9.49 stable release
    noglitch committed Sep 22, 2017
    Configuration menu
    Copy the full SHA
    da0acae View commit details
    Browse the repository at this point in the history
  6. Merge tag 'v4.9.50' into linux-4.9-at91

    This is the 4.9.50 stable release
    noglitch committed Sep 22, 2017
    Configuration menu
    Copy the full SHA
    a9f0633 View commit details
    Browse the repository at this point in the history
  7. Merge tag 'v4.9.51' into linux-4.9-at91

    This is the 4.9.51 stable release
    noglitch committed Sep 22, 2017
    Configuration menu
    Copy the full SHA
    3695390 View commit details
    Browse the repository at this point in the history
  8. Revert "clk: at91: pmc: don't use timeout when resuming"

    This reverts commit 3d101b1 since a
    following patch will fix it and add checking of others clocks.
    
    Signed-off-by: Ludovic Desroches <[email protected]>
    ldesroches committed Sep 22, 2017
    Configuration menu
    Copy the full SHA
    276ce45 View commit details
    Browse the repository at this point in the history
  9. clk: at91: pmc: Wait for clocks when resuming

    Wait for the syncronization of all clocks when resuming, not only the
    UPLL clock. Do not use regmap_read_poll_timeout, as it will call BUG()
    when interrupts are masked, which is the case in here.
    
    Signed-off-by: Romain Izard <[email protected]>
    Acked-by: Ludovic Desroches <[email protected]>
    Acked-by: Nicolas Ferre <[email protected]>
    romain-izard-pro authored and ldesroches committed Sep 22, 2017
    Configuration menu
    Copy the full SHA
    8527cfa View commit details
    Browse the repository at this point in the history
  10. clk: at91: pmc: Support backup for programmable clocks

    When an AT91 programmable clock is declared in the device tree, register
    it into the Power Management Controller driver. On entering suspend mode,
    the driver saves and restores the Programmable Clock registers to support
    the backup mode for these clocks.
    
    Signed-off-by: Romain Izard <[email protected]>
    Acked-by: Nicolas Ferre <[email protected]>
    Romain Izard authored and ldesroches committed Sep 22, 2017
    Configuration menu
    Copy the full SHA
    7630191 View commit details
    Browse the repository at this point in the history
  11. ehci-atmel: Power down during suspend is normal

    When an Atmel SoC is suspended with the backup mode, the USB bus will be
    powered down. As this is expected, do not return an error to the driver
    core when ehci_resume detects it.
    
    Signed-off-by: Romain Izard <[email protected]>
    romain-izard-pro authored and ldesroches committed Sep 22, 2017
    Configuration menu
    Copy the full SHA
    383b2a0 View commit details
    Browse the repository at this point in the history
  12. pwm: atmel-tcb: Support backup mode

    Save and restore registers for the PWM on suspend and resume, which
    makes hibernation and backup modes possible.
    
    Signed-off-by: Romain Izard <[email protected]>
    romain-izard-pro authored and ldesroches committed Sep 22, 2017
    Configuration menu
    Copy the full SHA
    98d6fe3 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    3534589 View commit details
    Browse the repository at this point in the history

Commits on Sep 25, 2017

  1. ARM: dts: at91: at91-sama5d27_som1: fix PHY ID

    The PHY ID is incorrect. It leads to trouble when resuming from standby
    or mem power states.
    
    Signed-off-by: Ludovic Desroches <[email protected]>
    ldesroches committed Sep 25, 2017
    Configuration menu
    Copy the full SHA
    b6e18b2 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    71b7258 View commit details
    Browse the repository at this point in the history
  3. Makefile: linux4sam_5.7-rc7

    Signed-off-by: Nicolas Ferre <[email protected]>
    noglitch committed Sep 25, 2017
    Configuration menu
    Copy the full SHA
    8be0870 View commit details
    Browse the repository at this point in the history

Commits on Sep 27, 2017

  1. SUNRPC: Refactor svc_set_num_threads()

    commit 9e0d876 upstream.
    
    Refactor to separate out the functions of starting and stopping threads
    so that they can be used in other helpers.
    
    Signed-off-by: Trond Myklebust <[email protected]>
    Tested-and-reviewed-by: Kinglong Mee <[email protected]>
    Signed-off-by: J. Bruce Fields <[email protected]>
    Cc: Jan Hudoba <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    trondmypd authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    d9f9b83 View commit details
    Browse the repository at this point in the history
  2. NFSv4: Fix callback server shutdown

    commit ed6473d upstream.
    
    We want to use kthread_stop() in order to ensure the threads are
    shut down before we tear down the nfs_callback_info in nfs_callback_down.
    
    Tested-and-reviewed-by: Kinglong Mee <[email protected]>
    Reported-by: Kinglong Mee <[email protected]>
    Fixes: bb6aeba ("NFSv4.x: Switch to using svc_set_num_threads()...")
    Signed-off-by: Trond Myklebust <[email protected]>
    Signed-off-by: J. Bruce Fields <[email protected]>
    Cc: Jan Hudoba <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    trondmypd authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    f609266 View commit details
    Browse the repository at this point in the history
  3. mm: prevent double decrease of nr_reserved_highatomic

    commit 4855e4a upstream.
    
    There is race between page freeing and unreserved highatomic.
    
     CPU 0				    CPU 1
    
        free_hot_cold_page
          mt = get_pfnblock_migratetype
          set_pcppage_migratetype(page, mt)
        				    unreserve_highatomic_pageblock
        				    spin_lock_irqsave(&zone->lock)
        				    move_freepages_block
        				    set_pageblock_migratetype(page)
        				    spin_unlock_irqrestore(&zone->lock)
          free_pcppages_bulk
            __free_one_page(mt) <- mt is stale
    
    By above race, a page on CPU 0 could go non-highorderatomic free list
    since the pageblock's type is changed.  By that, unreserve logic of
    highorderatomic can decrease reserved count on a same pageblock severak
    times and then it will make mismatch between nr_reserved_highatomic and
    the number of reserved pageblock.
    
    So, this patch verifies whether the pageblock is highatomic or not and
    decrease the count only if the pageblock is highatomic.
    
    Link: http://lkml.kernel.org/r/[email protected]
    Signed-off-by: Minchan Kim <[email protected]>
    Acked-by: Vlastimil Babka <[email protected]>
    Acked-by: Mel Gorman <[email protected]>
    Cc: Joonsoo Kim <[email protected]>
    Cc: Sangseok Lee <[email protected]>
    Cc: Michal Hocko <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    Cc: Miles Chen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    minchank authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    39f5677 View commit details
    Browse the repository at this point in the history
  4. orangefs: Don't clear SGID when inheriting ACLs

    commit b5accbb upstream.
    
    When new directory 'DIR1' is created in a directory 'DIR0' with SGID bit
    set, DIR1 is expected to have SGID bit set (and owning group equal to
    the owning group of 'DIR0'). However when 'DIR0' also has some default
    ACLs that 'DIR1' inherits, setting these ACLs will result in SGID bit on
    'DIR1' to get cleared if user is not member of the owning group.
    
    Fix the problem by creating __orangefs_set_acl() function that does not
    call posix_acl_update_mode() and use it when inheriting ACLs. That
    prevents SGID bit clearing and the mode has been properly set by
    posix_acl_create() anyway.
    
    Fixes: 0739310
    CC: [email protected]
    CC: Mike Marshall <[email protected]>
    CC: [email protected]
    Signed-off-by: Jan Kara <[email protected]>
    Signed-off-by: Mike Marshall <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    jankara authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    e148702 View commit details
    Browse the repository at this point in the history
  5. IB/{qib, hfi1}: Avoid flow control testing for RDMA write operation

    commit 5b0ef65 upstream.
    
    Section 9.7.7.2.5 of the 1.3 IBTA spec clearly says that receive
    credits should never apply to RDMA write.
    
    qib and hfi1 were doing that.  The following situation will result
    in a QP hang:
    - A prior SEND or RDMA_WRITE with immmediate consumed the last
      credit for a QP using RC receive buffer credits
    - The prior op is acked so there are no more acks
    - The peer ULP fails to post receive for some reason
    - An RDMA write sees that the credits are exhausted and waits
    - The peer ULP posts receive buffers
    - The ULP posts a send or RDMA write that will be hung
    
    The fix is to avoid the credit test for the RDMA write operation.
    
    Reviewed-by: Kaike Wan <[email protected]>
    Signed-off-by: Mike Marciniszyn <[email protected]>
    Signed-off-by: Dennis Dalessandro <[email protected]>
    Signed-off-by: Doug Ledford <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    mmarcini authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    a29aeb8 View commit details
    Browse the repository at this point in the history
  6. drm/sun4i: Implement drm_driver lastclose to restore fbdev console

    commit 2a596fc upstream.
    
    The drm_driver lastclose callback is called when the last userspace
    DRM client has closed. Call drm_fbdev_cma_restore_mode to restore
    the fbdev console otherwise the fbdev console will stop working.
    
    Fixes: 9026e0d ("drm: Add Allwinner A10 Display Engine support")
    Tested-by: Olliver Schinagl <[email protected]>
    Reviewed-by: Chen-Yu Tsai <[email protected]>
    Signed-off-by: Jonathan Liu <[email protected]>
    Signed-off-by: Maxime Ripard <[email protected]>
    [[email protected]: Backport to 4.9, minor context change]
    Signed-off-by: Jonathan Liu <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    net147 authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    0fda166 View commit details
    Browse the repository at this point in the history
  7. IB/addr: Fix setting source address in addr6_resolve()

    commit 79e2595 upstream.
    
    Commit eea40b8 ("infiniband: call ipv6 route lookup via the stub
    interface") introduced a regression in address resolution when connecting
    to IPv6 destination addresses.  The old code called ip6_route_output(),
    while the new code calls ipv6_stub->ipv6_dst_lookup().  The two are almost
    the same, except that ipv6_dst_lookup() also calls ip6_route_get_saddr()
    if the source address is in6addr_any.
    
    This means that the test of ipv6_addr_any(&fl6.saddr) now never succeeds,
    and so we never copy the source address out.  This ends up causing
    rdma_resolve_addr() to fail, because without a resolved source address,
    cma_acquire_dev() will fail to find an RDMA device to use.  For me, this
    causes connecting to an NVMe over Fabrics target via RoCE / IPv6 to fail.
    
    Fix this by copying out fl6.saddr if ipv6_addr_any() is true for the original
    source address passed into addr6_resolve().  We can drop our call to
    ipv6_dev_get_saddr() because ipv6_dst_lookup() already does that work.
    
    Fixes: eea40b8 ("infiniband: call ipv6 route lookup via the stub interface")
    Signed-off-by: Roland Dreier <[email protected]>
    Acked-by: Paolo Abeni <[email protected]>
    Signed-off-by: Doug Ledford <[email protected]>
    Signed-off-by: Raju Rangoju <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    rolandd authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    2f8b06f View commit details
    Browse the repository at this point in the history
  8. tty: improve tty_insert_flip_char() fast path

    commit 979990c upstream.
    
    kernelci.org reports a crazy stack usage for the VT code when CONFIG_KASAN
    is enabled:
    
    drivers/tty/vt/keyboard.c: In function 'kbd_keycode':
    drivers/tty/vt/keyboard.c:1452:1: error: the frame size of 2240 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]
    
    The problem is that tty_insert_flip_char() gets inlined many times into
    kbd_keycode(), and also into other functions, and each copy requires 128
    bytes for stack redzone to check for a possible out-of-bounds access on
    the 'ch' and 'flags' arguments that are passed into
    tty_insert_flip_string_flags as a variable-length string.
    
    This introduces a new __tty_insert_flip_char() function for the slow
    path, which receives the two arguments by value. This completely avoids
    the problem and the stack usage goes back down to around 100 bytes.
    
    Without KASAN, this is also slightly better, as we don't have to
    spill the arguments to the stack but can simply pass 'ch' and 'flag'
    in registers, saving a few bytes in .text for each call site.
    
    This should be backported to linux-4.0 or later, which first introduced
    the stack sanitizer in the kernel.
    
    Fixes: c420f16 ("kasan: enable stack instrumentation")
    Signed-off-by: Arnd Bergmann <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    arndb authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    f61a07f View commit details
    Browse the repository at this point in the history
  9. tty: improve tty_insert_flip_char() slow path

    commit 065ea0a upstream.
    
    While working on improving the fast path of tty_insert_flip_char(),
    I noticed that by calling tty_buffer_request_room(), we needlessly
    move to the separate flag buffer mode for the tty, even when all
    characters use TTY_NORMAL as the flag.
    
    This changes the code to call __tty_buffer_request_room() with the
    correct flag, which will then allocate a regular buffer when it rounds
    out of space but no special flags have been used. I'm guessing that
    this is the behavior that Peter Hurley intended when he introduced
    the compacted flip buffers.
    
    Fixes: acc0f67 ("tty: Halve flip buffer GFP_ATOMIC memory consumption")
    Cc: Peter Hurley <[email protected]>
    Signed-off-by: Arnd Bergmann <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    arndb authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    7504624 View commit details
    Browse the repository at this point in the history
  10. tty: fix __tty_insert_flip_char regression

    commit 8a5a90a upstream.
    
    Sergey noticed a small but fatal mistake in __tty_insert_flip_char,
    leading to an oops in an interrupt handler when using any serial
    port.
    
    The problem is that I accidentally took the tty_buffer pointer
    before calling __tty_buffer_request_room(), which replaces the
    buffer. This moves the pointer lookup to the right place after
    allocating the new buffer space.
    
    Fixes: 979990c ("tty: improve tty_insert_flip_char() fast path")
    Reported-by: Sergey Senozhatsky <[email protected]>
    Tested-by: Sergey Senozhatsky <[email protected]>
    Signed-off-by: Arnd Bergmann <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    arndb authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    346abf2 View commit details
    Browse the repository at this point in the history
  11. pinctrl/amd: save pin registers over suspend/resume

    commit 79d2c8b upstream.
    
    The touchpad in the Asus laptop models X505BA/BP and X542BA/BP is
    unresponsive after suspend/resume. The following error appears during
    resume:
    
      i2c_hid i2c-ELAN1300:00: failed to reset device.
    
    The problem here is that i2c_hid does not notice the interrupt being
    generated at this point, because the GPIO is no longer configured
    for interrupts.
    
    Fix this by saving pinctrl-amd pin registers during suspend and
    restoring them at resume time.
    
    Based on code from pinctrl-intel.
    
    Signed-off-by: Daniel Drake <[email protected]>
    Signed-off-by: Linus Walleij <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    dsd authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    6053a5f View commit details
    Browse the repository at this point in the history
  12. Input: i8042 - add Gigabyte P57 to the keyboard reset table

    commit 697c5d8 upstream.
    
    Similar to other Gigabyte laptops, the touchpad on P57 requires a
    keyboard reset to detect Elantech touchpad correctly.
    
    BugLink: https://bugs.launchpad.net/bugs/1594214
    Signed-off-by: Kai-Heng Feng <[email protected]>
    Signed-off-by: Dmitry Torokhov <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    khfeng authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    fcaec23 View commit details
    Browse the repository at this point in the history
  13. MIPS: math-emu: <MAX|MAXA|MIN|MINA>.<D|S>: Fix quiet NaN propagation

    commit e78bf0d upstream.
    
    Fix the value returned by <MAX|MAXA|MIN|MINA>.<D|S> fd,fs,ft, if both
    inputs are quiet NaNs. The <MAX|MAXA|MIN|MINA>.<D|S> specifications
    state that the returned value in such cases should be the quiet NaN
    contained in register fs.
    
    A relevant example:
    
    MAX.S fd,fs,ft:
      If fs contains qNaN1, and ft contains qNaN2, fd is going to contain
      qNaN1 (without this patch, it used to contain qNaN2).
    
    Fixes: a79f5f9 ("MIPS: math-emu: Add support for the MIPS R6 MAX{, A} FPU instruction")
    Fixes: 4e9561b ("MIPS: math-emu: Add support for the MIPS R6 MIN{, A} FPU instruction")
    
    Signed-off-by: Miodrag Dinic <[email protected]>
    Signed-off-by: Goran Ferenc <[email protected]>
    Signed-off-by: Aleksandar Markovic <[email protected]>
    Reviewed-by: James Hogan <[email protected]>
    Cc: Bo Hu <[email protected]>
    Cc: Douglas Leung <[email protected]>
    Cc: Jin Qian <[email protected]>
    Cc: Paul Burton <[email protected]>
    Cc: Petar Jovanovic <[email protected]>
    Cc: Raghu Gandham <[email protected]>
    Cc: [email protected]
    Cc: [email protected]
    Patchwork: https://patchwork.linux-mips.org/patch/16880/
    Signed-off-by: Ralf Baechle <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    aleksandar-markovic authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    b234149 View commit details
    Browse the repository at this point in the history
  14. MIPS: math-emu: <MAX|MAXA|MIN|MINA>.<D|S>: Fix cases of both inputs zero

    commit 15560a5 upstream.
    
    Fix the value returned by <MAX|MAXA|MIN|MINA>.<D|S>, if both inputs
    are zeros. The right behavior in such cases is stated in instruction
    reference manual and is as follows:
    
       fs  ft       MAX     MIN       MAXA    MINA
      ---------------------------------------------
        0   0        0       0         0       0
        0  -0        0      -0         0      -0
       -0   0        0      -0         0      -0
       -0  -0       -0      -0        -0      -0
    
    Prior to this patch, some of the above cases were yielding correct
    results. However, for the sake of code consistency, all such cases
    are rewritten in this patch.
    
    A relevant example:
    
    MAX.S fd,fs,ft:
      If fs contains +0.0, and ft contains -0.0, fd is going to contain
      +0.0 (without this patch, it used to contain -0.0).
    
    Fixes: a79f5f9 ("MIPS: math-emu: Add support for the MIPS R6 MAX{, A} FPU instruction")
    Fixes: 4e9561b ("MIPS: math-emu: Add support for the MIPS R6 MIN{, A} FPU instruction")
    
    Signed-off-by: Miodrag Dinic <[email protected]>
    Signed-off-by: Goran Ferenc <[email protected]>
    Signed-off-by: Aleksandar Markovic <[email protected]>
    Reviewed-by: James Hogan <[email protected]>
    Cc: Bo Hu <[email protected]>
    Cc: Douglas Leung <[email protected]>
    Cc: Jin Qian <[email protected]>
    Cc: Paul Burton <[email protected]>
    Cc: Petar Jovanovic <[email protected]>
    Cc: Raghu Gandham <[email protected]>
    Cc: [email protected]
    Cc: [email protected]
    Patchwork: https://patchwork.linux-mips.org/patch/16881/
    Signed-off-by: Ralf Baechle <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    aleksandar-markovic authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    694f6ea View commit details
    Browse the repository at this point in the history
  15. MIPS: math-emu: <MAX|MIN>.<D|S>: Fix cases of both inputs negative

    commit aabf5cf upstream.
    
    Fix the value returned by <MAX|MIN>.<D|S>, if both inputs are negative
    normal fp numbers. The previous logic did not take into account that
    if both inputs have the same sign, there should be separate treatment
    of the cases when both inputs are negative and when both inputs are
    positive.
    
    A relevant example:
    
    MAX.S fd,fs,ft:
      If fs contains -5.0, and ft contains -7.0, fd is going to contain
      -5.0 (without this patch, it used to contain -7.0).
    
    Fixes: a79f5f9 ("MIPS: math-emu: Add support for the MIPS R6 MAX{, A} FPU instruction")
    Fixes: 4e9561b ("MIPS: math-emu: Add support for the MIPS R6 MIN{, A} FPU instruction")
    
    Signed-off-by: Miodrag Dinic <[email protected]>
    Signed-off-by: Goran Ferenc <[email protected]>
    Signed-off-by: Aleksandar Markovic <[email protected]>
    Reviewed-by: James Hogan <[email protected]>
    Cc: Bo Hu <[email protected]>
    Cc: Douglas Leung <[email protected]>
    Cc: Jin Qian <[email protected]>
    Cc: Paul Burton <[email protected]>
    Cc: Petar Jovanovic <[email protected]>
    Cc: Raghu Gandham <[email protected]>
    Cc: [email protected]
    Cc: [email protected]
    Patchwork: https://patchwork.linux-mips.org/patch/16882/
    Signed-off-by: Ralf Baechle <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    aleksandar-markovic authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    d2b6fcb View commit details
    Browse the repository at this point in the history
  16. MIPS: math-emu: <MAXA|MINA>.<D|S>: Fix cases of input values with opp…

    …osite signs
    
    commit 1a41b3b upstream.
    
    Fix the value returned by <MAXA|MINA>.<D|S>, if the inputs are normal
    fp numbers of the same absolute value, but opposite signs.
    
    A relevant example:
    
    MAXA.S fd,fs,ft:
      If fs contains -3.0, and ft contains +3.0, fd is going to contain
      +3.0 (without this patch, it used to contain -3.0).
    
    Fixes: a79f5f9 ("MIPS: math-emu: Add support for the MIPS R6 MAX{, A} FPU instruction")
    Fixes: 4e9561b ("MIPS: math-emu: Add support for the MIPS R6 MIN{, A} FPU instruction")
    
    Signed-off-by: Miodrag Dinic <[email protected]>
    Signed-off-by: Goran Ferenc <[email protected]>
    Signed-off-by: Aleksandar Markovic <[email protected]>
    Reviewed-by: James Hogan <[email protected]>
    Cc: Bo Hu <[email protected]>
    Cc: Douglas Leung <[email protected]>
    Cc: Jin Qian <[email protected]>
    Cc: Paul Burton <[email protected]>
    Cc: Petar Jovanovic <[email protected]>
    Cc: Raghu Gandham <[email protected]>
    Cc: [email protected]
    Cc: [email protected]
    Patchwork: https://patchwork.linux-mips.org/patch/16883/
    Signed-off-by: Ralf Baechle <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    aleksandar-markovic authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    a04d537 View commit details
    Browse the repository at this point in the history
  17. MIPS: math-emu: <MAXA|MINA>.<D|S>: Fix cases of both infinite inputs

    commit 3444c4e upstream.
    
    Fix the value returned by <MAXA|MINA>.<D|S> fd,fs,ft, if both inputs
    are infinite. The previous implementation returned always the value
    contained in ft in such cases. The correct behavior is specified
    in Mips instruction set manual and is as follows:
    
        fs    ft        MAXA     MINA
      ---------------------------------
        inf   inf        inf      inf
        inf  -inf        inf     -inf
       -inf   inf        inf     -inf
       -inf  -inf       -inf     -inf
    
    A relevant example:
    
    MAXA.S fd,fs,ft:
      If fs contains +inf, and ft contains -inf, fd is going to contain
      +inf (without this patch, it used to contain -inf).
    
    Fixes: a79f5f9 ("MIPS: math-emu: Add support for the MIPS R6 MAX{, A} FPU instruction")
    Fixes: 4e9561b ("MIPS: math-emu: Add support for the MIPS R6 MIN{, A} FPU instruction")
    
    Signed-off-by: Miodrag Dinic <[email protected]>
    Signed-off-by: Goran Ferenc <[email protected]>
    Signed-off-by: Aleksandar Markovic <[email protected]>
    Reviewed-by: James Hogan <[email protected]>
    Cc: Bo Hu <[email protected]>
    Cc: Douglas Leung <[email protected]>
    Cc: Jin Qian <[email protected]>
    Cc: Paul Burton <[email protected]>
    Cc: Petar Jovanovic <[email protected]>
    Cc: Raghu Gandham <[email protected]>
    Cc: [email protected]
    Cc: [email protected]
    Patchwork: https://patchwork.linux-mips.org/patch/16884/
    Signed-off-by: Ralf Baechle <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    aleksandar-markovic authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    f7d36f6 View commit details
    Browse the repository at this point in the history
  18. MIPS: math-emu: MINA.<D|S>: Fix some cases of infinity and zero inputs

    commit 304bfe4 upstream.
    
    Fix following special cases for MINA>.<D|S>:
    
      - if one of the inputs is zero, and the other is subnormal, normal,
        or infinity, the  value of the former should be returned (that is,
        a zero).
      - if one of the inputs is infinity, and the other input is normal,
        or subnormal, the value of the latter should be returned.
    
    The previous implementation's logic for such cases was incorrect - it
    appears as if it implements MAXA, and not MINA instruction.
    
    A relevant example:
    
    MINA.S fd,fs,ft:
      If fs contains 100.0, and ft contains 0.0, fd is going to contain
      0.0 (without this patch, it used to contain 100.0).
    
    Fixes: a79f5f9 ("MIPS: math-emu: Add support for the MIPS R6 MAX{, A} FPU instruction")
    Fixes: 4e9561b ("MIPS: math-emu: Add support for the MIPS R6 MIN{, A} FPU instruction")
    
    Signed-off-by: Miodrag Dinic <[email protected]>
    Signed-off-by: Goran Ferenc <[email protected]>
    Signed-off-by: Aleksandar Markovic <[email protected]>
    Reviewed-by: James Hogan <[email protected]>
    Cc: Bo Hu <[email protected]>
    Cc: Douglas Leung <[email protected]>
    Cc: Jin Qian <[email protected]>
    Cc: Paul Burton <[email protected]>
    Cc: Petar Jovanovic <[email protected]>
    Cc: Raghu Gandham <[email protected]>
    Cc: [email protected]
    Cc: [email protected]
    Patchwork: https://patchwork.linux-mips.org/patch/16885/
    Signed-off-by: Ralf Baechle <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    aleksandar-markovic authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    9381a99 View commit details
    Browse the repository at this point in the history
  19. MIPS: math-emu: Handle zero accumulator case in MADDF and MSUBF separ…

    …ately
    
    commit ddbfff7 upstream.
    
    If accumulator value is zero, just return the value of previously
    calculated product. This brings logic in MADDF/MSUBF implementation
    closer to the logic in ADD/SUB case.
    
    Signed-off-by: Miodrag Dinic <[email protected]>
    Signed-off-by: Goran Ferenc <[email protected]>
    Signed-off-by: Aleksandar Markovic <[email protected]>
    Cc: [email protected]
    Cc: [email protected]
    Cc: [email protected]
    Cc: [email protected]
    Cc: [email protected]
    Cc: [email protected]
    Cc: [email protected]
    Patchwork: https://patchwork.linux-mips.org/patch/16512/
    Signed-off-by: Ralf Baechle <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    aleksandar-markovic authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    4e0694a View commit details
    Browse the repository at this point in the history
  20. MIPS: math-emu: <MADDF|MSUBF>.<D|S>: Fix NaN propagation

    commit e840be6 upstream.
    
    Fix the cases of <MADDF|MSUBF>.<D|S> when any of three inputs is any
    NaN. Correct behavior of <MADDF|MSUBF>.<D|S> fd, fs, ft is following:
    
      - if any of inputs is sNaN, return a sNaN using following rules: if
        only one input is sNaN, return that one; if more than one input is
        sNaN, order of precedence for return value is fd, fs, ft
      - if no input is sNaN, but at least one of inputs is qNaN, return a
        qNaN using following rules: if only one input is qNaN, return that
        one; if more than one input is qNaN, order of precedence for
        return value is fd, fs, ft
    
    The previous code contained correct handling of some above cases, but
    not all. Also, such handling was scattered into various cases of
    "switch (CLPAIR(xc, yc))" statement, and elsewhere. With this patch,
    this logic is placed in one place, and "switch (CLPAIR(xc, yc))" is
    significantly simplified.
    
    A relevant example:
    
    MADDF.S fd,fs,ft:
      If fs contains qNaN1, ft contains qNaN2, and fd contains qNaN3, fd
      is going to contain qNaN3 (without this patch, it used to contain
      qNaN1).
    
    Fixes: e24c3be ("MIPS: math-emu: Add support for the MIPS R6 MADDF FPU instruction")
    Fixes: 83d4330 ("MIPS: math-emu: Add support for the MIPS R6 MSUBF FPU instruction")
    
    Signed-off-by: Miodrag Dinic <[email protected]>
    Signed-off-by: Goran Ferenc <[email protected]>
    Signed-off-by: Aleksandar Markovic <[email protected]>
    Reviewed-by: James Hogan <[email protected]>
    Cc: Bo Hu <[email protected]>
    Cc: Douglas Leung <[email protected]>
    Cc: Jin Qian <[email protected]>
    Cc: Paul Burton <[email protected]>
    Cc: Petar Jovanovic <[email protected]>
    Cc: Raghu Gandham <[email protected]>
    Cc: [email protected]
    Cc: [email protected]
    Patchwork: https://patchwork.linux-mips.org/patch/16886/
    Signed-off-by: Ralf Baechle <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    aleksandar-markovic authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    4f8479c View commit details
    Browse the repository at this point in the history
  21. MIPS: math-emu: <MADDF|MSUBF>.<D|S>: Fix some cases of infinite inputs

    commit 0c64fe6 upstream.
    
    Fix the cases of <MADDF|MSUBF>.<D|S> when any of two multiplicands is
    infinity. The correct behavior in such cases is affected by the nature
    of third input. Cases of addition of infinities with opposite signs
    and subtraction of infinities with same signs may arise and must be
    handles separately. Also, the value od flags argument (that determines
    whether the instruction is MADDF or MSUBF) affects the outcome.
    
    Relevant examples:
    
    MADDF.S fd,fs,ft:
      If fs contains +inf, ft contains +inf, and fd contains -inf, fd is
      going to contain indef (without this patch, it used to contain
      -inf).
    
    MSUBF.S fd,fs,ft:
      If fs contains +inf, ft contains 1.0, and fd contains +0.0, fd is
      going to contain -inf (without this patch, it used to contain +inf).
    
    Fixes: e24c3be ("MIPS: math-emu: Add support for the MIPS R6 MADDF FPU instruction")
    Fixes: 83d4330 ("MIPS: math-emu: Add support for the MIPS R6 MSUBF FPU instruction")
    
    Signed-off-by: Douglas Leung <[email protected]>
    Signed-off-by: Miodrag Dinic <[email protected]>
    Signed-off-by: Goran Ferenc <[email protected]>
    Signed-off-by: Aleksandar Markovic <[email protected]>
    Reviewed-by: James Hogan <[email protected]>
    Cc: Douglas Leung <[email protected]>
    Cc: Bo Hu <[email protected]>
    Cc: Jin Qian <[email protected]>
    Cc: Paul Burton <[email protected]>
    Cc: Petar Jovanovic <[email protected]>
    Cc: Raghu Gandham <[email protected]>
    Cc: [email protected]
    Cc: [email protected]
    Patchwork: https://patchwork.linux-mips.org/patch/16887/
    Signed-off-by: Ralf Baechle <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    aleksandar-markovic authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    8981bca View commit details
    Browse the repository at this point in the history
  22. MIPS: math-emu: <MADDF|MSUBF>.<D|S>: Fix some cases of zero inputs

    commit 7cf64ce upstream.
    
    Fix the cases of <MADDF|MSUBF>.<D|S> when any of two multiplicands is
    +0 or -0, and the third input is also +0 or -0. Depending on the signs
    of inputs, certain special cases must be handled.
    
    A relevant example:
    
    MADDF.S fd,fs,ft:
      If fs contains +0.0, ft contains -0.0, and fd contains 0.0, fd is
      going to contain +0.0 (without this patch, it used to contain -0.0).
    
    Fixes: e24c3be ("MIPS: math-emu: Add support for the MIPS R6 MADDF FPU instruction")
    Fixes: 83d4330 ("MIPS: math-emu: Add support for the MIPS R6 MSUBF FPU instruction")
    
    Signed-off-by: Miodrag Dinic <[email protected]>
    Signed-off-by: Goran Ferenc <[email protected]>
    Signed-off-by: Aleksandar Markovic <[email protected]>
    Reviewed-by: James Hogan <[email protected]>
    Cc: Bo Hu <[email protected]>
    Cc: Douglas Leung <[email protected]>
    Cc: Jin Qian <[email protected]>
    Cc: Paul Burton <[email protected]>
    Cc: Petar Jovanovic <[email protected]>
    Cc: Raghu Gandham <[email protected]>
    Cc: [email protected]
    Cc: [email protected]
    Patchwork: https://patchwork.linux-mips.org/patch/16888/
    Signed-off-by: Ralf Baechle <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    aleksandar-markovic authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    d56a9ca View commit details
    Browse the repository at this point in the history
  23. MIPS: math-emu: <MADDF|MSUBF>.<D|S>: Clean up "maddf_flags" enumeration

    commit ae11c06 upstream.
    
    Fix definition and usage of "maddf_flags" enumeration. Avoid duplicate
    definition and apply more common capitalization.
    
    This patch does not change any scenario. It just makes MADDF and
    MSUBF emulation code more readable and easier to maintain, and
    hopefully prevents future bugs as well.
    
    Signed-off-by: Miodrag Dinic <[email protected]>
    Signed-off-by: Goran Ferenc <[email protected]>
    Signed-off-by: Aleksandar Markovic <[email protected]>
    Reviewed-by: James Hogan <[email protected]>
    Cc: Bo Hu <[email protected]>
    Cc: Douglas Leung <[email protected]>
    Cc: Jin Qian <[email protected]>
    Cc: Paul Burton <[email protected]>
    Cc: Petar Jovanovic <[email protected]>
    Cc: Raghu Gandham <[email protected]>
    Cc: [email protected]
    Cc: [email protected]
    Patchwork: https://patchwork.linux-mips.org/patch/16889/
    Signed-off-by: Ralf Baechle <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    aleksandar-markovic authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    5cabf99 View commit details
    Browse the repository at this point in the history
  24. MIPS: math-emu: <MADDF|MSUBF>.S: Fix accuracy (32-bit case)

    commit b3b8e1e upstream.
    
    Implement fused multiply-add with correct accuracy.
    
    Fused multiply-add operation has better accuracy than respective
    sequential execution of multiply and add operations applied on the
    same inputs. This is because accuracy errors accumulate in latter
    case.
    
    This patch implements fused multiply-add with the same accuracy
    as it is implemented in hardware, using 64-bit intermediate
    calculations.
    
    One test case example (raw bits) that this patch fixes:
    
    MADDF.S fd,fs,ft:
      fd = 0x22575225
      fs = ft = 0x3727c5ac
    
    Fixes: e24c3be ("MIPS: math-emu: Add support for the MIPS R6 MADDF FPU instruction")
    Fixes: 83d4330 ("MIPS: math-emu: Add support for the MIPS R6 MSUBF FPU instruction")
    
    Signed-off-by: Douglas Leung <[email protected]>
    Signed-off-by: Miodrag Dinic <[email protected]>
    Signed-off-by: Goran Ferenc <[email protected]>
    Signed-off-by: Aleksandar Markovic <[email protected]>
    Cc: Douglas Leung <[email protected]>
    Cc: Bo Hu <[email protected]>
    Cc: James Hogan <[email protected]>
    Cc: Jin Qian <[email protected]>
    Cc: Paul Burton <[email protected]>
    Cc: Petar Jovanovic <[email protected]>
    Cc: Raghu Gandham <[email protected]>
    Cc: [email protected]
    Cc: [email protected]
    Patchwork: https://patchwork.linux-mips.org/patch/16890/
    Signed-off-by: Ralf Baechle <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Douglas Leung authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    d2b488e View commit details
    Browse the repository at this point in the history
  25. MIPS: math-emu: <MADDF|MSUBF>.D: Fix accuracy (64-bit case)

    commit 2cfa582 upstream.
    
    Implement fused multiply-add with correct accuracy.
    
    Fused multiply-add operation has better accuracy than respective
    sequential execution of multiply and add operations applied on the
    same inputs. This is because accuracy errors accumulate in latter
    case.
    
    This patch implements fused multiply-add with the same accuracy
    as it is implemented in hardware, using 128-bit intermediate
    calculations.
    
    One test case example (raw bits) that this patch fixes:
    
    MADDF.D fd,fs,ft:
      fd = 0x00000ca000000000
      fs = ft = 0x3f40624dd2f1a9fc
    
    Fixes: e24c3be ("MIPS: math-emu: Add support for the MIPS R6 MADDF FPU instruction")
    Fixes: 83d4330 ("MIPS: math-emu: Add support for the MIPS R6 MSUBF FPU instruction")
    
    Signed-off-by: Douglas Leung <[email protected]>
    Signed-off-by: Miodrag Dinic <[email protected]>
    Signed-off-by: Goran Ferenc <[email protected]>
    Signed-off-by: Aleksandar Markovic <[email protected]>
    Cc: Douglas Leung <[email protected]>
    Cc: Bo Hu <[email protected]>
    Cc: James Hogan <[email protected]>
    Cc: Jin Qian <[email protected]>
    Cc: Paul Burton <[email protected]>
    Cc: Petar Jovanovic <[email protected]>
    Cc: Raghu Gandham <[email protected]>
    Cc: [email protected]
    Cc: [email protected]
    Patchwork: https://patchwork.linux-mips.org/patch/16891/
    Signed-off-by: Ralf Baechle <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Douglas Leung authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    1f143ba View commit details
    Browse the repository at this point in the history
  26. crypto: ccp - Fix XTS-AES-128 support on v5 CCPs

    commit e652399 upstream.
    
    Version 5 CCPs have some new requirements for XTS-AES: the type field
    must be specified, and the key requires 512 bits, with each part
    occupying 256 bits and padded with zeroes.
    
    Signed-off-by: Gary R Hook <[email protected]>
    Signed-off-by: Herbert Xu <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    garyrhook authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    dcb3a4b View commit details
    Browse the repository at this point in the history
  27. crypto: AF_ALG - remove SGL terminator indicator when chaining

    Fixed differently upstream as commit 2d97591 ("crypto: af_alg - consolidation of duplicate code")
    
    The SGL is MAX_SGL_ENTS + 1 in size. The last SG entry is used for the
    chaining and is properly updated with the sg_chain invocation. During
    the filling-in of the initial SG entries, sg_mark_end is called for each
    SG entry. This is appropriate as long as no additional SGL is chained
    with the current SGL. However, when a new SGL is chained and the last
    SG entry is updated with sg_chain, the last but one entry still contains
    the end marker from the sg_mark_end. This end marker must be removed as
    otherwise a walk of the chained SGLs will cause a NULL pointer
    dereference at the last but one SG entry, because sg_next will return
    NULL.
    
    The patch only applies to all kernels up to and including 4.13. The
    patch 2d97591 added to 4.14-rc1
    introduced a complete new code base which addresses this bug in
    a different way. Yet, that patch is too invasive for stable kernels
    and was therefore not marked for stable.
    
    Fixes: 8ff5909 ("crypto: algif_skcipher - User-space interface for skcipher operations")
    Signed-off-by: Stephan Mueller <[email protected]>
    Acked-by: Herbert Xu <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    smuellerDD authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    e684db9 View commit details
    Browse the repository at this point in the history
  28. ext4: fix incorrect quotaoff if the quota feature is enabled

    commit b0a5a95 upstream.
    
    Current ext4 quota should always "usage enabled" if the
    quota feautre is enabled. But in ext4_orphan_cleanup(), it
    turn quotas off directly (used for the older journaled
    quota), so we cannot turn it on again via "quotaon" unless
    umount and remount ext4.
    
    Simple reproduce:
    
      mkfs.ext4 -O project,quota /dev/vdb1
      mount -o prjquota /dev/vdb1 /mnt
      chattr -p 123 /mnt
      chattr +P /mnt
      touch /mnt/aa /mnt/bb
      exec 100<>/mnt/aa
      rm -f /mnt/aa
      sync
      echo c > /proc/sysrq-trigger
    
      #reboot and mount
      mount -o prjquota /dev/vdb1 /mnt
      #query status
      quotaon -Ppv /dev/vdb1
      #output
      quotaon: Cannot find mountpoint for device /dev/vdb1
      quotaon: No correct mountpoint specified.
    
    This patch add check for journaled quotas to avoid incorrect
    quotaoff when ext4 has quota feautre.
    
    Signed-off-by: zhangyi (F) <[email protected]>
    Signed-off-by: Theodore Ts'o <[email protected]>
    Reviewed-by: Jan Kara <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    zhangyi089 authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    18d27cb View commit details
    Browse the repository at this point in the history
  29. ext4: fix quota inconsistency during orphan cleanup for read-only mounts

    commit 95f1fda upstream.
    
    Quota does not get enabled for read-only mounts if filesystem
    has quota feature, so that quotas cannot updated during orphan
    cleanup, which will lead to quota inconsistency.
    
    This patch turn on quotas during orphan cleanup for this case,
    make sure quotas can be updated correctly.
    
    Reported-by: Jan Kara <[email protected]>
    Signed-off-by: zhangyi (F) <[email protected]>
    Signed-off-by: Theodore Ts'o <[email protected]>
    Reviewed-by: Jan Kara <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    zhangyi089 authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    3806cea View commit details
    Browse the repository at this point in the history
  30. powerpc: Fix DAR reporting when alignment handler faults

    commit f9effe9 upstream.
    
    Anton noticed that if we fault part way through emulating an unaligned
    instruction, we don't update the DAR to reflect that.
    
    The DAR value is eventually reported back to userspace as the address
    in the SEGV signal, and if userspace is using that value to demand
    fault then it can be confused by us not setting the value correctly.
    
    This patch is ugly as hell, but is intended to be the minimal fix and
    back ports easily.
    
    Signed-off-by: Michael Ellerman <[email protected]>
    Reviewed-by: Paul Mackerras <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    mpe authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    48564b5 View commit details
    Browse the repository at this point in the history
  31. block: Relax a check in blk_start_queue()

    commit 4ddd56b upstream.
    
    Calling blk_start_queue() from interrupt context with the queue
    lock held and without disabling IRQs, as the skd driver does, is
    safe. This patch avoids that loading the skd driver triggers the
    following warning:
    
    WARNING: CPU: 11 PID: 1348 at block/blk-core.c:283 blk_start_queue+0x84/0xa0
    RIP: 0010:blk_start_queue+0x84/0xa0
    Call Trace:
     skd_unquiesce_dev+0x12a/0x1d0 [skd]
     skd_complete_internal+0x1e7/0x5a0 [skd]
     skd_complete_other+0xc2/0xd0 [skd]
     skd_isr_completion_posted.isra.30+0x2a5/0x470 [skd]
     skd_isr+0x14f/0x180 [skd]
     irq_forced_thread_fn+0x2a/0x70
     irq_thread+0x144/0x1a0
     kthread+0x125/0x140
     ret_from_fork+0x2a/0x40
    
    Fixes: commit a038e25 ("[PATCH] blk_start_queue() must be called with irq disabled - add warning")
    Signed-off-by: Bart Van Assche <[email protected]>
    Cc: Paolo 'Blaisorblade' Giarrusso <[email protected]>
    Cc: Andrew Morton <[email protected]>
    Cc: Christoph Hellwig <[email protected]>
    Cc: Hannes Reinecke <[email protected]>
    Cc: Johannes Thumshirn <[email protected]>
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    KAGA-KOKO authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    120ec1e View commit details
    Browse the repository at this point in the history
  32. md/bitmap: disable bitmap_resize for file-backed bitmaps.

    commit e8a27f8 upstream.
    
    bitmap_resize() does not work for file-backed bitmaps.
    The buffer_heads are allocated and initialized when
    the bitmap is read from the file, but resize doesn't
    read from the file, it loads from the internal bitmap.
    When it comes time to write the new bitmap, the bh is
    non-existent and we crash.
    
    The common case when growing an array involves making the array larger,
    and that normally means making the bitmap larger.  Doing
    that inside the kernel is possible, but would need more code.
    It is probably easier to require people who use file-backed
    bitmaps to remove them and re-add after a reshape.
    
    So this patch disables the resizing of arrays which have
    file-backed bitmaps.  This is better than crashing.
    
    Reported-by: Zhilong Liu <[email protected]>
    Fixes: d60b479 ("md/bitmap: add bitmap_resize function to allow bitmap resizing.")
    Signed-off-by: NeilBrown <[email protected]>
    Signed-off-by: Shaohua Li <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    NeilBrown authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    2cee780 View commit details
    Browse the repository at this point in the history
  33. skd: Avoid that module unloading triggers a use-after-free

    commit 7277cc6 upstream.
    
    Since put_disk() triggers a disk_release() call and since that
    last function calls blk_put_queue() if disk->queue != NULL, clear
    the disk->queue pointer before calling put_disk(). This avoids
    that unloading the skd kernel module triggers the following
    use-after-free:
    
    WARNING: CPU: 8 PID: 297 at lib/refcount.c:128 refcount_sub_and_test+0x70/0x80
    refcount_t: underflow; use-after-free.
    CPU: 8 PID: 297 Comm: kworker/8:1 Not tainted 4.11.10-300.fc26.x86_64 linux4sam#1
    Workqueue: events work_for_cpu_fn
    Call Trace:
     dump_stack+0x63/0x84
     __warn+0xcb/0xf0
     warn_slowpath_fmt+0x5a/0x80
     refcount_sub_and_test+0x70/0x80
     refcount_dec_and_test+0x11/0x20
     kobject_put+0x1f/0x50
     blk_put_queue+0x15/0x20
     disk_release+0xae/0xf0
     device_release+0x32/0x90
     kobject_release+0x67/0x170
     kobject_put+0x2b/0x50
     put_disk+0x17/0x20
     skd_destruct+0x5c/0x890 [skd]
     skd_pci_probe+0x124d/0x13a0 [skd]
     local_pci_probe+0x42/0xa0
     work_for_cpu_fn+0x14/0x20
     process_one_work+0x19e/0x470
     worker_thread+0x1dc/0x4a0
     kthread+0x125/0x140
     ret_from_fork+0x25/0x30
    
    Signed-off-by: Bart Van Assche <[email protected]>
    Cc: Christoph Hellwig <[email protected]>
    Cc: Hannes Reinecke <[email protected]>
    Cc: Johannes Thumshirn <[email protected]>
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    KAGA-KOKO authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    cb1441b View commit details
    Browse the repository at this point in the history
  34. skd: Submit requests to firmware before triggering the doorbell

    commit 5fbd545 upstream.
    
    Ensure that the members of struct skd_msg_buf have been transferred
    to the PCIe adapter before the doorbell is triggered. This patch
    avoids that I/O fails sporadically and that the following error
    message is reported:
    
    (skd0:STM000196603:[0000:00:09.0]): Completion mismatch comp_id=0x0000 skreq=0x0400 new=0x0000
    
    Signed-off-by: Bart Van Assche <[email protected]>
    Cc: Christoph Hellwig <[email protected]>
    Cc: Hannes Reinecke <[email protected]>
    Cc: Johannes Thumshirn <[email protected]>
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    KAGA-KOKO authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    63e606b View commit details
    Browse the repository at this point in the history
  35. scsi: zfcp: fix queuecommand for scsi_eh commands when DIX enabled

    commit 71b8e45 upstream.
    
    Since commit db007fc ("[SCSI] Command protection operation"),
    scsi_eh_prep_cmnd() saves scmd->prot_op and temporarily resets it to
    SCSI_PROT_NORMAL.
    Other FCP LLDDs such as qla2xxx and lpfc shield their queuecommand()
    to only access any of scsi_prot_sg...() if
    (scsi_get_prot_op(cmd) != SCSI_PROT_NORMAL).
    
    Do the same thing for zfcp, which introduced DIX support with
    commit ef3eb71 ("[SCSI] zfcp: Introduce experimental support for
    DIF/DIX").
    
    Otherwise, TUR SCSI commands as part of scsi_eh likely fail in zfcp,
    because the regular SCSI command with DIX protection data, that scsi_eh
    re-uses in scsi_send_eh_cmnd(), of course still has
    (scsi_prot_sg_count() != 0) and so zfcp sends down bogus requests to the
    FCP channel hardware.
    
    This causes scsi_eh_test_devices() to have (finish_cmds == 0)
    [not SCSI device is online or not scsi_eh_tur() failed]
    so regular SCSI commands, that caused / were affected by scsi_eh,
    are moved to work_q and scsi_eh_test_devices() itself returns false.
    In turn, it unnecessarily escalates in our case in scsi_eh_ready_devs()
    beyond host reset to finally scsi_eh_offline_sdevs()
    which sets affected SCSI devices offline with the following kernel message:
    
    "kernel: sd H:0:T:L: Device offlined - not ready after error recovery"
    
    Signed-off-by: Steffen Maier <[email protected]>
    Fixes: ef3eb71 ("[SCSI] zfcp: Introduce experimental support for DIF/DIX")
    Reviewed-by: Benjamin Block <[email protected]>
    Signed-off-by: Benjamin Block <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    steffen-maier authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    83245cd View commit details
    Browse the repository at this point in the history
  36. scsi: zfcp: add handling for FCP_RESID_OVER to the fcp ingress path

    commit a099b7b upstream.
    
    Up until now zfcp would just ignore the FCP_RESID_OVER flag in the FCP
    response IU. When this flag is set, it is possible, in regards to the
    FCP standard, that the storage-server processes the command normally, up
    to the point where data is missing and simply ignores those.
    
    In this case no CHECK CONDITION would be set, and because we ignored the
    FCP_RESID_OVER flag we resulted in at least a data loss or even
    -corruption as a follow-up error, depending on how the
    applications/layers on top behave. To prevent this, we now set the
    host-byte of the corresponding scsi_cmnd to DID_ERROR.
    
    Other storage-behaviors, where the same condition results in a CHECK
    CONDITION set in the answer, don't need to be changed as they are
    handled in the mid-layer already.
    
    Following is an example trace record decoded with zfcpdbf from the
    s390-tools package. We forcefully injected a fc_dl which is one byte too
    small:
    
    Timestamp      : ...
    Area           : SCSI
    Subarea        : 00
    Level          : 3
    Exception      : -
    CPU ID         : ..
    Caller         : 0x...
    Record ID      : 1
    Tag            : rsl_err
    Request ID     : 0x...
    SCSI ID        : 0x...
    SCSI LUN       : 0x...
    SCSI result    : 0x00070000
                         ^^DID_ERROR
    SCSI retries   : 0x..
    SCSI allowed   : 0x..
    SCSI scribble  : 0x...
    SCSI opcode    : 2a000000 00000000 08000000 00000000
    FCP rsp inf cod: 0x00
    FCP rsp IU     : 00000000 00000000 00000400 00000001
                                           ^^fr_flags==FCP_RESID_OVER
                                             ^^fr_status==SAM_STAT_GOOD
                                                ^^^^^^^^fr_resid
                     00000000 00000000
    
    As of now, we don't actively handle to possibility that a response IU
    has both flags - FCP_RESID_OVER and FCP_RESID_UNDER - set at once.
    
    Reported-by: Luke M. Hopkins <[email protected]>
    Reviewed-by: Steffen Maier <[email protected]>
    Fixes: 553448f ("[SCSI] zfcp: Message cleanup")
    Fixes: ea127f975424 ("[PATCH] s390 (7/7): zfcp host adapter.") (tglx/history.git)
    Signed-off-by: Benjamin Block <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Benjamin-Block authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    88187de View commit details
    Browse the repository at this point in the history
  37. scsi: zfcp: fix capping of unsuccessful GPN_FT SAN response trace rec…

    …ords
    
    commit 975171b upstream.
    
    v4.9 commit aceeffb ("zfcp: trace full payload of all SAN records
    (req,resp,iels)") fixed trace data loss of 2.6.38 commit 2c55b75
    ("[SCSI] zfcp: Redesign of the debug tracing for SAN records.")
    necessary for problem determination, e.g. to see the
    currently active zone set during automatic port scan.
    
    While it already saves space by not dumping any empty residual entries
    of the large successful GPN_FT response (4 pages), there are seldom cases
    where the GPN_FT response is unsuccessful and likely does not have
    FC_NS_FID_LAST set in fp_flags so we did not cap the trace record.
    We typically see such case for an initiator WWPN, which is not in any zone.
    
    Cap unsuccessful responses to at least the actual basic CT_IU response
    plus whatever fits the SAN trace record built-in "payload" buffer
    just in case there's trailing information
    of which we would at least see the existence and its beginning.
    
    In order not to erroneously cap successful responses, we need to swap
    calling the trace function and setting the CT / ELS status to success (0).
    
    Example trace record pair formatted with zfcpdbf:
    
    Timestamp      : ...
    Area           : SAN
    Subarea        : 00
    Level          : 1
    Exception      : -
    CPU ID         : ..
    Caller         : 0x...
    Record ID      : 1
    Tag            : fssct_1
    Request ID     : 0x<request_id>
    Destination ID : 0x00fffffc
    SAN req short  : 01000000 fc020000 01720ffc 00000000
                     00000008
    SAN req length : 20
    |
    Timestamp      : ...
    Area           : SAN
    Subarea        : 00
    Level          : 1
    Exception      : -
    CPU ID         : ..
    Caller         : 0x...
    Record ID      : 2
    Tag            : fsscth2
    Request ID     : 0x<request_id>
    Destination ID : 0x00fffffc
    SAN resp short : 01000000 fc020000 80010000 00090700
                     00000000 00000000 00000000 00000000 [trailing info]
                     00000000 00000000 00000000 00000000 [trailing info]
    SAN resp length: 16384
    San resp info  : 01000000 fc020000 80010000 00090700
                     00000000 00000000 00000000 00000000 [trailing info]
                     00000000 00000000 00000000 00000000 [trailing info]
                     00000000 00000000 00000000 00000000 [trailing info]
                     00000000 00000000 00000000 00000000 [trailing info]
                     00000000 00000000 00000000 00000000 [trailing info]
                     00000000 00000000 00000000 00000000 [trailing info]
                     00000000 00000000 00000000 00000000 [trailing info]
                     00000000 00000000 00000000 00000000 [trailing info]
                     00000000 00000000 00000000 00000000 [trailing info]
                     00000000 00000000 00000000 00000000 [trailing info]
                     00000000 00000000 00000000 00000000 [trailing info]
                     00000000 00000000 00000000 00000000 [trailing info]
                     00000000 00000000 00000000 00000000 [trailing info]
                     00000000 00000000 00000000 00000000 [trailing info]
                     00000000 00000000 00000000 00000000 [trailing info]
    
    The fix saves all but one of the previously associated 64 PAYload trace
    record chunks of size 256 bytes each.
    
    Signed-off-by: Steffen Maier <[email protected]>
    Fixes: aceeffb ("zfcp: trace full payload of all SAN records (req,resp,iels)")
    Fixes: 2c55b75 ("[SCSI] zfcp: Redesign of the debug tracing for SAN records.")
    Reviewed-by: Benjamin Block <[email protected]>
    Signed-off-by: Benjamin Block <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    steffen-maier authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    0cbb743 View commit details
    Browse the repository at this point in the history
  38. scsi: zfcp: fix passing fsf_req to SCSI trace on TMF to correlate wit…

    …h HBA
    
    commit 9fe5d2b upstream.
    
    Without this fix we get SCSI trace records on task management functions
    which cannot be correlated to HBA trace records because all fields
    related to the FSF request are empty (zero).
    Also, the FCP_RSP_IU is missing as well as any sense data if available.
    
    This was caused by v2.6.14 commit 8a36e45 ("[SCSI] zfcp: enhancement
    of zfcp debug features") introducing trace records for TMFs but
    hard coding NULL for a possibly existing TMF FSF request.
    The scsi_cmnd scribble is also zero or unrelated for the TMF request
    so it also could not lookup a suitable FSF request from there.
    
    A broken example trace record formatted with zfcpdbf from the s390-tools
    package:
    
    Timestamp      : ...
    Area           : SCSI
    Subarea        : 00
    Level          : 1
    Exception      : -
    CPU ID         : ..
    Caller         : 0x...
    Record ID      : 1
    Tag            : lr_fail
    Request ID     : 0x0000000000000000
                       ^^^^^^^^^^^^^^^^ no correlation to HBA record
    SCSI ID        : 0x<scsitarget>
    SCSI LUN       : 0x<scsilun>
    SCSI result    : 0x000e0000
    SCSI retries   : 0x00
    SCSI allowed   : 0x05
    SCSI scribble  : 0x0000000000000000
    SCSI opcode    : 2a000017 3bb80000 08000000 00000000
    FCP rsp inf cod: 0x00
                       ^^ no TMF response
    FCP rsp IU     : 00000000 00000000 00000000 00000000
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                     00000000 00000000
                     ^^^^^^^^^^^^^^^^^ no interesting FCP_RSP_IU
    Sense len      : ...
    ^^^^^^^^^^^^^^^^^^^^ no sense data length
    Sense info     : ...
    ^^^^^^^^^^^^^^^^^^^^ no sense data content, even if present
    
    There are some true cases where we really do not have an FSF request:
    "rsl_fai" from zfcp_dbf_scsi_fail_send() called for early
    returns / completions in zfcp_scsi_queuecommand(),
    "abrt_or", "abrt_bl", "abrt_ru", "abrt_ar" from
    zfcp_scsi_eh_abort_handler() where we did not get as far,
    "lr_nres", "tr_nres" from zfcp_task_mgmt_function() where we're
    successful and do not need to do anything because adapter stopped.
    For these cases it's correct to pass NULL for fsf_req to _zfcp_dbf_scsi().
    
    Signed-off-by: Steffen Maier <[email protected]>
    Fixes: 8a36e45 ("[SCSI] zfcp: enhancement of zfcp debug features")
    Reviewed-by: Benjamin Block <[email protected]>
    Signed-off-by: Benjamin Block <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    steffen-maier authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    424a20b View commit details
    Browse the repository at this point in the history
  39. scsi: zfcp: fix missing trace records for early returns in TMF eh han…

    …dlers
    
    commit 1a5d999 upstream.
    
    For problem determination we need to see that we were in scsi_eh
    as well as whether and why we were successful or not.
    
    The following commits introduced new early returns without adding
    a trace record:
    
    v2.6.35 commit a1dbfdd
    ("[SCSI] zfcp: Pass return code from fc_block_scsi_eh to scsi eh")
    on fc_block_scsi_eh() returning != 0 which is FAST_IO_FAIL,
    
    v2.6.30 commit 63caf36
    ("[SCSI] zfcp: Improve reliability of SCSI eh handlers in zfcp")
    on not having gotten an FSF request after the maximum number of retry
    attempts and thus could not issue a TMF and has to return FAILED.
    
    Signed-off-by: Steffen Maier <[email protected]>
    Fixes: a1dbfdd ("[SCSI] zfcp: Pass return code from fc_block_scsi_eh to scsi eh")
    Fixes: 63caf36 ("[SCSI] zfcp: Improve reliability of SCSI eh handlers in zfcp")
    Reviewed-by: Benjamin Block <[email protected]>
    Signed-off-by: Benjamin Block <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    steffen-maier authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    8d706e3 View commit details
    Browse the repository at this point in the history
  40. scsi: zfcp: fix payload with full FCP_RSP IU in SCSI trace records

    commit 12c3e57 upstream.
    
    If the FCP_RSP UI has optional parts (FCP_SNS_INFO or FCP_RSP_INFO) and
    thus does not fit into the fsp_rsp field built into a SCSI trace record,
    trace the full FCP_RSP UI with all optional parts as payload record
    instead of just FCP_SNS_INFO as payload and
    a 1 byte RSP_INFO_CODE part of FCP_RSP_INFO built into the SCSI record.
    
    That way we would also get the full FCP_SNS_INFO in case a
    target would ever send more than
    min(SCSI_SENSE_BUFFERSIZE==96, ZFCP_DBF_PAY_MAX_REC==256)==96.
    
    The mandatory part of FCP_RSP IU is only 24 bytes.
    PAYload costs at least one full PAY record of 256 bytes anyway.
    We cap to the hardware response size which is only FSF_FCP_RSP_SIZE==128.
    So we can just put the whole FCP_RSP IU with any optional parts into
    PAYload similarly as we do for SAN PAY since v4.9 commit aceeffb
    ("zfcp: trace full payload of all SAN records (req,resp,iels)").
    This does not cause any additional trace records wasting memory.
    
    Decoded trace records were confusing because they showed a hard-coded
    sense data length of 96 even if the FCP_RSP_IU field FCP_SNS_LEN showed
    actually less.
    
    Since the same commit, we set pl_len for SAN traces to the full length of a
    request/response even if we cap the corresponding trace.
    In contrast, here for SCSI traces we set pl_len to the pre-computed
    length of FCP_RSP IU considering SNS_LEN or RSP_LEN if valid.
    Nonetheless we trace a hardcoded payload of length FSF_FCP_RSP_SIZE==128
    if there were optional parts.
    This makes it easier for the zfcpdbf tool to format only the relevant
    part of the long FCP_RSP UI buffer. And any trailing information is still
    available in the payload trace record just in case.
    
    Rename the payload record tag from "fcp_sns" to "fcp_riu" to make the new
    content explicit to zfcpdbf which can then pick a suitable field name such
    as "FCP rsp IU all:" instead of "Sense info :"
    Also, the same zfcpdbf can still be backwards compatible with "fcp_sns".
    
    Old example trace record before this fix, formatted with the tool zfcpdbf
    from s390-tools:
    
    Timestamp      : ...
    Area           : SCSI
    Subarea        : 00
    Level          : 3
    Exception      : -
    CPU id         : ..
    Caller         : 0x...
    Record id      : 1
    Tag            : rsl_err
    Request id     : 0x<request_id>
    SCSI ID        : 0x...
    SCSI LUN       : 0x...
    SCSI result    : 0x00000002
    SCSI retries   : 0x00
    SCSI allowed   : 0x05
    SCSI scribble  : 0x<request_id>
    SCSI opcode    : 00000000 00000000 00000000 00000000
    FCP rsp inf cod: 0x00
    FCP rsp IU     : 00000000 00000000 00000202 00000000
                                           ^^==FCP_SNS_LEN_VALID
                     00000020 00000000
                     ^^^^^^^^==FCP_SNS_LEN==32
    Sense len      : 96 <==min(SCSI_SENSE_BUFFERSIZE,ZFCP_DBF_PAY_MAX_REC)
    Sense info     : 70000600 00000018 00000000 29000000
                     00000400 00000000 00000000 00000000
                     00000000 00000000 00000000 00000000<==superfluous
                     00000000 00000000 00000000 00000000<==superfluous
                     00000000 00000000 00000000 00000000<==superfluous
                     00000000 00000000 00000000 00000000<==superfluous
    
    New example trace records with this fix:
    
    Timestamp      : ...
    Area           : SCSI
    Subarea        : 00
    Level          : 3
    Exception      : -
    CPU ID         : ..
    Caller         : 0x...
    Record ID      : 1
    Tag            : rsl_err
    Request ID     : 0x<request_id>
    SCSI ID        : 0x...
    SCSI LUN       : 0x...
    SCSI result    : 0x00000002
    SCSI retries   : 0x00
    SCSI allowed   : 0x03
    SCSI scribble  : 0x<request_id>
    SCSI opcode    : a30c0112 00000000 02000000 00000000
    FCP rsp inf cod: 0x00
    FCP rsp IU     : 00000000 00000000 00000a02 00000200
                     00000020 00000000
    FCP rsp IU len : 56
    FCP rsp IU all : 00000000 00000000 00000a02 00000200
                                           ^^=FCP_RESID_UNDER|FCP_SNS_LEN_VALID
                     00000020 00000000 70000500 00000018
                     ^^^^^^^^==FCP_SNS_LEN
                                       ^^^^^^^^^^^^^^^^^
                     00000000 240000cb 00011100 00000000
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                     00000000 00000000
                     ^^^^^^^^^^^^^^^^^==FCP_SNS_INFO
    
    Timestamp      : ...
    Area           : SCSI
    Subarea        : 00
    Level          : 1
    Exception      : -
    CPU ID         : ..
    Caller         : 0x...
    Record ID      : 1
    Tag            : lr_okay
    Request ID     : 0x<request_id>
    SCSI ID        : 0x...
    SCSI LUN       : 0x...
    SCSI result    : 0x00000000
    SCSI retries   : 0x00
    SCSI allowed   : 0x05
    SCSI scribble  : 0x<request_id>
    SCSI opcode    : <CDB of unrelated SCSI command passed to eh handler>
    FCP rsp inf cod: 0x00
    FCP rsp IU     : 00000000 00000000 00000100 00000000
                     00000000 00000008
    FCP rsp IU len : 32
    FCP rsp IU all : 00000000 00000000 00000100 00000000
                                           ^^==FCP_RSP_LEN_VALID
                     00000000 00000008 00000000 00000000
                              ^^^^^^^^==FCP_RSP_LEN
                                       ^^^^^^^^^^^^^^^^^==FCP_RSP_INFO
    
    Signed-off-by: Steffen Maier <[email protected]>
    Fixes: 250a135 ("[SCSI] zfcp: Redesign of the debug tracing for SCSI records.")
    Reviewed-by: Benjamin Block <[email protected]>
    Signed-off-by: Benjamin Block <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    steffen-maier authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    5283787 View commit details
    Browse the repository at this point in the history
  41. scsi: zfcp: trace HBA FSF response by default on dismiss or timedout …

    …late response
    
    commit fdb7cee upstream.
    
    At the default trace level, we only trace unsuccessful events including
    FSF responses.
    
    zfcp_dbf_hba_fsf_response() only used protocol status and FSF status to
    decide on an unsuccessful response. However, this is only one of multiple
    possible sources determining a failed struct zfcp_fsf_req.
    
    An FSF request can also "fail" if its response runs into an ERP timeout
    or if it gets dismissed because a higher level recovery was triggered
    [trace tags "erscf_1" or "erscf_2" in zfcp_erp_strategy_check_fsfreq()].
    FSF requests with ERP timeout are:
    FSF_QTCB_EXCHANGE_CONFIG_DATA, FSF_QTCB_EXCHANGE_PORT_DATA,
    FSF_QTCB_OPEN_PORT_WITH_DID or FSF_QTCB_CLOSE_PORT or
    FSF_QTCB_CLOSE_PHYSICAL_PORT for target ports,
    FSF_QTCB_OPEN_LUN, FSF_QTCB_CLOSE_LUN.
    One example is slow queue processing which can cause follow-on errors,
    e.g. FSF_PORT_ALREADY_OPEN after FSF_QTCB_OPEN_PORT_WITH_DID timed out.
    In order to see the root cause, we need to see late responses even if the
    channel presented them successfully with FSF_PROT_GOOD and FSF_GOOD.
    Example trace records formatted with zfcpdbf from the s390-tools package:
    
    Timestamp      : ...
    Area           : REC
    Subarea        : 00
    Level          : 1
    Exception      : -
    CPU ID         : ..
    Caller         : ...
    Record ID      : 1
    Tag            : fcegpf1
    LUN            : 0xffffffffffffffff
    WWPN           : 0x<WWPN>
    D_ID           : 0x00<D_ID>
    Adapter status : 0x5400050b
    Port status    : 0x41200000
    LUN status     : 0x00000000
    Ready count    : 0x00000001
    Running count  : 0x...
    ERP want       : 0x02				ZFCP_ERP_ACTION_REOPEN_PORT
    ERP need       : 0x02				ZFCP_ERP_ACTION_REOPEN_PORT
    |
    Timestamp      : ...				30 seconds later
    Area           : REC
    Subarea        : 00
    Level          : 1
    Exception      : -
    CPU ID         : ..
    Caller         : ...
    Record ID      : 2
    Tag            : erscf_2
    LUN            : 0xffffffffffffffff
    WWPN           : 0x<WWPN>
    D_ID           : 0x00<D_ID>
    Adapter status : 0x5400050b
    Port status    : 0x41200000
    LUN status     : 0x00000000
    Request ID     : 0x<request_ID>
    ERP status     : 0x10000000			ZFCP_STATUS_ERP_TIMEDOUT
    ERP step       : 0x0800				ZFCP_ERP_STEP_PORT_OPENING
    ERP action     : 0x02				ZFCP_ERP_ACTION_REOPEN_PORT
    ERP count      : 0x00
    |
    Timestamp      : ...				later than previous record
    Area           : HBA
    Subarea        : 00
    Level          : 5	> default level		=> 3	<= default level
    Exception      : -
    CPU ID         : 00
    Caller         : ...
    Record ID      : 1
    Tag            : fs_qtcb			=> fs_rerr
    Request ID     : 0x<request_ID>
    Request status : 0x00001010			ZFCP_STATUS_FSFREQ_DISMISSED
    						| ZFCP_STATUS_FSFREQ_CLEANUP
    FSF cmnd       : 0x00000005
    FSF sequence no: 0x...
    FSF issued     : ...				> 30 seconds ago
    FSF stat       : 0x00000000			FSF_GOOD
    FSF stat qual  : 00000000 00000000 00000000 00000000
    Prot stat      : 0x00000001			FSF_PROT_GOOD
    Prot stat qual : 00000000 00000000 00000000 00000000
    Port handle    : 0x...
    LUN handle     : 0x00000000
    QTCB log length: ...
    QTCB log info  : ...
    
    In case of problems detecting that new responses are waiting on the input
    queue, we sooner or later trigger adapter recovery due to an FSF request
    timeout (trace tag "fsrth_1").
    FSF requests with FSF request timeout are:
    typically FSF_QTCB_ABORT_FCP_CMND; but theoretically also
    FSF_QTCB_EXCHANGE_CONFIG_DATA or FSF_QTCB_EXCHANGE_PORT_DATA via sysfs,
    FSF_QTCB_OPEN_PORT_WITH_DID or FSF_QTCB_CLOSE_PORT for WKA ports,
    FSF_QTCB_FCP_CMND for task management function (LUN / target reset).
    One or more pending requests can meanwhile have FSF_PROT_GOOD and FSF_GOOD
    because the channel filled in the response via DMA into the request's QTCB.
    
    In a theroretical case, inject code can create an erroneous FSF request
    on purpose. If data router is enabled, it uses deferred error reporting.
    A READ SCSI command can succeed with FSF_PROT_GOOD, FSF_GOOD, and
    SAM_STAT_GOOD. But on writing the read data to host memory via DMA,
    it can still fail, e.g. if an intentionally wrong scatter list does not
    provide enough space. Rather than getting an unsuccessful response,
    we get a QDIO activate check which in turn triggers adapter recovery.
    One or more pending requests can meanwhile have FSF_PROT_GOOD and FSF_GOOD
    because the channel filled in the response via DMA into the request's QTCB.
    Example trace records formatted with zfcpdbf from the s390-tools package:
    
    Timestamp      : ...
    Area           : HBA
    Subarea        : 00
    Level          : 6	> default level		=> 3	<= default level
    Exception      : -
    CPU ID         : ..
    Caller         : ...
    Record ID      : 1
    Tag            : fs_norm			=> fs_rerr
    Request ID     : 0x<request_ID2>
    Request status : 0x00001010			ZFCP_STATUS_FSFREQ_DISMISSED
    						| ZFCP_STATUS_FSFREQ_CLEANUP
    FSF cmnd       : 0x00000001
    FSF sequence no: 0x...
    FSF issued     : ...
    FSF stat       : 0x00000000			FSF_GOOD
    FSF stat qual  : 00000000 00000000 00000000 00000000
    Prot stat      : 0x00000001			FSF_PROT_GOOD
    Prot stat qual : ........ ........ 00000000 00000000
    Port handle    : 0x...
    LUN handle     : 0x...
    |
    Timestamp      : ...
    Area           : SCSI
    Subarea        : 00
    Level          : 3
    Exception      : -
    CPU ID         : ..
    Caller         : ...
    Record ID      : 1
    Tag            : rsl_err
    Request ID     : 0x<request_ID2>
    SCSI ID        : 0x...
    SCSI LUN       : 0x...
    SCSI result    : 0x000e0000			DID_TRANSPORT_DISRUPTED
    SCSI retries   : 0x00
    SCSI allowed   : 0x05
    SCSI scribble  : 0x<request_ID2>
    SCSI opcode    : 28...				Read(10)
    FCP rsp inf cod: 0x00
    FCP rsp IU     : 00000000 00000000 00000000 00000000
                                             ^^	SAM_STAT_GOOD
                     00000000 00000000
    
    Only with luck in both above cases, we could see a follow-on trace record
    of an unsuccesful event following a successful but late FSF response with
    FSF_PROT_GOOD and FSF_GOOD. Typically this was the case for I/O requests
    resulting in a SCSI trace record "rsl_err" with DID_TRANSPORT_DISRUPTED
    [On ZFCP_STATUS_FSFREQ_DISMISSED, zfcp_fsf_protstatus_eval() sets
    ZFCP_STATUS_FSFREQ_ERROR seen by the request handler functions as failure].
    However, the reason for this follow-on trace was invisible because the
    corresponding HBA trace record was missing at the default trace level
    (by default hidden records with tags "fs_norm", "fs_qtcb", or "fs_open").
    
    On adapter recovery, after we had shut down the QDIO queues, we perform
    unsuccessful pseudo completions with flag ZFCP_STATUS_FSFREQ_DISMISSED
    for each pending FSF request in zfcp_fsf_req_dismiss_all().
    In order to find the root cause, we need to see all pseudo responses even
    if the channel presented them successfully with FSF_PROT_GOOD and FSF_GOOD.
    
    Therefore, check zfcp_fsf_req.status for ZFCP_STATUS_FSFREQ_DISMISSED
    or ZFCP_STATUS_FSFREQ_ERROR and trace with a new tag "fs_rerr".
    
    It does not matter that there are numerous places which set
    ZFCP_STATUS_FSFREQ_ERROR after the location where we trace an FSF response
    early. These cases are based on protocol status != FSF_PROT_GOOD or
    == FSF_PROT_FSF_STATUS_PRESENTED and are thus already traced by default
    as trace tag "fs_perr" or "fs_ferr" respectively.
    
    NB: The trace record with tag "fssrh_1" for status read buffers on dismiss
    all remains. zfcp_fsf_req_complete() handles this and returns early.
    All other FSF request types are handled separately and as described above.
    
    Signed-off-by: Steffen Maier <[email protected]>
    Fixes: 8a36e45 ("[SCSI] zfcp: enhancement of zfcp debug features")
    Fixes: 2e261af ("[SCSI] zfcp: Only collect FSF/HBA debug data for matching trace levels")
    Reviewed-by: Benjamin Block <[email protected]>
    Signed-off-by: Benjamin Block <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    steffen-maier authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    adbbbd3 View commit details
    Browse the repository at this point in the history
  42. scsi: zfcp: trace high part of "new" 64 bit SCSI LUN

    commit 5d4a3d0 upstream.
    
    Complements debugging aspects of the otherwise functionally complete
    v3.17 commit 9cb78c1 ("scsi: use 64-bit LUNs").
    
    While I don't have access to a target exporting 3 or 4 level LUNs,
    I did test it by explicitly attaching a non-existent fake 4 level LUN
    by means of zfcp sysfs attribute "unit_add".
    In order to see corresponding trace records of otherwise successful
    events, we had to increase the trace level of area SCSI and HBA to 6.
    
    $ echo 6 > /sys/kernel/debug/s390dbf/zfcp_0.0.1880_scsi/level
    $ echo 6 > /sys/kernel/debug/s390dbf/zfcp_0.0.1880_hba/level
    
    $ echo 0x4011402240334044 > \
      /sys/bus/ccw/drivers/zfcp/0.0.1880/0x50050763031bd327/unit_add
    
    Example output formatted by an updated zfcpdbf from the s390-tools
    package interspersed with kernel messages at scsi_logging_level=4605:
    
    Timestamp      : ...
    Area           : REC
    Subarea        : 00
    Level          : 1
    Exception      : -
    CPU ID         : ..
    Caller         : 0x...
    Record ID      : 1
    Tag            : scsla_1
    LUN            : 0x4011402240334044
    WWPN           : 0x50050763031bd327
    D_ID           : 0x00......
    Adapter status : 0x5400050b
    Port status    : 0x54000001
    LUN status     : 0x41000000
    Ready count    : 0x00000001
    Running count  : 0x00000000
    ERP want       : 0x01
    ERP need       : 0x01
    
    scsi 2:0:0:4630896905707208721: scsi scan: INQUIRY pass 1 length 36
    scsi 2:0:0:4630896905707208721: scsi scan: INQUIRY successful with code 0x0
    
    Timestamp      : ...
    Area           : HBA
    Subarea        : 00
    Level          : 6
    Exception      : -
    CPU ID         : ..
    Caller         : 0x...
    Record ID      : 1
    Tag            : fs_norm
    Request ID     : 0x<inquiry2-req-id>
    Request status : 0x00000010
    FSF cmnd       : 0x00000001
    FSF sequence no: 0x...
    FSF issued     : ...
    FSF stat       : 0x00000000
    FSF stat qual  : 00000000 00000000 00000000 00000000
    Prot stat      : 0x00000001
    Prot stat qual : ........ ........ 00000000 00000000
    Port handle    : 0x...
    LUN handle     : 0x...
    |
    Timestamp      : ...
    Area           : SCSI
    Subarea        : 00
    Level          : 6
    Exception      : -
    CPU ID         : ..
    Caller         : 0x...
    Record ID      : 1
    Tag            : rsl_nor
    Request ID     : 0x<inquiry2-req-id>
    SCSI ID        : 0x00000000
    SCSI LUN       : 0x40224011
    SCSI LUN high  : 0x40444033 <=======================
    SCSI result    : 0x00000000
    SCSI retries   : 0x00
    SCSI allowed   : 0x03
    SCSI scribble  : 0x<inquiry2-req-id>
    SCSI opcode    : 12000000 a4000000 00000000 00000000
    FCP rsp inf cod: 0x00
    FCP rsp IU     : 00000000 00000000 00000000 00000000
                     00000000 00000000
    
    scsi 2:0:0:4630896905707208721: scsi scan: INQUIRY pass 2 length 164
    scsi 2:0:0:4630896905707208721: scsi scan: INQUIRY successful with code 0x0
    scsi 2:0:0:4630896905707208721: scsi scan: peripheral device type of 31, \
    no device added
    
    Signed-off-by: Steffen Maier <[email protected]>
    Fixes: 9cb78c1 ("scsi: use 64-bit LUNs")
    Reviewed-by: Benjamin Block <[email protected]>
    Reviewed-by: Jens Remus <[email protected]>
    Signed-off-by: Benjamin Block <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    steffen-maier authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    c24f722 View commit details
    Browse the repository at this point in the history
  43. scsi: megaraid_sas: set minimum value of resetwaittime to be 1 secs

    commit e636a7a upstream.
    
    Setting resetwaittime to 0 during a FW fault will result in driver not
    calling the OCR.
    
    Signed-off-by: Kashyap Desai <[email protected]>
    Signed-off-by: Shivasharan S <[email protected]>
    Reviewed-by: Hannes Reinecke <[email protected]>
    Reviewed-by: Tomas Henzl <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    shivasharan-s authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    7efc415 View commit details
    Browse the repository at this point in the history
  44. scsi: megaraid_sas: Check valid aen class range to avoid kernel panic

    commit 91b3d9f upstream.
    
    Signed-off-by: Kashyap Desai <[email protected]>
    Signed-off-by: Shivasharan S <[email protected]>
    Reviewed-by: Hannes Reinecke <[email protected]>
    Reviewed-by: Tomas Henzl <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    shivasharan-s authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    c62da79 View commit details
    Browse the repository at this point in the history
  45. scsi: megaraid_sas: Return pended IOCTLs with cmd_status MFI_STAT_WRO…

    …NG_STATE in case adapter is dead
    
    commit eb3fe26 upstream.
    
    After a kill adapter, since the cmd_status is not set, the IOCTLs will
    be hung in driver resulting in application hang.  Set cmd_status
    MFI_STAT_WRONG_STATE when completing pended IOCTLs.
    
    Signed-off-by: Kashyap Desai <[email protected]>
    Signed-off-by: Shivasharan S <[email protected]>
    Reviewed-by: Hannes Reinecke <[email protected]>
    Reviewed-by: Tomas Henzl <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    shivasharan-s authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    d8817f5 View commit details
    Browse the repository at this point in the history
  46. scsi: storvsc: fix memory leak on ring buffer busy

    commit 0208eea upstream.
    
    When storvsc is sending I/O to Hyper-v, it may allocate a bigger buffer
    descriptor for large data payload that can't fit into a pre-allocated
    buffer descriptor. This bigger buffer is freed on return path.
    
    If I/O request to Hyper-v fails due to ring buffer busy, the storvsc
    allocated buffer descriptor should also be freed.
    
    [mkp: applied by hand]
    
    Fixes: be0cf6c ("scsi: storvsc: Set the tablesize based on the information given by the host")
    Signed-off-by: Long Li <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    longlimsft authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    5b8f80d View commit details
    Browse the repository at this point in the history
  47. scsi: sg: remove 'save_scat_len'

    commit 136e57b upstream.
    
    Unused.
    
    Signed-off-by: Hannes Reinecke <[email protected]>
    Reviewed-by: Johannes Thumshirn <[email protected]>
    Tested-by: Johannes Thumshirn <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    hreinecke authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    91fb151 View commit details
    Browse the repository at this point in the history
  48. scsi: sg: use standard lists for sg_requests

    commit 109bade upstream.
    
    'Sg_request' is using a private list implementation; convert it to
    standard lists.
    
    Signed-off-by: Hannes Reinecke <[email protected]>
    Reviewed-by: Johannes Thumshirn <[email protected]>
    Tested-by: Johannes Thumshirn <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    hreinecke authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    2b2d86b View commit details
    Browse the repository at this point in the history
  49. scsi: sg: off by one in sg_ioctl()

    commit bd46fc4 upstream.
    
    If "val" is SG_MAX_QUEUE then we are one element beyond the end of the
    "rinfo" array so the > should be >=.
    
    Fixes: 109bade ("scsi: sg: use standard lists for sg_requests")
    Signed-off-by: Dan Carpenter <[email protected]>
    Acked-by: Douglas Gilbert <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Dan Carpenter authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    c6b9a20 View commit details
    Browse the repository at this point in the history
  50. scsi: sg: factor out sg_fill_request_table()

    commit 4759df9 upstream.
    
    Factor out sg_fill_request_table() for better readability.
    
    [mkp: typos, applied by hand]
    
    Signed-off-by: Hannes Reinecke <[email protected]>
    Reviewed-by: Bart Van Assche <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    hreinecke authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    25d5a8a View commit details
    Browse the repository at this point in the history
  51. scsi: sg: fixup infoleak when using SG_GET_REQUEST_TABLE

    commit 3e00974 upstream.
    
    When calling SG_GET_REQUEST_TABLE ioctl only a half-filled table is
    returned; the remaining part will then contain stale kernel memory
    information.  This patch zeroes out the entire table to avoid this
    issue.
    
    Signed-off-by: Hannes Reinecke <[email protected]>
    Reviewed-by: Bart Van Assche <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Reviewed-by: Eric Dumazet <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    hreinecke authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    90cb12f View commit details
    Browse the repository at this point in the history
  52. scsi: qla2xxx: Correction to vha->vref_count timeout

    commit 6e98095 upstream.
    
    Fix incorrect second argument for wait_event_timeout()
    
    Fixes: c4a9b53 ("qla2xxx: Allow vref count to timeout on vport delete.")
    Signed-off-by: Joe Carnuccio <[email protected]>
    Signed-off-by: Himanshu Madhani <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Joe Carnuccio authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    6e2a025 View commit details
    Browse the repository at this point in the history
  53. scsi: qla2xxx: Fix an integer overflow in sysfs code

    commit e6f7754 upstream.
    
    The value of "size" comes from the user.  When we add "start + size" it
    could lead to an integer overflow bug.
    
    It means we vmalloc() a lot more memory than we had intended.  I believe
    that on 64 bit systems vmalloc() can succeed even if we ask it to
    allocate huge 4GB buffers.  So we would get memory corruption and likely
    a crash when we call ha->isp_ops->write_optrom() and ->read_optrom().
    
    Only root can trigger this bug.
    
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=194061
    
    Fixes: b7cc176 ("[SCSI] qla2xxx: Allow region-based flash-part accesses.")
    Reported-by: shqking <[email protected]>
    Signed-off-by: Dan Carpenter <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Dan Carpenter authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    2a913ae View commit details
    Browse the repository at this point in the history
  54. ftrace: Fix selftest goto location on error

    commit 46320a6 upstream.
    
    In the second iteration of trace_selftest_ops(), the error goto label is
    wrong in the case where trace_selftest_test_global_cnt is off. In the
    case of error, it leaks the dynamic ops that was allocated.
    
    Fixes: 95950c2 ("ftrace: Add self-tests for multiple function trace users")
    Signed-off-by: Steven Rostedt (VMware) <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    rostedt authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    df865f8 View commit details
    Browse the repository at this point in the history
  55. ftrace: Fix memleak when unregistering dynamic ops when tracing disabled

    commit edb096e upstream.
    
    If function tracing is disabled by the user via the function-trace option or
    the proc sysctl file, and a ftrace_ops that was allocated on the heap is
    unregistered, then the shutdown code exits out without doing the proper
    clean up. This was found via kmemleak and running the ftrace selftests, as
    one of the tests unregisters with function tracing disabled.
    
     # cat kmemleak
    unreferenced object 0xffffffffa0020000 (size 4096):
      comm "swapper/0", pid 1, jiffies 4294668889 (age 569.209s)
      hex dump (first 32 bytes):
        55 ff 74 24 10 55 48 89 e5 ff 74 24 18 55 48 89  U.t$.UH...t$.UH.
        e5 48 81 ec a8 00 00 00 48 89 44 24 50 48 89 4c  .H......H.D$PH.L
      backtrace:
        [<ffffffff81d64665>] kmemleak_vmalloc+0x85/0xf0
        [<ffffffff81355631>] __vmalloc_node_range+0x281/0x3e0
        [<ffffffff8109697f>] module_alloc+0x4f/0x90
        [<ffffffff81091170>] arch_ftrace_update_trampoline+0x160/0x420
        [<ffffffff81249947>] ftrace_startup+0xe7/0x300
        [<ffffffff81249bd2>] register_ftrace_function+0x72/0x90
        [<ffffffff81263786>] trace_selftest_ops+0x204/0x397
        [<ffffffff82bb8971>] trace_selftest_startup_function+0x394/0x624
        [<ffffffff81263a75>] run_tracer_selftest+0x15c/0x1d7
        [<ffffffff82bb83f1>] init_trace_selftests+0x75/0x192
        [<ffffffff81002230>] do_one_initcall+0x90/0x1e2
        [<ffffffff82b7d620>] kernel_init_freeable+0x350/0x3fe
        [<ffffffff81d61ec3>] kernel_init+0x13/0x122
        [<ffffffff81d72c6a>] ret_from_fork+0x2a/0x40
        [<ffffffffffffffff>] 0xffffffffffffffff
    
    Fixes: 12cce59 ("ftrace/x86: Allow !CONFIG_PREEMPT dynamic ops to use allocated trampolines")
    Signed-off-by: Steven Rostedt (VMware) <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    rostedt authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    100553e View commit details
    Browse the repository at this point in the history
  56. tracing: Add barrier to trace_printk() buffer nesting modification

    commit 3d9622c upstream.
    
    trace_printk() uses 4 buffers, one for each context (normal, softirq, irq
    and NMI), such that it does not need to worry about one context preempting
    the other. There's a nesting counter that gets incremented to figure out
    which buffer to use. If the context gets preempted by another context which
    calls trace_printk() it will increment the counter and use the next buffer,
    and restore the counter when it is finished.
    
    The problem is that gcc may optimize the modification of the buffer nesting
    counter and it may not be incremented in memory before the buffer is used.
    If this happens, and the context gets interrupted by another context, it
    could pick the same buffer and corrupt the one that is being used.
    
    Compiler barriers need to be added after the nesting variable is incremented
    and before it is decremented to prevent usage of the context buffers by more
    than one context at the same time.
    
    Cc: Andy Lutomirski <[email protected]>
    Fixes: e2ace00 ("tracing: Choose static tp_printk buffer by explicit nesting count")
    Hat-tip-to: Peter Zijlstra <[email protected]>
    Signed-off-by: Steven Rostedt (VMware) <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    rostedt authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    96cf918 View commit details
    Browse the repository at this point in the history
  57. tracing: Apply trace_clock changes to instance max buffer

    commit 170b3b1 upstream.
    
    Currently trace_clock timestamps are applied to both regular and max
    buffers only for global trace. For instance trace, trace_clock
    timestamps are applied only to regular buffer. But, regular and max
    buffers can be swapped, for example, following a snapshot. So, for
    instance trace, bad timestamps can be seen following a snapshot.
    Let's apply trace_clock timestamps to instance max buffer as well.
    
    Link: http://lkml.kernel.org/r/ebdb168d0be042dcdf51f81e696b17fabe3609c1.1504642143.git.tom.zanussi@linux.intel.com
    
    Fixes: 277ba04 ("tracing: Add interface to allow multiple trace buffers")
    Signed-off-by: Baohong Liu <[email protected]>
    Signed-off-by: Steven Rostedt (VMware) <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    bliu11-intel authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    cf05233 View commit details
    Browse the repository at this point in the history
  58. ARC: Re-enable MMU upon Machine Check exception

    commit 1ee55a8 upstream.
    
    I recently came upon a scenario where I would get a double fault
    machine check exception tiriggered by a kernel module.
    However the ensuing crash stacktrace (ksym lookup) was not working
    correctly.
    
    Turns out that machine check auto-disables MMU while modules are allocated
    in kernel vaddr spapce.
    
    This patch re-enables the MMU before start printing the stacktrace
    making stacktracing of modules work upon a fatal exception.
    
    Signed-off-by: Jose Abreu <[email protected]>
    Reviewed-by: Alexey Brodkin <[email protected]>
    Signed-off-by: Vineet Gupta <[email protected]>
    [vgupta: moved code into low level handler to avoid in 2 places]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    joabreu authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    57e4f87 View commit details
    Browse the repository at this point in the history
  59. PCI: shpchp: Enable bridge bus mastering if MSI is enabled

    commit 48b79a1 upstream.
    
    An SHPC may generate MSIs to notify software about slot or controller
    events (SHPC spec r1.0, sec 4.7).  A PCI device can only generate an MSI if
    it has bus mastering enabled.
    
    Enable bus mastering if the bridge contains an SHPC that uses MSI for event
    notifications.
    
    Signed-off-by: Aleksandr Bezzubikov <[email protected]>
    [bhelgaas: changelog]
    Signed-off-by: Bjorn Helgaas <[email protected]>
    Reviewed-by: Marcel Apfelbaum <[email protected]>
    Acked-by: Michael S. Tsirkin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    zuban32 authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    998a9f5 View commit details
    Browse the repository at this point in the history
  60. PCI: pciehp: Report power fault only once until we clear it

    commit 7612b3b upstream.
    
    When a power fault occurs, the power controller sets Power Fault Detected
    in the Slot Status register, and pciehp_isr() queues an INT_POWER_FAULT
    event to handle it.
    
    It also clears Power Fault Detected, but since nothing has yet changed to
    correct the power fault, the power controller will likely set it again
    immediately, which may cause an infinite loop when pcie_isr() rechecks
    Slot Status.
    
    Fix that by masking off Power Fault Detected from new events if the driver
    hasn't seen the power fault clear from the previous handling attempt.
    
    Fixes: fad214b ("PCI: pciehp: Process all hotplug events before looking for new ones")
    Signed-off-by: Keith Busch <[email protected]>
    [bhelgaas: changelog, pull test out and add comment]
    Signed-off-by: Bjorn Helgaas <[email protected]>
    Cc: Mayurkumar Patel <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Keith Busch authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    2fd6292 View commit details
    Browse the repository at this point in the history
  61. net/netfilter/nf_conntrack_core: Fix net_conntrack_lock()

    commit 3ef0c7a upstream.
    
    As we want to remove spin_unlock_wait() and replace it with explicit
    spin_lock()/spin_unlock() calls, we can use this to simplify the
    locking.
    
    In addition:
    - Reading nf_conntrack_locks_all needs ACQUIRE memory ordering.
    - The new code avoids the backwards loop.
    
    Only slightly tested, I did not manage to trigger calls to
    nf_conntrack_all_lock().
    
    V2: With improved comments, to clearly show how the barriers
        pair.
    
    Fixes: b16c291 ("netfilter: nf_conntrack: use safer way to lock all buckets")
    Signed-off-by: Manfred Spraul <[email protected]>
    Cc: Alan Stern <[email protected]>
    Cc: Sasha Levin <[email protected]>
    Cc: Pablo Neira Ayuso <[email protected]>
    Cc: [email protected]
    Signed-off-by: Paul E. McKenney <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    manfred-colorfu authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    4c7f54a View commit details
    Browse the repository at this point in the history
  62. s390/mm: fix local TLB flushing vs. detach of an mm address space

    commit b3e5dc4 upstream.
    
    The local TLB flushing code keeps an additional mask in the mm.context,
    the cpu_attach_mask. At the time a global flush of an address space is
    done the cpu_attach_mask is copied to the mm_cpumask in order to avoid
    future global flushes in case the mm is used by a single CPU only after
    the flush.
    
    Trouble is that the reset of the mm_cpumask is racy against the detach
    of an mm address space by switch_mm. The current order is first the
    global TLB flush and then the copy of the cpu_attach_mask to the
    mm_cpumask. The order needs to be the other way around.
    
    Reviewed-by: Heiko Carstens <[email protected]>
    Signed-off-by: Martin Schwidefsky <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Martin Schwidefsky authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    536ab63 View commit details
    Browse the repository at this point in the history
  63. s390/mm: fix race on mm->context.flush_mm

    commit 60f07c8 upstream.
    
    The order in __tlb_flush_mm_lazy is to flush TLB first and then clear
    the mm->context.flush_mm bit. This can lead to missed flushes as the
    bit can be set anytime, the order needs to be the other way aronud.
    
    But this leads to a different race, __tlb_flush_mm_lazy may be called
    on two CPUs concurrently. If mm->context.flush_mm is cleared first then
    another CPU can bypass __tlb_flush_mm_lazy although the first CPU has
    not done the flush yet. In a virtualized environment the time until the
    flush is finally completed can be arbitrarily long.
    
    Add a spinlock to serialize __tlb_flush_mm_lazy and use the function
    in finish_arch_post_lock_switch as well.
    
    Reviewed-by: Heiko Carstens <[email protected]>
    Signed-off-by: Martin Schwidefsky <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Martin Schwidefsky authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    de4360d View commit details
    Browse the repository at this point in the history
  64. media: v4l2-compat-ioctl32: Fix timespec conversion

    commit 9c7ba1d upstream.
    
    Certain syscalls like recvmmsg support 64 bit timespec values for the
    X32 ABI. The helper function compat_put_timespec converts a timespec
    value to a 32 bit or 64 bit value depending on what ABI is used. The
    v4l2 compat layer, however, is not designed to support 64 bit timespec
    values and always uses 32 bit values. Hence, compat_put_timespec must
    not be used.
    
    Without this patch, user space will be provided with bad timestamp
    values from the VIDIOC_DQEVENT ioctl. Also, fields of the struct
    v4l2_event32 that come immediately after timestamp get overwritten,
    namely the field named id.
    
    Fixes: 81993e8 ("compat: Get rid of (get|put)_compat_time(val|spec)")
    Cc: H. Peter Anvin <[email protected]>
    Cc: Laurent Pinchart <[email protected]>
    Cc: Tiffany Lin <[email protected]>
    Cc: Ricardo Ribalda Delgado <[email protected]>
    Cc: Sakari Ailus <[email protected]>
    Signed-off-by: Daniel Mentz <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    danielmentzgoogle authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    7717a73 View commit details
    Browse the repository at this point in the history
  65. media: uvcvideo: Prevent heap overflow when accessing mapped controls

    commit 7e09f7d upstream.
    
    The size of uvc_control_mapping is user controlled leading to a
    potential heap overflow in the uvc driver. This adds a check to verify
    the user provided size fits within the bounds of the defined buffer
    size.
    
    Originally-from: Richard Simmons <[email protected]>
    
    Signed-off-by: Guenter Roeck <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    groeck authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    38993f3 View commit details
    Browse the repository at this point in the history
  66. PM / devfreq: Fix memory leak when fail to register device

    commit 9e14de1 upstream.
    
    When the devfreq_add_device fails to register deivce, the memory
    leak of devfreq instance happen. So, this patch fix the memory
    leak issue. Before freeing the devfreq instance checks whether
    devfreq instance is NULL or not because the device_unregister()
    frees the devfreq instance when jumping to the 'err_init'.
    It is to prevent the duplicate the kfee(devfreq).
    
    Fixes: ac4b281 ("PM / devfreq: fix duplicated kfree on devfreq pointer")
    Signed-off-by: Chanwoo Choi <[email protected]>
    Signed-off-by: MyungJoo Ham <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    chanwoochoi authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    f5c3fd8 View commit details
    Browse the repository at this point in the history
  67. bcache: initialize dirty stripes in flash_dev_run()

    commit 175206c upstream.
    
    bcache uses a Proportion-Differentiation Controller algorithm to control
    writeback rate to cached devices. In the PD controller algorithm, dirty
    stripes of thin flash device should not be counted in, because flash only
    volumes never write back dirty data.
    
    Currently dirty stripe counter for thin flash device is not initialized
    when the thin flash device starts. Which means the following calculation
    in PD controller will reference an undefined dirty stripes number, and
    all cached devices attached to the same cache set where the thin flash
    device lies on may have an inaccurate writeback rate.
    
    This patch calles bch_sectors_dirty_init() in flash_dev_run(), to
    correctly initialize dirty stripe counter when the thin flash device
    starts to run. This patch also does following parameter data type change,
     -void bch_sectors_dirty_init(struct cached_dev *dc);
     +void bch_sectors_dirty_init(struct bcache_device *);
    to call this function conveniently in flash_dev_run().
    
    (Commit log is composed by Coly Li)
    
    Signed-off-by: Tang Junhui <[email protected]>
    Reviewed-by: Coly Li <[email protected]>
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Tang Junhui authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    2a9b557 View commit details
    Browse the repository at this point in the history
  68. bcache: Fix leak of bdev reference

    commit 4b758df upstream.
    
    If blkdev_get_by_path() in register_bcache() fails, we try to lookup the
    block device using lookup_bdev() to detect which situation we are in to
    properly report error. However we never drop the reference returned to
    us from lookup_bdev(). Fix that.
    
    Signed-off-by: Jan Kara <[email protected]>
    Acked-by: Coly Li <[email protected]>
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    jankara authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    c234e0e View commit details
    Browse the repository at this point in the history
  69. bcache: do not subtract sectors_to_gc for bypassed IO

    commit 69daf03 upstream.
    
    Since bypassed IOs use no bucket, so do not subtract sectors_to_gc to
    trigger gc thread.
    
    Signed-off-by: tang.junhui <[email protected]>
    Acked-by: Coly Li <[email protected]>
    Reviewed-by: Eric Wheeler <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Tang Junhui authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    8f51f38 View commit details
    Browse the repository at this point in the history
  70. bcache: correct cache_dirty_target in __update_writeback_rate()

    commit a839409 upstream.
    
    __update_write_rate() uses a Proportion-Differentiation Controller
    algorithm to control writeback rate. A dirty target number is used in
    this PD controller to control writeback rate. A larger target number
    will make the writeback rate smaller, on the versus, a smaller target
    number will make the writeback rate larger.
    
    bcache uses the following steps to calculate the target number,
    1) cache_sectors = all-buckets-of-cache-set * buckets-size
    2) cache_dirty_target = cache_sectors * cached-device-writeback_percent
    3) target = cache_dirty_target *
    (sectors-of-cached-device/sectors-of-all-cached-devices-of-this-cache-set)
    
    The calculation at step 1) for cache_sectors is incorrect, which does
    not consider dirty blocks occupied by flash only volume.
    
    A flash only volume can be took as a bcache device without cached
    device. All data sectors allocated for it are persistent on cache device
    and marked dirty, they are not touched by bcache writeback and garbage
    collection code. So data blocks of flash only volume should be ignore
    when calculating cache_sectors of cache set.
    
    Current code does not subtract dirty sectors of flash only volume, which
    results a larger target number from the above 3 steps. And in sequence
    the cache device's writeback rate is smaller then a correct value,
    writeback speed is slower on all cached devices.
    
    This patch fixes the incorrect slower writeback rate by subtracting
    dirty sectors of flash only volumes in __update_writeback_rate().
    
    (Commit log composed by Coly Li to pass checkpatch.pl checking)
    
    Signed-off-by: Tang Junhui <[email protected]>
    Reviewed-by: Coly Li <[email protected]>
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Tang Junhui authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    e40cb30 View commit details
    Browse the repository at this point in the history
  71. bcache: Correct return value for sysfs attach errors

    commit 77fa100 upstream.
    
    If you encounter any errors in bch_cached_dev_attach it will return
    a negative error code.  The variable 'v' which stores the result is
    unsigned, thus user space sees a very large value returned for bytes
    written which can cause incorrect user space behavior.  Utilize 1
    signed variable to use throughout the function to preserve error return
    capability.
    
    Signed-off-by: Tony Asleson <[email protected]>
    Acked-by: Coly Li <[email protected]>
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    tasleson authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    fa92ff6 View commit details
    Browse the repository at this point in the history
  72. bcache: fix for gc and write-back race

    commit 9baf309 upstream.
    
    gc and write-back get raced (see the email "bcache get stucked" I sended
    before):
    gc thread                               write-back thread
    |                                       |bch_writeback_thread()
    |bch_gc_thread()                        |
    |                                       |==>read_dirty()
    |==>bch_btree_gc()                      |
    |==>btree_root() //get btree root       |
    |                //node write locker    |
    |==>bch_btree_gc_root()                 |
    |                                       |==>read_dirty_submit()
    |                                       |==>write_dirty()
    |                                       |==>continue_at(cl,
    |                                       |               write_dirty_finish,
    |                                       |               system_wq);
    |                                       |==>write_dirty_finish()//excute
    |                                       |               //in system_wq
    |                                       |==>bch_btree_insert()
    |                                       |==>bch_btree_map_leaf_nodes()
    |                                       |==>__bch_btree_map_nodes()
    |                                       |==>btree_root //try to get btree
    |                                       |              //root node read
    |                                       |              //lock
    |                                       |-----stuck here
    |==>bch_btree_set_root()
    |==>bch_journal_meta()
    |==>bch_journal()
    |==>journal_try_write()
    |==>journal_write_unlocked() //journal_full(&c->journal)
    |                            //condition satisfied
    |==>continue_at(cl, journal_write, system_wq); //try to excute
    |                               //journal_write in system_wq
    |                               //but work queue is excuting
    |                               //write_dirty_finish()
    |==>closure_sync(); //wait journal_write execute
    |                   //over and wake up gc,
    |-------------stuck here
    |==>release root node write locker
    
    This patch alloc a separate work-queue for write-back thread to avoid such
    race.
    
    (Commit log re-organized by Coly Li to pass checkpatch.pl checking)
    
    Signed-off-by: Tang Junhui <[email protected]>
    Acked-by: Coly Li <[email protected]>
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Tang Junhui authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    57aa1a6 View commit details
    Browse the repository at this point in the history
  73. bcache: fix bch_hprint crash and improve output

    commit 9276717 upstream.
    
    Most importantly, solve a crash where %llu was used to format signed
    numbers.  This would cause a buffer overflow when reading sysfs
    writeback_rate_debug, as only 20 bytes were allocated for this and
    %llu writes 20 characters plus a null.
    
    Always use the units mechanism rather than having different output
    paths for simplicity.
    
    Also, correct problems with display output where 1.10 was a larger
    number than 1.09, by multiplying by 10 and then dividing by 1024 instead
    of dividing by 100.  (Remainders of >= 1000 would print as .10).
    
    Minor changes: Always display the decimal point instead of trying to
    omit it based on number of digits shown.  Decide what units to use
    based on 1000 as a threshold, not 1024 (in other words, always print
    at most 3 digits before the decimal point).
    
    Signed-off-by: Michael Lyle <[email protected]>
    Reported-by: Dmitry Yu Okunev <[email protected]>
    Acked-by: Kent Overstreet <[email protected]>
    Reviewed-by: Coly Li <[email protected]>
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    mlyle authored and gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    08f75f2 View commit details
    Browse the repository at this point in the history
  74. Linux 4.9.52

    gregkh committed Sep 27, 2017
    Configuration menu
    Copy the full SHA
    d59dabd View commit details
    Browse the repository at this point in the history

Commits on Sep 28, 2017

  1. ARM: at91: sama5_defconfig: add mtd tests as modules

    Signed-off-by: Nicolas Ferre <[email protected]>
    noglitch committed Sep 28, 2017
    Configuration menu
    Copy the full SHA
    28d74a4 View commit details
    Browse the repository at this point in the history

Commits on Oct 2, 2017

  1. Revert "Makefile: linux4sam_5.7-rc7"

    This reverts commit 8be0870.
    
    Signed-off-by: Nicolas Ferre <[email protected]>
    noglitch committed Oct 2, 2017
    Configuration menu
    Copy the full SHA
    28add3f View commit details
    Browse the repository at this point in the history
  2. Merge tag 'v4.9.52' into linux-4.9-at91

    This is the 4.9.52 stable release
    noglitch committed Oct 2, 2017
    Configuration menu
    Copy the full SHA
    d33d343 View commit details
    Browse the repository at this point in the history
  3. ARM: at91: sama5_defconfig: remove PERF and KALLSYMS

    For performance reasons, remove some symbols and perf events to the default
    configuration.
    
    Signed-off-by: Nicolas Ferre <[email protected]>
    noglitch committed Oct 2, 2017
    Configuration menu
    Copy the full SHA
    ca1128a View commit details
    Browse the repository at this point in the history
  4. ARM: at91: sama5_defconfig: add back CONFIG_JUMP_LABEL

    Add back this configuration option as it increases a lot the performance
    of the network subsystem.
    Beware: this option changes the binary of the kernel at runtime: pay attention
    if you use the Integrity Check Monitor (ICM) with the kernel image!
    
    Signed-off-by: Nicolas Ferre <[email protected]>
    noglitch committed Oct 2, 2017
    Configuration menu
    Copy the full SHA
    ec098a8 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    f2fa693 View commit details
    Browse the repository at this point in the history

Commits on Oct 3, 2017

  1. Makefile: prepare for linux4sam 5.7

    Signed-off-by: Nicolas Ferre <[email protected]>
    noglitch committed Oct 3, 2017
    Configuration menu
    Copy the full SHA
    973820d View commit details
    Browse the repository at this point in the history

Commits on Dec 29, 2017

  1. Configuration menu
    Copy the full SHA
    260cfe4 View commit details
    Browse the repository at this point in the history