23 May, 2018

25 commits

  • commit 9f418224e8114156d995b98fa4e0f4fd21f685fe upstream.

    Fix a race in the multi-order iteration code which causes the kernel to
    hit a GP fault. This was first seen with a production v4.15 based
    kernel (4.15.6-300.fc27.x86_64) utilizing a DAX workload which used
    order 9 PMD DAX entries.

    The race has to do with how we tear down multi-order sibling entries
    when we are removing an item from the tree. Remember for example that
    an order 2 entry looks like this:

    struct radix_tree_node.slots[] = [entry][sibling][sibling][sibling]

    where 'entry' is in some slot in the struct radix_tree_node, and the
    three slots following 'entry' contain sibling pointers which point back
    to 'entry.'

    When we delete 'entry' from the tree, we call :

    radix_tree_delete()
    radix_tree_delete_item()
    __radix_tree_delete()
    replace_slot()

    replace_slot() first removes the siblings in order from the first to the
    last, then at then replaces 'entry' with NULL. This means that for a
    brief period of time we end up with one or more of the siblings removed,
    so:

    struct radix_tree_node.slots[] = [entry][NULL][sibling][sibling]

    This causes an issue if you have a reader iterating over the slots in
    the tree via radix_tree_for_each_slot() while only under
    rcu_read_lock()/rcu_read_unlock() protection. This is a common case in
    mm/filemap.c.

    The issue is that when __radix_tree_next_slot() => skip_siblings() tries
    to skip over the sibling entries in the slots, it currently does so with
    an exact match on the slot directly preceding our current slot.
    Normally this works:

    V preceding slot
    struct radix_tree_node.slots[] = [entry][sibling][sibling][sibling]
    ^ current slot

    This lets you find the first sibling, and you skip them all in order.

    But in the case where one of the siblings is NULL, that slot is skipped
    and then our sibling detection is interrupted:

    V preceding slot
    struct radix_tree_node.slots[] = [entry][NULL][sibling][sibling]
    ^ current slot

    This means that the sibling pointers aren't recognized since they point
    all the way back to 'entry', so we think that they are normal internal
    radix tree pointers. This causes us to think we need to walk down to a
    struct radix_tree_node starting at the address of 'entry'.

    In a real running kernel this will crash the thread with a GP fault when
    you try and dereference the slots in your broken node starting at
    'entry'.

    We fix this race by fixing the way that skip_siblings() detects sibling
    nodes. Instead of testing against the preceding slot we instead look
    for siblings via is_sibling_entry() which compares against the position
    of the struct radix_tree_node.slots[] array. This ensures that sibling
    entries are properly identified, even if they are no longer contiguous
    with the 'entry' they point to.

    Link: http://lkml.kernel.org/r/20180503192430.7582-6-ross.zwisler@linux.intel.com
    Fixes: 148deab223b2 ("radix-tree: improve multiorder iterators")
    Signed-off-by: Ross Zwisler
    Reported-by: CR, Sapthagirish
    Reviewed-by: Jan Kara
    Cc: Matthew Wilcox
    Cc: Christoph Hellwig
    Cc: Dan Williams
    Cc: Dave Chinner
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Ross Zwisler
     
  • commit 1e3054b98c5415d5cb5f8824fc33b548ae5644c3 upstream.

    I had neglected to increment the error counter when the tests failed,
    which made the tests noisy when they fail, but not actually return an
    error code.

    Link: http://lkml.kernel.org/r/20180509114328.9887-1-mpe@ellerman.id.au
    Fixes: 3cc78125a081 ("lib/test_bitmap.c: add optimisation tests")
    Signed-off-by: Matthew Wilcox
    Signed-off-by: Michael Ellerman
    Reported-by: Michael Ellerman
    Tested-by: Michael Ellerman
    Reviewed-by: Kees Cook
    Cc: Yury Norov
    Cc: Andy Shevchenko
    Cc: Geert Uytterhoeven
    Cc: [4.13+]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Matthew Wilcox
     
  • commit 7f6df440b8623c441c42d070bf592e2d2c1fa9bb upstream.

    This patch matches the sysfs name used in the unlinking with the
    linking function. Otherwise, remove_compat_control_link() fails to remove
    sysfs created by create_compat_control_link() in drm_dev_register().

    Fixes: 6449b088dd51 ("drm: Add fake controlD* symlinks for backwards
    compat")
    Cc: Dave Airlie
    Cc: Alex Deucher
    Cc: Emil Velikov
    Cc: David Herrmann
    Cc: Greg Kroah-Hartman
    Cc: Daniel Vetter
    Cc: Gustavo Padovan
    Cc: Maarten Lankhorst
    Cc: Sean Paul
    Cc: David Airlie
    Cc: dri-devel@lists.freedesktop.org
    Cc: # v4.10+
    Signed-off-by: Haneen Mohammed
    [seanpaul added Fixes and Cc tags]
    Signed-off-by: Sean Paul
    Link: https://patchwork.freedesktop.org/patch/msgid/20180511041542.GA4253@haneen-vb
    Signed-off-by: Greg Kroah-Hartman

    Haneen Mohammed
     
  • commit c1d2a31397ec51f0370f6bd17b19b39152c263cb upstream.

    Similarly to opal_event_shutdown, opal_nvram_write can be called in
    the crash path with irqs disabled. Special case the delay to avoid
    sleeping in invalid context.

    Fixes: 3b8070335f75 ("powerpc/powernv: Fix OPAL NVRAM driver OPAL_BUSY loops")
    Cc: stable@vger.kernel.org # v3.2
    Signed-off-by: Nicholas Piggin
    Signed-off-by: Michael Ellerman
    Signed-off-by: Greg Kroah-Hartman

    Nicholas Piggin
     
  • commit 06cb616b1bca7080824acfedb3d4c898e7a64836 upstream.

    Not all revisions of DW I2C controller implement the enable status register.
    On platforms where that's the case (e.g. BG2CD and SPEAr ARM SoCs), waiting
    for enable will time out as reading the unimplemented register yields zero.

    It was observed that reading the IC_ENABLE_STATUS register once suffices to
    avoid getting it stuck on Bay Trail hardware, so replace polling with one
    dummy read of the register.

    Fixes: fba4adbbf670 ("i2c: designware: must wait for enable")
    Signed-off-by: Alexander Monakov
    Tested-by: Ben Gardner
    Acked-by: Jarkko Nikula
    Signed-off-by: Wolfram Sang
    Cc: stable@kernel.org
    Signed-off-by: Greg Kroah-Hartman

    Alexander Monakov
     
  • commit 32c1733f0dd4bd11d6e65512bf4dc337c0452c8e upstream.

    skb_header_pointer will copy data into a buffer if data is non linear,
    otherwise it will return a pointer in the linear section of the data.
    nf_sk_lookup_slow_v{4,6} always copies data of size udphdr but later
    accesses memory within the size of tcphdr (th->doff) in case of TCP
    packets. This causes a crash when running with KASAN with the following
    call stack -

    BUG: KASAN: stack-out-of-bounds in xt_socket_lookup_slow_v4+0x524/0x718
    net/netfilter/xt_socket.c:178
    Read of size 2 at addr ffffffe3d417a87c by task syz-executor/28971
    CPU: 2 PID: 28971 Comm: syz-executor Tainted: G B W O 4.9.65+ #1
    Call trace:
    [] dump_backtrace+0x0/0x428 arch/arm64/kernel/traps.c:76
    [] show_stack+0x28/0x38 arch/arm64/kernel/traps.c:226
    [] __dump_stack lib/dump_stack.c:15 [inline]
    [] dump_stack+0xd4/0x124 lib/dump_stack.c:51
    [] print_address_description+0x68/0x258 mm/kasan/report.c:248
    [] kasan_report_error mm/kasan/report.c:347 [inline]
    [] kasan_report.part.2+0x228/0x2f0 mm/kasan/report.c:371
    [] kasan_report+0x5c/0x70 mm/kasan/report.c:372
    [] check_memory_region_inline mm/kasan/kasan.c:308 [inline]
    [] __asan_load2+0x84/0x98 mm/kasan/kasan.c:739
    [] __tcp_hdrlen include/linux/tcp.h:35 [inline]
    [] xt_socket_lookup_slow_v4+0x524/0x718 net/netfilter/xt_socket.c:178

    Fix this by copying data into appropriate size headers based on protocol.

    Fixes: a583636a83ea ("inet: refactor inet[6]_lookup functions to take skb")
    Signed-off-by: Tejaswi Tanikella
    Signed-off-by: Subash Abhinov Kasiviswanathan
    Signed-off-by: Pablo Neira Ayuso
    Signed-off-by: Greg Kroah-Hartman

    Subash Abhinov Kasiviswanathan
     
  • commit 569ccae68b38654f04b6842b034aa33857f605fe upstream.

    rules in nftables a free'd using kfree, but protected by rcu, i.e. we
    must wait for a grace period to elapse.

    Normal removal patch does this, but nf_tables_newrule() doesn't obey
    this rule during error handling.

    It calls nft_trans_rule_add() *after* linking rule, and, if that
    fails to allocate memory, it unlinks the rule and then kfree() it --
    this is unsafe.

    Switch order -- first add rule to transaction list, THEN link it
    to public list.

    Note: nft_trans_rule_add() uses GFP_KERNEL; it will not fail so this
    is not a problem in practice (spotted only during code review).

    Fixes: 0628b123c96d12 ("netfilter: nfnetlink: add batch support and use it from nf_tables")
    Signed-off-by: Florian Westphal
    Signed-off-by: Pablo Neira Ayuso
    Signed-off-by: Greg Kroah-Hartman

    Florian Westphal
     
  • commit 2f6adf481527c8ab8033c601f55bfb5b3712b2ac upstream.

    set->name must be free'd here in case ops->init fails.

    Fixes: 387454901bd6 ("netfilter: nf_tables: Allow set names of up to 255 chars")
    Signed-off-by: Florian Westphal
    Signed-off-by: Pablo Neira Ayuso
    Signed-off-by: Greg Kroah-Hartman

    Florian Westphal
     
  • commit bb765d1c331f62b59049d35607ed2e365802bef9 upstream.

    Bump the file's refcount before moving the reference into the fd table,
    not afterwards. The old code could drop the file's refcount to zero for a
    short moment before calling get_file() via get_dma_buf().

    This code can only be triggered on ARM systems that use Linaro's OP-TEE.

    Fixes: 967c9cca2cc5 ("tee: generic TEE subsystem")
    Signed-off-by: Jann Horn
    Signed-off-by: Jens Wiklander
    Signed-off-by: Greg Kroah-Hartman

    Jann Horn
     
  • commit 45dd9b0666a162f8e4be76096716670cf1741f0e upstream.

    Doing an audit of trace events, I discovered two trace events in the xen
    subsystem that use a hack to create zero data size trace events. This is not
    what trace events are for. Trace events add memory footprint overhead, and
    if all you need to do is see if a function is hit or not, simply make that
    function noinline and use function tracer filtering.

    Worse yet, the hack used was:

    __array(char, x, 0)

    Which creates a static string of zero in length. There's assumptions about
    such constructs in ftrace that this is a dynamic string that is nul
    terminated. This is not the case with these tracepoints and can cause
    problems in various parts of ftrace.

    Nuke the trace events!

    Link: http://lkml.kernel.org/r/20180509144605.5a220327@gandalf.local.home

    Cc: stable@vger.kernel.org
    Fixes: 95a7d76897c1e ("xen/mmu: Use Xen specific TLB flush instead of the generic one.")
    Reviewed-by: Juergen Gross
    Signed-off-by: Steven Rostedt (VMware)
    Signed-off-by: Greg Kroah-Hartman

    Steven Rostedt (VMware)
     
  • commit d66a7355717ec903d455277a550d930ba13df4a8 upstream.

    If the translation of a channel program fails, we may end up attempting
    to clean up (free, unpin) stuff that never got translated (and allocated,
    pinned) in the first place.

    By adjusting the lengths of the chains accordingly (so the element that
    failed, and all subsequent elements are excluded) cleanup activities
    based on false assumptions can be avoided.

    Let's make sure cp_free works properly after cp_prefetch returns with an
    error by setting ch_len of a ccw chain to the number of the translated
    CCWs on that chain.

    Cc: stable@vger.kernel.org #v4.12+
    Acked-by: Pierre Morel
    Reviewed-by: Dong Jia Shi
    Signed-off-by: Halil Pasic
    Signed-off-by: Dong Jia Shi
    Message-Id:
    [CH: fixed typos]
    Signed-off-by: Cornelia Huck
    Signed-off-by: Martin Schwidefsky
    Signed-off-by: Greg Kroah-Hartman

    Halil Pasic
     
  • commit 349524bc0da698ec77f2057cf4a4948eb6349265 upstream.

    This causes warnings from cpufreq mutex code. This is also rather
    unnecessary and ineffective. If we really want to prevent concurrent
    unplug, we could take the unplug read lock but I don't see this being
    critical.

    Fixes: cd77b5ce208c ("powerpc/powernv/cpufreq: Fix the frequency read by /proc/cpuinfo")
    Signed-off-by: Benjamin Herrenschmidt
    Signed-off-by: Michael Ellerman
    Acked-by: Michal Suchanek
    Signed-off-by: Greg Kroah-Hartman

    Benjamin Herrenschmidt
     
  • commit bf308242ab98b5d1648c3663e753556bef9bec01 upstream.

    kvm_read_guest() will eventually look up in kvm_memslots(), which requires
    either to hold the kvm->slots_lock or to be inside a kvm->srcu critical
    section.
    In contrast to x86 and s390 we don't take the SRCU lock on every guest
    exit, so we have to do it individually for each kvm_read_guest() call.

    Provide a wrapper which does that and use that everywhere.

    Note that ending the SRCU critical section before returning from the
    kvm_read_guest() wrapper is safe, because the data has been *copied*, so
    we don't need to rely on valid references to the memslot anymore.

    Cc: Stable # 4.8+
    Reported-by: Jan Glauber
    Signed-off-by: Andre Przywara
    Acked-by: Christoffer Dall
    Signed-off-by: Paolo Bonzini
    Signed-off-by: Greg Kroah-Hartman

    Andre Przywara
     
  • commit 711702b57cc3c50b84bd648de0f1ca0a378805be upstream.

    kvm_read_guest() will eventually look up in kvm_memslots(), which requires
    either to hold the kvm->slots_lock or to be inside a kvm->srcu critical
    section.
    In contrast to x86 and s390 we don't take the SRCU lock on every guest
    exit, so we have to do it individually for each kvm_read_guest() call.
    Use the newly introduced wrapper for that.

    Cc: Stable # 4.12+
    Reported-by: Jan Glauber
    Signed-off-by: Andre Przywara
    Acked-by: Christoffer Dall
    Signed-off-by: Paolo Bonzini
    Signed-off-by: Greg Kroah-Hartman

    Andre Przywara
     
  • commit 602805fb618b018b7a41fbb3f93c1992b078b1ae upstream.

    Always confirm the BSPI_MAST_N_BOOT_CTRL bit when enabling
    or disabling BSPI transfers.

    Fixes: 4e3b2d236fe00 ("spi: bcm-qspi: Add BSPI spi-nor flash controller driver")
    Signed-off-by: Kamal Dasu
    Signed-off-by: Mark Brown
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman

    Kamal Dasu
     
  • commit 5eb9a07a4ae1008b67d8bcd47bddb3dae97456b7 upstream.

    Added fix for probing of spi-nor device non-zero chip selects. Set
    MSPI_CDRAM_PCS (peripheral chip select) with spi master for MSPI
    controller and not for MSPI/BSPI spi-nor master controller. Ensure
    setting of cs bit in chip select register on chip select change.

    Fixes: fa236a7ef24048 ("spi: bcm-qspi: Add Broadcom MSPI driver")
    Signed-off-by: Kamal Dasu
    Signed-off-by: Mark Brown
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman

    Kamal Dasu
     
  • commit efc4a13724b852ddaa3358402a8dec024ffbcb17 upstream.

    Currently the 32-bit device address only is supported for DMA. However,
    starting from Intel Sunrisepoint PCH the DMA address of the device FIFO
    can be 64-bit.

    Change the respective variable to be compatible with DMA engine
    expectations, i.e. to phys_addr_t.

    Fixes: 34cadd9c1bcb ("spi: pxa2xx: Add support for Intel Sunrisepoint")
    Signed-off-by: Andy Shevchenko
    Signed-off-by: Mark Brown
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman

    Andy Shevchenko
     
  • commit 3f12888dfae2a48741c4caa9214885b3aaf350f9 upstream.

    In snd_ctl_elem_add_compat(), the fields of the struct 'data' need to be
    copied from the corresponding fields of the struct 'data32' in userspace.
    This is achieved by invoking copy_from_user() and get_user() functions. The
    problem here is that the 'type' field is copied twice. One is by
    copy_from_user() and one is by get_user(). Given that the 'type' field is
    not used between the two copies, the second copy is *completely* redundant
    and should be removed for better performance and cleanup. Also, these two
    copies can cause inconsistent data: as the struct 'data32' resides in
    userspace and a malicious userspace process can race to change the 'type'
    field between the two copies to cause inconsistent data. Depending on how
    the data is used in the future, such an inconsistency may cause potential
    security risks.

    For above reasons, we should take out the second copy.

    Signed-off-by: Wenwen Wang
    Cc:
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Wenwen Wang
     
  • commit c8beccc19b92f5172994c0732db689c08f4f98e5 upstream.

    Power-saving is causing loud plops on the Lenovo C50 All in one, add it
    to the blacklist.

    BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1572975
    Signed-off-by: Hans de Goede
    Cc:
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Hans de Goede
     
  • commit 21493316a3c4598f308d5a9fa31cc74639c4caff upstream.

    Currently it's not possible to set volume lower than 26% (it just mutes).

    Also fixes this warning:

    Warning! Unlikely big volume range (=9472), cval->res is probably wrong.
    [13] FU [PCM Playback Volume] ch = 2, val = -9473/-1/1

    , and volume works fine for full range.

    Signed-off-by: Federico Cuello
    Cc:
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Federico Cuello
     
  • commit c171654caa875919be3c533d3518da8be5be966e upstream.

    stub_probe() calls put_busid_priv() in an error path when device isn't
    found in the busid_table. Fix it by making put_busid_priv() safe to be
    called with null struct bus_id_priv pointer.

    This problem happens when "usbip bind" is run without loading usbip_host
    driver and then running modprobe. The first failed bind attempt unbinds
    the device from the original driver and when usbip_host is modprobed,
    stub_probe() runs and doesn't find the device in its busid table and calls
    put_busid_priv(0 with null bus_id_priv pointer.

    usbip-host 3-10.2: 3-10.2 is not in match_busid table... skip!

    [ 367.359679] =====================================
    [ 367.359681] WARNING: bad unlock balance detected!
    [ 367.359683] 4.17.0-rc4+ #5 Not tainted
    [ 367.359685] -------------------------------------
    [ 367.359688] modprobe/2768 is trying to release lock (
    [ 367.359689]
    ==================================================================
    [ 367.359696] BUG: KASAN: null-ptr-deref in print_unlock_imbalance_bug+0x99/0x110
    [ 367.359699] Read of size 8 at addr 0000000000000058 by task modprobe/2768

    [ 367.359705] CPU: 4 PID: 2768 Comm: modprobe Not tainted 4.17.0-rc4+ #5

    Fixes: 22076557b07c ("usbip: usbip_host: fix NULL-ptr deref and use-after-free errors") in usb-linus
    Signed-off-by: Shuah Khan (Samsung OSG)
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Shuah Khan (Samsung OSG)
     
  • commit 22076557b07c12086eeb16b8ce2b0b735f7a27e7 upstream.

    usbip_host updates device status without holding lock from stub probe,
    disconnect and rebind code paths. When multiple requests to import a
    device are received, these unprotected code paths step all over each
    other and drive fails with NULL-ptr deref and use-after-free errors.

    The driver uses a table lock to protect the busid array for adding and
    deleting busids to the table. However, the probe, disconnect and rebind
    paths get the busid table entry and update the status without holding
    the busid table lock. Add a new finer grain lock to protect the busid
    entry. This new lock will be held to search and update the busid entry
    fields from get_busid_idx(), add_match_busid() and del_match_busid().

    match_busid_show() does the same to access the busid entry fields.

    get_busid_priv() changed to return the pointer to the busid entry holding
    the busid lock. stub_probe(), stub_disconnect() and stub_device_rebind()
    call put_busid_priv() to release the busid lock before returning. This
    changes fixes the unprotected code paths eliminating the race conditions
    in updating the busid entries.

    Reported-by: Jakub Jirasek
    Signed-off-by: Shuah Khan (Samsung OSG)
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Shuah Khan (Samsung OSG)
     
  • commit 7510df3f29d44685bab7b1918b61a8ccd57126a9 upstream.

    After removing usbip_host module, devices it releases are left without
    a driver. For example, when a keyboard or a mass storage device are
    bound to usbip_host when it is removed, these devices are no longer
    bound to any driver.

    Fix it to run device_attach() from the module exit routine to restore
    the devices to their original drivers. This includes cleanup changes
    and moving device_attach() code to a common routine to be called from
    rebind_store() and usbip_host_exit().

    Signed-off-by: Shuah Khan (Samsung OSG)
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Shuah Khan (Samsung OSG)
     
  • commit 1e180f167d4e413afccbbb4a421b48b2de832549 upstream.

    Device is left in the busid_table after unbind and rebind. Rebind
    initiates usb bus scan and the original driver claims the device.
    After rescan the device should be deleted from the busid_table as
    it no longer belongs to usbip_host.

    Fix it to delete the device after device_attach() succeeds.

    Signed-off-by: Shuah Khan (Samsung OSG)
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Shuah Khan (Samsung OSG)
     
  • commit 28b68acc4a88dcf91fd1dcf2577371dc9bf574cc upstream.

    Refine probe and disconnect debug msgs to be useful and say what is
    in progress.

    Signed-off-by: Shuah Khan
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Shuah Khan
     

19 May, 2018

15 commits

  • Greg Kroah-Hartman
     
  • commit 7f7ccc2ccc2e70c6054685f5e3522efa81556830 upstream.

    proc_pid_cmdline_read() and environ_read() directly access the target
    process' VM to retrieve the command line and environment. If this
    process remaps these areas onto a file via mmap(), the requesting
    process may experience various issues such as extra delays if the
    underlying device is slow to respond.

    Let's simply refuse to access file-backed areas in these functions.
    For this we add a new FOLL_ANON gup flag that is passed to all calls
    to access_remote_vm(). The code already takes care of such failures
    (including unmapped areas). Accesses via /proc/pid/mem were not
    changed though.

    This was assigned CVE-2018-1120.

    Note for stable backports: the patch may apply to kernels prior to 4.11
    but silently miss one location; it must be checked that no call to
    access_remote_vm() keeps zero as the last argument.

    Reported-by: Qualys Security Advisory
    Cc: Linus Torvalds
    Cc: Andy Lutomirski
    Cc: Oleg Nesterov
    Cc: stable@vger.kernel.org
    Signed-off-by: Willy Tarreau
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Willy Tarreau
     
  • commit de3b58bc359a861d5132300f53f95e83f71954b3 upstream.

    Revert commit 820da5357572 ("l2tp: fix missing print session offset
    info"). The peer_offset parameter is removed.

    Signed-off-by: James Chapman
    Signed-off-by: David S. Miller
    Cc: Guillaume Nault
    Signed-off-by: Greg Kroah-Hartman

    James Chapman
     
  • commit 75bf50f4aaa1c78d769d854ab3d975884909e4fb upstream.

    copy geniv when cloning the xfrm state.

    x->geniv was not copied to the new state and migration would fail.

    xfrm_do_migrate
    ..
    xfrm_state_clone()
    ..
    ..
    esp_init_aead()
    crypto_alloc_aead()
    crypto_alloc_tfm()
    crypto_find_alg() return EAGAIN and failed

    Signed-off-by: Antony Antony
    Signed-off-by: Steffen Klassert
    Cc: Ben Hutchings
    Signed-off-by: Greg Kroah-Hartman

    Antony Antony
     
  • commit 998ac6d21cfd6efd58f5edf420bae8839dda9f2a upstream.

    In preivous patch:
    Btrfs: kill trans in run_delalloc_nocow and btrfs_cross_ref_exist
    We avoid starting btrfs transaction and get this information from
    fs_info->running_transaction directly.

    When accessing running_transaction in check_delayed_ref, there's a
    chance that current transaction will be freed by commit transaction
    after the NULL pointer check of running_transaction is passed.

    After looking all the other places using fs_info->running_transaction,
    they are either protected by trans_lock or holding the transactions.

    Fix this by using trans_lock and increasing the use_count.

    Fixes: e4c3b2dcd144 ("Btrfs: kill trans in run_delalloc_nocow and btrfs_cross_ref_exist")
    CC: stable@vger.kernel.org # 4.14+
    Signed-off-by: ethanwu
    Signed-off-by: David Sterba
    Signed-off-by: Greg Kroah-Hartman

    ethanwu
     
  • commit d16b46e4fd8bc6063624605f25b8c0835bb1fbe3 upstream.

    We do not need locking in xfrm_trans_queue because it is designed
    to use per-CPU buffers. However, the original code incorrectly
    used skb_queue_tail which takes the lock. This patch switches
    it to __skb_queue_tail instead.

    Reported-and-tested-by: Artem Savkov
    Fixes: acf568ee859f ("xfrm: Reinject transport-mode packets...")
    Signed-off-by: Herbert Xu
    Signed-off-by: Steffen Klassert
    Signed-off-by: Alistair Strachan
    Signed-off-by: Greg Kroah-Hartman

    Herbert Xu
     
  • commit 7d3af7d96af7b9f51e1ef67b6f4725f545737da2 upstream.

    commit b60710ec7d7a ("scsi: aacraid: enable sending of TMFs from
    aac_hba_send()") allows aac_hba_send() to send scsi commands, and TMF
    requests, but the existing code only updates the iu_type for scsi
    commands. For TMF requests we are sending an unknown iu_type to
    firmware, which causes a fault.

    Include iu_type prior to determining the validity of the command

    Reported-by: Noah Misner
    Fixes: b60710ec7d7ab ("aacraid: enable sending of TMFs from aac_hba_send()")
    Fixes: 423400e64d377 ("aacraid: Include HBA direct interface")
    Tested-by: Noah Misner
    cc: stable@vger.kernel.org
    Signed-off-by: Dave Carroll
    Reviewed-by: Raghava Aditya Renukunta
    Reviewed-by: Brian King
    Signed-off-by: Martin K. Petersen
    Signed-off-by: Greg Kroah-Hartman

    Dave Carroll
     
  • [ Upstream commit 69678bcd4d2dedbc3e8fcd6d7d99f283d83c531a ]

    Damir reported a breakage of SO_BINDTODEVICE for UDP sockets.
    In absence of VRF devices, after commit fb74c27735f0 ("net:
    ipv4: add second dif to udp socket lookups") the dif mismatch
    isn't fatal anymore for UDP socket lookup with non null
    sk_bound_dev_if, breaking SO_BINDTODEVICE semantics.

    This changeset addresses the issue making the dif match mandatory
    again in the above scenario.

    Reported-by: Damir Mansurov
    Fixes: fb74c27735f0 ("net: ipv4: add second dif to udp socket lookups")
    Fixes: 1801b570dd2a ("net: ipv6: add second dif to udp socket lookups")
    Signed-off-by: Paolo Abeni
    Acked-by: David Ahern
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Paolo Abeni
     
  • [ Upstream commit af50e4ba34f4c45e92535364133d4deb5931c1c5 ]

    syzbot caught an infinite recursion in nsh_gso_segment().

    Problem here is that we need to make sure the NSH header is of
    reasonable length.

    BUG: MAX_LOCK_DEPTH too low!
    turning off the locking correctness validator.
    depth: 48 max: 48!
    48 locks held by syz-executor0/10189:
    #0: (ptrval) (rcu_read_lock_bh){....}, at: __dev_queue_xmit+0x30f/0x34c0 net/core/dev.c:3517
    #1: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #1: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #2: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #2: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #3: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #3: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #4: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #4: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #5: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #5: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #6: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #6: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #7: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #7: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #8: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #8: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #9: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #9: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #10: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #10: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #11: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #11: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #12: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #12: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #13: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #13: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #14: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #14: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #15: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #15: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #16: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #16: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #17: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #17: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #18: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #18: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #19: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #19: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #20: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #20: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #21: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #21: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #22: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #22: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #23: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #23: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #24: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #24: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #25: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #25: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #26: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #26: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #27: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #27: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #28: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #28: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #29: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #29: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #30: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #30: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #31: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #31: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    dccp_close: ABORT with 65423 bytes unread
    #32: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #32: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #33: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #33: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #34: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #34: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #35: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #35: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #36: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #36: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #37: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #37: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #38: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #38: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #39: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #39: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #40: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #40: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #41: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #41: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #42: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #42: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #43: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #43: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #44: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #44: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #45: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #45: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #46: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #46: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    #47: (ptrval) (rcu_read_lock){....}, at: __skb_pull include/linux/skbuff.h:2080 [inline]
    #47: (ptrval) (rcu_read_lock){....}, at: skb_mac_gso_segment+0x221/0x720 net/core/dev.c:2787
    INFO: lockdep is turned off.
    CPU: 1 PID: 10189 Comm: syz-executor0 Not tainted 4.17.0-rc2+ #26
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
    Call Trace:
    __dump_stack lib/dump_stack.c:77 [inline]
    dump_stack+0x1b9/0x294 lib/dump_stack.c:113
    __lock_acquire+0x1788/0x5140 kernel/locking/lockdep.c:3449
    lock_acquire+0x1dc/0x520 kernel/locking/lockdep.c:3920
    rcu_lock_acquire include/linux/rcupdate.h:246 [inline]
    rcu_read_lock include/linux/rcupdate.h:632 [inline]
    skb_mac_gso_segment+0x25b/0x720 net/core/dev.c:2789
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    nsh_gso_segment+0x405/0xb60 net/nsh/nsh.c:107
    skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
    __skb_gso_segment+0x3bb/0x870 net/core/dev.c:2865
    skb_gso_segment include/linux/netdevice.h:4025 [inline]
    validate_xmit_skb+0x54d/0xd90 net/core/dev.c:3118
    validate_xmit_skb_list+0xbf/0x120 net/core/dev.c:3168
    sch_direct_xmit+0x354/0x11e0 net/sched/sch_generic.c:312
    qdisc_restart net/sched/sch_generic.c:399 [inline]
    __qdisc_run+0x741/0x1af0 net/sched/sch_generic.c:410
    __dev_xmit_skb net/core/dev.c:3243 [inline]
    __dev_queue_xmit+0x28ea/0x34c0 net/core/dev.c:3551
    dev_queue_xmit+0x17/0x20 net/core/dev.c:3616
    packet_snd net/packet/af_packet.c:2951 [inline]
    packet_sendmsg+0x40f8/0x6070 net/packet/af_packet.c:2976
    sock_sendmsg_nosec net/socket.c:629 [inline]
    sock_sendmsg+0xd5/0x120 net/socket.c:639
    __sys_sendto+0x3d7/0x670 net/socket.c:1789
    __do_sys_sendto net/socket.c:1801 [inline]
    __se_sys_sendto net/socket.c:1797 [inline]
    __x64_sys_sendto+0xe1/0x1a0 net/socket.c:1797
    do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:287
    entry_SYSCALL_64_after_hwframe+0x49/0xbe

    Fixes: c411ed854584 ("nsh: add GSO support")
    Signed-off-by: Eric Dumazet
    Cc: Jiri Benc
    Reported-by: syzbot
    Acked-by: Jiri Benc
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Eric Dumazet
     
  • [ Upstream commit 1ccef350db2f13715040a10df77ae672206004cf ]

    For ICMPv4, the checksum is calculated from the ICMP headers and data.
    Since the ICMPv4 checksum doesn't cover the IP header, we can allow to
    do L3 header re-write for this protocol.

    Fixes: bdd66ac0aeed ('net/mlx5e: Disallow TC offloading of unsupported match/action combinations')
    Signed-off-by: Jianbo Liu
    Reviewed-by: Or Gerlitz
    Signed-off-by: Saeed Mahameed
    Signed-off-by: Greg Kroah-Hartman

    Jianbo Liu
     
  • [ Upstream commit cea67a2dd6b2419dcc13a39309b9a79a1f773193 ]

    syzbot/KMSAN reported an uninit-value in ip6_multipath_l3_keys(),
    root caused to a bad assumption of ICMP header being already
    pulled in skb->head

    ip_multipath_l3_keys() does the correct thing, so it is an IPv6 only bug.

    BUG: KMSAN: uninit-value in ip6_multipath_l3_keys net/ipv6/route.c:1830 [inline]
    BUG: KMSAN: uninit-value in rt6_multipath_hash+0x5c4/0x640 net/ipv6/route.c:1858
    CPU: 0 PID: 4507 Comm: syz-executor661 Not tainted 4.16.0+ #87
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
    Call Trace:
    __dump_stack lib/dump_stack.c:17 [inline]
    dump_stack+0x185/0x1d0 lib/dump_stack.c:53
    kmsan_report+0x142/0x240 mm/kmsan/kmsan.c:1067
    __msan_warning_32+0x6c/0xb0 mm/kmsan/kmsan_instr.c:683
    ip6_multipath_l3_keys net/ipv6/route.c:1830 [inline]
    rt6_multipath_hash+0x5c4/0x640 net/ipv6/route.c:1858
    ip6_route_input+0x65a/0x920 net/ipv6/route.c:1884
    ip6_rcv_finish+0x413/0x6e0 net/ipv6/ip6_input.c:69
    NF_HOOK include/linux/netfilter.h:288 [inline]
    ipv6_rcv+0x1e16/0x2340 net/ipv6/ip6_input.c:208
    __netif_receive_skb_core+0x47df/0x4a90 net/core/dev.c:4562
    __netif_receive_skb net/core/dev.c:4627 [inline]
    netif_receive_skb_internal+0x49d/0x630 net/core/dev.c:4701
    netif_receive_skb+0x230/0x240 net/core/dev.c:4725
    tun_rx_batched drivers/net/tun.c:1555 [inline]
    tun_get_user+0x740f/0x7c60 drivers/net/tun.c:1962
    tun_chr_write_iter+0x1d4/0x330 drivers/net/tun.c:1990
    call_write_iter include/linux/fs.h:1782 [inline]
    new_sync_write fs/read_write.c:469 [inline]
    __vfs_write+0x7fb/0x9f0 fs/read_write.c:482
    vfs_write+0x463/0x8d0 fs/read_write.c:544
    SYSC_write+0x172/0x360 fs/read_write.c:589
    SyS_write+0x55/0x80 fs/read_write.c:581
    do_syscall_64+0x309/0x430 arch/x86/entry/common.c:287
    entry_SYSCALL_64_after_hwframe+0x3d/0xa2

    Fixes: 23aebdacb05d ("ipv6: Compute multipath hash for ICMP errors from offending packet")
    Signed-off-by: Eric Dumazet
    Reported-by: syzbot
    Cc: Jakub Sitnicki
    Acked-by: Jakub Sitnicki
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Eric Dumazet
     
  • [ Upstream commit 97f3efb64323beb0690576e9d74e94998ad6e82a ]

    The hyper-v transparent bonding should have used master_dev_link.
    The netvsc device should look like a master bond device not
    like the upper side of a tunnel.

    This makes the semantics the same so that userspace applications
    looking at network devices see the correct master relationshipship.

    Fixes: 0c195567a8f6 ("netvsc: transparent VF management")
    Signed-off-by: Stephen Hemminger
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Stephen Hemminger
     
  • [ Upstream commit 9c26f5f89d01ca21560c6b8a8e4054c271cc3a9c ]

    When we fail to initialize the RX root namespace, we need
    to clean only that and not the entire flow steering.

    Currently the code may try to clean the flow steering twice
    on error witch leads to null pointer deference.
    Make sure we clean correctly.

    Fixes: fba53f7b5719 ("net/mlx5: Introduce mlx5_flow_steering structure")
    Signed-off-by: Talat Batheesh
    Reviewed-by: Mark Bloch
    Signed-off-by: Saeed Mahameed
    Signed-off-by: Greg Kroah-Hartman

    Talat Batheesh
     
  • [ Upstream commit d9a96ec362e3da878c378854e25321c85bac52c2 ]

    In case of a dma_mapping_error, do not use wi->num_dma
    as a parameter for dma unmap function because it's yet
    to be set, and holds an out-of-date value.
    Use actual value (local variable num_dma) instead.

    Fixes: 34802a42b352 ("net/mlx5e: Do not modify the TX SKB")
    Fixes: e586b3b0baee ("net/mlx5: Ethernet Datapath files")
    Signed-off-by: Tariq Toukan
    Signed-off-by: Saeed Mahameed
    Signed-off-by: Greg Kroah-Hartman

    Tariq Toukan
     
  • [ Upstream commit d68d75fdc34b0253c2bded7ed18cd60eb5a9599b ]

    In case modules are not configured, error out when tp->ops is null
    and prevent later null pointer dereference.

    Fixes: 33a48927c193 ("sched: push TC filter protocol creation into a separate function")
    Signed-off-by: Jiri Pirko
    Acked-by: Cong Wang
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Jiri Pirko