19 Aug, 2020

2 commits

  • [ Upstream commit f0a5e4d7a594e0fe237d3dfafb069bb82f80f42f ]

    YangYuxi is reporting that connection reuse
    is causing one-second delay when SYN hits
    existing connection in TIME_WAIT state.
    Such delay was added to give time to expire
    both the IPVS connection and the corresponding
    conntrack. This was considered a rare case
    at that time but it is causing problem for
    some environments such as Kubernetes.

    As nf_conntrack_tcp_packet() can decide to
    release the conntrack in TIME_WAIT state and
    to replace it with a fresh NEW conntrack, we
    can use this to allow rescheduling just by
    tuning our check: if the conntrack is
    confirmed we can not schedule it to different
    real server and the one-second delay still
    applies but if new conntrack was created,
    we are free to select new real server without
    any delays.

    YangYuxi lists some of the problem reports:

    - One second connection delay in masquerading mode:
    https://marc.info/?t=151683118100004&r=1&w=2

    - IPVS low throughput #70747
    https://github.com/kubernetes/kubernetes/issues/70747

    - Apache Bench can fill up ipvs service proxy in seconds #544
    https://github.com/cloudnativelabs/kube-router/issues/544

    - Additional 1s latency in `host -> service IP -> pod`
    https://github.com/kubernetes/kubernetes/issues/90854

    Fixes: f719e3754ee2 ("ipvs: drop first packet to redirect conntrack")
    Co-developed-by: YangYuxi
    Signed-off-by: YangYuxi
    Signed-off-by: Julian Anastasov
    Reviewed-by: Simon Horman
    Signed-off-by: Pablo Neira Ayuso
    Signed-off-by: Sasha Levin

    Julian Anastasov
     
  • [ Upstream commit f9c70bdc279b191da8d60777c627702c06e4a37d ]

    In the case we set or free the global value listen_chan in
    different threads, we can encounter the UAF problems because
    the method is not protected by any lock, add one to avoid
    this bug.

    BUG: KASAN: use-after-free in l2cap_chan_close+0x48/0x990
    net/bluetooth/l2cap_core.c:730
    Read of size 8 at addr ffff888096950000 by task kworker/1:102/2868

    CPU: 1 PID: 2868 Comm: kworker/1:102 Not tainted 5.5.0-syzkaller #0
    Hardware name: Google Google Compute Engine/Google Compute Engine,
    BIOS Google 01/01/2011
    Workqueue: events do_enable_set
    Call Trace:
    __dump_stack lib/dump_stack.c:77 [inline]
    dump_stack+0x1fb/0x318 lib/dump_stack.c:118
    print_address_description+0x74/0x5c0 mm/kasan/report.c:374
    __kasan_report+0x149/0x1c0 mm/kasan/report.c:506
    kasan_report+0x26/0x50 mm/kasan/common.c:641
    __asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:135
    l2cap_chan_close+0x48/0x990 net/bluetooth/l2cap_core.c:730
    do_enable_set+0x660/0x900 net/bluetooth/6lowpan.c:1074
    process_one_work+0x7f5/0x10f0 kernel/workqueue.c:2264
    worker_thread+0xbbc/0x1630 kernel/workqueue.c:2410
    kthread+0x332/0x350 kernel/kthread.c:255
    ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352

    Allocated by task 2870:
    save_stack mm/kasan/common.c:72 [inline]
    set_track mm/kasan/common.c:80 [inline]
    __kasan_kmalloc+0x118/0x1c0 mm/kasan/common.c:515
    kasan_kmalloc+0x9/0x10 mm/kasan/common.c:529
    kmem_cache_alloc_trace+0x221/0x2f0 mm/slab.c:3551
    kmalloc include/linux/slab.h:555 [inline]
    kzalloc include/linux/slab.h:669 [inline]
    l2cap_chan_create+0x50/0x320 net/bluetooth/l2cap_core.c:446
    chan_create net/bluetooth/6lowpan.c:640 [inline]
    bt_6lowpan_listen net/bluetooth/6lowpan.c:959 [inline]
    do_enable_set+0x6a4/0x900 net/bluetooth/6lowpan.c:1078
    process_one_work+0x7f5/0x10f0 kernel/workqueue.c:2264
    worker_thread+0xbbc/0x1630 kernel/workqueue.c:2410
    kthread+0x332/0x350 kernel/kthread.c:255
    ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352

    Freed by task 2870:
    save_stack mm/kasan/common.c:72 [inline]
    set_track mm/kasan/common.c:80 [inline]
    kasan_set_free_info mm/kasan/common.c:337 [inline]
    __kasan_slab_free+0x12e/0x1e0 mm/kasan/common.c:476
    kasan_slab_free+0xe/0x10 mm/kasan/common.c:485
    __cache_free mm/slab.c:3426 [inline]
    kfree+0x10d/0x220 mm/slab.c:3757
    l2cap_chan_destroy net/bluetooth/l2cap_core.c:484 [inline]
    kref_put include/linux/kref.h:65 [inline]
    l2cap_chan_put+0x170/0x190 net/bluetooth/l2cap_core.c:498
    do_enable_set+0x66c/0x900 net/bluetooth/6lowpan.c:1075
    process_one_work+0x7f5/0x10f0 kernel/workqueue.c:2264
    worker_thread+0xbbc/0x1630 kernel/workqueue.c:2410
    kthread+0x332/0x350 kernel/kthread.c:255
    ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352

    The buggy address belongs to the object at ffff888096950000
    which belongs to the cache kmalloc-2k of size 2048
    The buggy address is located 0 bytes inside of
    2048-byte region [ffff888096950000, ffff888096950800)
    The buggy address belongs to the page:
    page:ffffea00025a5400 refcount:1 mapcount:0 mapping:ffff8880aa400e00 index:0x0
    flags: 0xfffe0000000200(slab)
    raw: 00fffe0000000200 ffffea00027d1548 ffffea0002397808 ffff8880aa400e00
    raw: 0000000000000000 ffff888096950000 0000000100000001 0000000000000000
    page dumped because: kasan: bad access detected

    Memory state around the buggy address:
    ffff88809694ff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    ffff88809694ff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    >ffff888096950000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    ^
    ffff888096950080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    ffff888096950100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    ==================================================================

    Reported-by: syzbot+96414aa0033c363d8458@syzkaller.appspotmail.com
    Signed-off-by: Lihong Kou
    Signed-off-by: Marcel Holtmann
    Signed-off-by: Sasha Levin

    Lihong Kou
     

11 Aug, 2020

14 commits

  • commit 412055398b9e67e07347a936fc4a6adddabe9cf4 upstream.

    svcrdma expects that the payload falls precisely into the xdr_buf
    page vector. This does not seem to be the case for
    nfsd4_encode_readv().

    This code is called only when fops->splice_read is missing or when
    RQ_SPLICE_OK is clear, so it's not a noticeable problem in many
    common cases.

    Add new transport method: ->xpo_read_payload so that when a READ
    payload does not fit exactly in rq_res's page vector, the XDR
    encoder can inform the RPC transport exactly where that payload is,
    without the payload's XDR pad.

    That way, when a Write chunk is present, the transport knows what
    byte range in the Reply message is supposed to be matched with the
    chunk.

    Note that the Linux NFS server implementation of NFS/RDMA can
    currently handle only one Write chunk per RPC-over-RDMA message.
    This simplifies the implementation of this fix.

    Fixes: b04209806384 ("nfsd4: allow exotic read compounds")
    Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=198053
    Signed-off-by: Chuck Lever
    Cc: Timo Rothenpieler
    Signed-off-by: Greg Kroah-Hartman

    Chuck Lever
     
  • [ Upstream commit 730e700e2c19d87e578ff0e7d8cb1d4a02b036d2 ]

    For retransmitted packets, TCP needs to resort to using TCP timestamps
    for computing RTT samples. In the common case where the data and ACK
    fall in the same 1-millisecond interval, TCP senders with millisecond-
    granularity TCP timestamps compute a ca_rtt_us of 0. This ca_rtt_us
    of 0 propagates to rs->rtt_us.

    This value of 0 can cause performance problems for congestion control
    modules. For example, in BBR, the zero min_rtt sample can bring the
    min_rtt and BDP estimate down to 0, reduce snd_cwnd and result in a
    low throughput. It would be hard to mitigate this with filtering in
    the congestion control module, because the proper floor to apply would
    depend on the method of RTT sampling (using timestamp options or
    internally-saved transmission timestamps).

    This fix applies a floor of 1 for the RTT sample delta from TCP
    timestamps, so that seq_rtt_us, ca_rtt_us, and rs->rtt_us will be at
    least 1 * (USEC_PER_SEC / TCP_TS_HZ).

    Note that the receiver RTT computation in tcp_rcv_rtt_measure() and
    min_rtt computation in tcp_update_rtt_min() both already apply a floor
    of 1 timestamp tick, so this commit makes the code more consistent in
    avoiding this edge case of a value of 0.

    Signed-off-by: Jianfeng Wang
    Signed-off-by: Neal Cardwell
    Signed-off-by: Eric Dumazet
    Acked-by: Kevin Yang
    Acked-by: Yuchung Cheng
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Jianfeng Wang
     
  • [ Upstream commit 9aba6c5b49254d5bee927d81593ed4429e91d4ae ]

    ovs_ct_put_key() is potentially copying uninitialized kernel stack memory
    into socket buffers, since the compiler may leave a 3-byte hole at the end
    of `struct ovs_key_ct_tuple_ipv4` and `struct ovs_key_ct_tuple_ipv6`. Fix
    it by initializing `orig` with memset().

    Fixes: 9dd7f8907c37 ("openvswitch: Add original direction conntrack tuple to sw_flow_key.")
    Suggested-by: Dan Carpenter
    Signed-off-by: Peilin Ye
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Peilin Ye
     
  • [ Upstream commit 622e32b7d4a6492cf5c1f759ef833f817418f7b3 ]

    The GRE tunnel can be used to transport traffic that does not rely on a
    Internet checksum (e.g. SCTP). The issue can be triggered creating a GRE
    or GRETAP tunnel and transmitting SCTP traffic ontop of it where CRC
    offload has been disabled. In order to fix the issue we need to
    recompute the GRE csum in gre_gso_segment() not relying on the inner
    checksum.
    The issue is still present when we have the CRC offload enabled.
    In this case we need to disable the CRC offload if we require GRE
    checksum since otherwise skb_checksum() will report a wrong value.

    Fixes: 90017accff61 ("sctp: Add GSO support")
    Signed-off-by: Lorenzo Bianconi
    Reviewed-by: Marcelo Ricardo Leitner
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Lorenzo Bianconi
     
  • [ Upstream commit d0f6ba2ef2c1c95069509e71402e7d6d43452512 ]

    Add a missing return statement to atalk_proc_init so it doesn't return
    -ENOMEM when successful. This allows the appletalk module to load
    properly.

    Fixes: e2bcd8b0ce6e ("appletalk: use remove_proc_subtree to simplify procfs code")
    Link: https://www.downtowndougbrown.com/2020/08/hacking-up-a-fix-for-the-broken-appletalk-kernel-module-in-linux-5-1-and-newer/
    Reported-by: Christopher KOBAYASHI
    Reported-by: Doug Brown
    Signed-off-by: Vincent Duvert
    [lukas: add missing tags]
    Signed-off-by: Lukas Wunner
    Cc: stable@vger.kernel.org # v5.1+
    Cc: Yue Haibing
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Vincent Duvert
     
  • [ Upstream commit 65550098c1c4db528400c73acf3e46bfa78d9264 ]

    There's a race between rxrpc_sendmsg setting up a call, but then failing to
    send anything on it due to an error, and recvmsg() seeing the call
    completion occur and trying to return the state to the user.

    An assertion fails in rxrpc_recvmsg() because the call has already been
    released from the socket and is about to be released again as recvmsg deals
    with it. (The recvmsg_q queue on the socket holds a ref, so there's no
    problem with use-after-free.)

    We also have to be careful not to end up reporting an error twice, in such
    a way that both returns indicate to userspace that the user ID supplied
    with the call is no longer in use - which could cause the client to
    malfunction if it recycles the user ID fast enough.

    Fix this by the following means:

    (1) When sendmsg() creates a call after the point that the call has been
    successfully added to the socket, don't return any errors through
    sendmsg(), but rather complete the call and let recvmsg() retrieve
    them. Make sendmsg() return 0 at this point. Further calls to
    sendmsg() for that call will fail with ESHUTDOWN.

    Note that at this point, we haven't send any packets yet, so the
    server doesn't yet know about the call.

    (2) If sendmsg() returns an error when it was expected to create a new
    call, it means that the user ID wasn't used.

    (3) Mark the call disconnected before marking it completed to prevent an
    oops in rxrpc_release_call().

    (4) recvmsg() will then retrieve the error and set MSG_EOR to indicate
    that the user ID is no longer known by the kernel.

    An oops like the following is produced:

    kernel BUG at net/rxrpc/recvmsg.c:605!
    ...
    RIP: 0010:rxrpc_recvmsg+0x256/0x5ae
    ...
    Call Trace:
    ? __init_waitqueue_head+0x2f/0x2f
    ____sys_recvmsg+0x8a/0x148
    ? import_iovec+0x69/0x9c
    ? copy_msghdr_from_user+0x5c/0x86
    ___sys_recvmsg+0x72/0xaa
    ? __fget_files+0x22/0x57
    ? __fget_light+0x46/0x51
    ? fdget+0x9/0x1b
    do_recvmmsg+0x15e/0x232
    ? _raw_spin_unlock+0xa/0xb
    ? vtime_delta+0xf/0x25
    __x64_sys_recvmmsg+0x2c/0x2f
    do_syscall_64+0x4c/0x78
    entry_SYSCALL_64_after_hwframe+0x44/0xa9

    Fixes: 357f5ef64628 ("rxrpc: Call rxrpc_release_call() on error in rxrpc_new_client_call()")
    Reported-by: syzbot+b54969381df354936d96@syzkaller.appspotmail.com
    Signed-off-by: David Howells
    Reviewed-by: Marc Dionne
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    David Howells
     
  • [ Upstream commit 706ec919164622ff5ce822065472d0f30a9e9dd2 ]

    ip6_route_info_create() invokes nexthop_get(), which increases the
    refcount of the "nh".

    When ip6_route_info_create() returns, local variable "nh" becomes
    invalid, so the refcount should be decreased to keep refcount balanced.

    The reference counting issue happens in one exception handling path of
    ip6_route_info_create(). When nexthops can not be used with source
    routing, the function forgets to decrease the refcnt increased by
    nexthop_get(), causing a refcnt leak.

    Fix this issue by pulling up the error source routing handling when
    nexthops can not be used with source routing.

    Fixes: f88d8ea67fbd ("ipv6: Plumb support for nexthop object in a fib6_info")
    Signed-off-by: Xiyu Yang
    Signed-off-by: Xin Tan
    Reviewed-by: David Ahern
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Xiyu Yang
     
  • [ Upstream commit 8c0de6e96c9794cb523a516c465991a70245da1c ]

    IPV6_ADDRFORM causes resource leaks when converting an IPv6 socket
    to IPv4, particularly struct ipv6_ac_socklist. Similar to
    struct ipv6_mc_socklist, we should just close it on this path.

    This bug can be easily reproduced with the following C program:

    #include
    #include
    #include
    #include
    #include

    int main()
    {
    int s, value;
    struct sockaddr_in6 addr;
    struct ipv6_mreq m6;

    s = socket(AF_INET6, SOCK_DGRAM, 0);
    addr.sin6_family = AF_INET6;
    addr.sin6_port = htons(5000);
    inet_pton(AF_INET6, "::ffff:192.168.122.194", &addr.sin6_addr);
    connect(s, (struct sockaddr *)&addr, sizeof(addr));

    inet_pton(AF_INET6, "fe80::AAAA", &m6.ipv6mr_multiaddr);
    m6.ipv6mr_interface = 5;
    setsockopt(s, SOL_IPV6, IPV6_JOIN_ANYCAST, &m6, sizeof(m6));

    value = AF_INET;
    setsockopt(s, SOL_IPV6, IPV6_ADDRFORM, &value, sizeof(value));

    close(s);
    return 0;
    }

    Reported-by: ch3332xr@gmail.com
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: Cong Wang
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Cong Wang
     
  • [ Upstream commit 83f3522860f702748143e022f1a546547314c715 ]

    fib_trie_unmerge() is called with RTNL held, but not from an RCU
    read-side critical section. This leads to the following warning [1] when
    the FIB alias list in a leaf is traversed with
    hlist_for_each_entry_rcu().

    Since the function is always called with RTNL held and since
    modification of the list is protected by RTNL, simply use
    hlist_for_each_entry() and silence the warning.

    [1]
    WARNING: suspicious RCU usage
    5.8.0-rc4-custom-01520-gc1f937f3f83b #30 Not tainted
    -----------------------------
    net/ipv4/fib_trie.c:1867 RCU-list traversed in non-reader section!!

    other info that might help us debug this:

    rcu_scheduler_active = 2, debug_locks = 1
    1 lock held by ip/164:
    #0: ffffffff85a27850 (rtnl_mutex){+.+.}-{3:3}, at: rtnetlink_rcv_msg+0x49a/0xbd0

    stack backtrace:
    CPU: 0 PID: 164 Comm: ip Not tainted 5.8.0-rc4-custom-01520-gc1f937f3f83b #30
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-2.fc32 04/01/2014
    Call Trace:
    dump_stack+0x100/0x184
    lockdep_rcu_suspicious+0x153/0x15d
    fib_trie_unmerge+0x608/0xdb0
    fib_unmerge+0x44/0x360
    fib4_rule_configure+0xc8/0xad0
    fib_nl_newrule+0x37a/0x1dd0
    rtnetlink_rcv_msg+0x4f7/0xbd0
    netlink_rcv_skb+0x17a/0x480
    rtnetlink_rcv+0x22/0x30
    netlink_unicast+0x5ae/0x890
    netlink_sendmsg+0x98a/0xf40
    ____sys_sendmsg+0x879/0xa00
    ___sys_sendmsg+0x122/0x190
    __sys_sendmsg+0x103/0x1d0
    __x64_sys_sendmsg+0x7d/0xb0
    do_syscall_64+0x54/0xa0
    entry_SYSCALL_64_after_hwframe+0x44/0xa9
    RIP: 0033:0x7fc80a234e97
    Code: Bad RIP value.
    RSP: 002b:00007ffef8b66798 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
    RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fc80a234e97
    RDX: 0000000000000000 RSI: 00007ffef8b66800 RDI: 0000000000000003
    RBP: 000000005f141b1c R08: 0000000000000001 R09: 0000000000000000
    R10: 00007fc80a2a8ac0 R11: 0000000000000246 R12: 0000000000000001
    R13: 0000000000000000 R14: 00007ffef8b67008 R15: 0000556fccb10020

    Fixes: 0ddcf43d5d4a ("ipv4: FIB Local/MAIN table collapse")
    Signed-off-by: Ido Schimmel
    Reviewed-by: Jiri Pirko
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Ido Schimmel
     
  • [ Upstream commit 4052d3d2e8f47a15053320bbcbe365d15610437d ]

    In the case where a vendor command does not implement doit, and has no
    flags set, doit would not be validated and a NULL pointer dereference
    would occur, for example when invoking the vendor command via iw.

    I encountered this while developing new vendor commands. Perhaps in
    practice it is advisable to always implement doit along with dumpit,
    but it seems reasonable to me to always check doit anyway, not just
    when NEED_WDEV.

    Signed-off-by: Julian Squires
    Link: https://lore.kernel.org/r/20200706211353.2366470-1-julian@cipht.net
    Signed-off-by: Johannes Berg
    Signed-off-by: Sasha Levin

    Julian Squires
     
  • [ Upstream commit a39c46067c845a8a2d7144836e9468b7f072343e ]

    p9_fd_open just fgets file descriptors passed in from userspace, but
    doesn't verify that they are valid for read or writing. This gets
    cought down in the VFS when actually attempting a read or write, but
    a new warning added in linux-next upsets syzcaller.

    Fix this by just verifying the fds early on.

    Link: http://lkml.kernel.org/r/20200710085722.435850-1-hch@lst.de
    Reported-by: syzbot+e6f77e16ff68b2434a2c@syzkaller.appspotmail.com
    Signed-off-by: Christoph Hellwig
    [Dominique: amend goto as per Doug Nazar's review]
    Signed-off-by: Dominique Martinet
    Signed-off-by: Sasha Levin

    Christoph Hellwig
     
  • commit 629b49c848ee71244203934347bd7730b0ddee8d upstream.

    Check `num_rsp` before using it as for-loop counter. Add `unlock` label.

    Cc: stable@vger.kernel.org
    Signed-off-by: Peilin Ye
    Signed-off-by: Marcel Holtmann
    Signed-off-by: Greg Kroah-Hartman

    Peilin Ye
     
  • commit 75bbd2ea50ba1c5d9da878a17e92eac02fe0fd3a upstream.

    Check `num_rsp` before using it as for-loop counter.

    Cc: stable@vger.kernel.org
    Signed-off-by: Peilin Ye
    Signed-off-by: Marcel Holtmann
    Signed-off-by: Greg Kroah-Hartman

    Peilin Ye
     
  • commit 51c19bf3d5cfaa66571e4b88ba2a6f6295311101 upstream.

    Check upon `num_rsp` is insufficient. A malformed event packet with a
    large `num_rsp` number makes hci_extended_inquiry_result_evt() go out
    of bounds. Fix it.

    This patch fixes the following syzbot bug:

    https://syzkaller.appspot.com/bug?id=4bf11aa05c4ca51ce0df86e500fce486552dc8d2

    Reported-by: syzbot+d8489a79b781849b9c46@syzkaller.appspotmail.com
    Cc: stable@vger.kernel.org
    Signed-off-by: Peilin Ye
    Acked-by: Greg Kroah-Hartman
    Signed-off-by: Marcel Holtmann
    Signed-off-by: Greg Kroah-Hartman

    Peilin Ye
     

07 Aug, 2020

1 commit

  • commit bb0de3131f4c60a9bf976681e0fe4d1e55c7a821 upstream.

    The sockmap code currently ignores the value of attach_bpf_fd when
    detaching a program. This is contrary to the usual behaviour of
    checking that attach_bpf_fd represents the currently attached
    program.

    Ensure that attach_bpf_fd is indeed the currently attached
    program. It turns out that all sockmap selftests already do this,
    which indicates that this is unlikely to cause breakage.

    Fixes: 604326b41a6f ("bpf, sockmap: convert to generic sk_msg interface")
    Signed-off-by: Lorenz Bauer
    Signed-off-by: Alexei Starovoitov
    Link: https://lore.kernel.org/bpf/20200629095630.7933-5-lmb@cloudflare.com
    Signed-off-by: Greg Kroah-Hartman

    Lorenz Bauer
     

05 Aug, 2020

9 commits

  • [ Upstream commit a2ec905d1e160a33b2e210e45ad30445ef26ce0e ]

    Fix kernel oops observed when an ext adv data is larger than 31 bytes.

    This can be reproduced by setting up an advertiser with advertisement
    larger than 31 bytes. The issue is not sensitive to the advertisement
    content. In particular, this was reproduced with an advertisement of
    229 bytes filled with 'A'. See stack trace below.

    This is fixed by not catching ext_adv as legacy adv are only cached to
    be able to concatenate a scanable adv with its scan response before
    sending it up through mgmt.

    With ext_adv, this is no longer necessary.

    general protection fault: 0000 [#1] SMP PTI
    CPU: 6 PID: 205 Comm: kworker/u17:0 Not tainted 5.4.0-37-generic #41-Ubuntu
    Hardware name: Dell Inc. XPS 15 7590/0CF6RR, BIOS 1.7.0 05/11/2020
    Workqueue: hci0 hci_rx_work [bluetooth]
    RIP: 0010:hci_bdaddr_list_lookup+0x1e/0x40 [bluetooth]
    Code: ff ff e9 26 ff ff ff 0f 1f 44 00 00 0f 1f 44 00 00 55 48 8b 07 48 89 e5 48 39 c7 75 0a eb 24 48 8b 00 48 39 f8 74 1c 44 8b 06 39 40 10 75 ef 44 0f b7 4e 04 66 44 39 48 14 75 e3 38 50 16 75
    RSP: 0018:ffffbc6a40493c70 EFLAGS: 00010286
    RAX: 4141414141414141 RBX: 000000000000001b RCX: 0000000000000000
    RDX: 0000000000000000 RSI: ffff9903e76c100f RDI: ffff9904289d4b28
    RBP: ffffbc6a40493c70 R08: 0000000093570362 R09: 0000000000000000
    R10: 0000000000000000 R11: ffff9904344eae38 R12: ffff9904289d4000
    R13: 0000000000000000 R14: 00000000ffffffa3 R15: ffff9903e76c100f
    FS: 0000000000000000(0000) GS:ffff990434580000(0000) knlGS:0000000000000000
    CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00007feed125a000 CR3: 00000001b860a003 CR4: 00000000003606e0
    Call Trace:
    process_adv_report+0x12e/0x560 [bluetooth]
    hci_le_meta_evt+0x7b2/0xba0 [bluetooth]
    hci_event_packet+0x1c29/0x2a90 [bluetooth]
    hci_rx_work+0x19b/0x360 [bluetooth]
    process_one_work+0x1eb/0x3b0
    worker_thread+0x4d/0x400
    kthread+0x104/0x140

    Fixes: c215e9397b00 ("Bluetooth: Process extended ADV report event")
    Reported-by: Andy Nguyen
    Reported-by: Linus Torvalds
    Reported-by: Balakrishna Godavarthi
    Signed-off-by: Alain Michaud
    Tested-by: Sonny Sasaka
    Acked-by: Marcel Holtmann
    Signed-off-by: Linus Torvalds
    Signed-off-by: Sasha Levin

    Alain Michaud
     
  • [ Upstream commit 5e43540c2af0a0c0a18e39579b1ad49541f87506 ]

    A mpath object can hold reference on a list of skb that are waiting for
    mpath resolution to be sent. When destroying a mpath this skb list
    should be cleaned up in order to not leak memory.

    Fixing that kind of leak:

    unreferenced object 0xffff0000181c9300 (size 1088):
    comm "openvpn", pid 1782, jiffies 4295071698 (age 80.416s)
    hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 f9 80 36 00 00 00 00 00 ..........6.....
    02 00 07 40 00 00 00 00 00 00 00 00 00 00 00 00 ...@............
    backtrace:
    [] kmem_cache_alloc+0x1a4/0x2f0
    [] sk_prot_alloc.isra.39+0x34/0x178
    [] sk_alloc+0x34/0x228
    [] inet_create+0x198/0x518
    [] __sock_create+0x134/0x328
    [] __sys_socket+0xb0/0x158
    [] __arm64_sys_socket+0x40/0x58
    [] el0_svc_handler+0xd0/0x1a0
    [] el0_svc+0x8/0xc
    unreferenced object 0xffff000012973a40 (size 216):
    comm "openvpn", pid 1782, jiffies 4295082137 (age 38.660s)
    hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    00 c0 06 16 00 00 ff ff 00 93 1c 18 00 00 ff ff ................
    backtrace:
    [] kmem_cache_alloc+0x1a4/0x2f0
    [] __alloc_skb+0xc0/0x2b8
    [] alloc_skb_with_frags+0x60/0x320
    [] sock_alloc_send_pskb+0x388/0x3c0
    [] sock_alloc_send_skb+0x1c/0x28
    [] __ip_append_data+0xba4/0x11f0
    [] ip_make_skb+0x14c/0x1a8
    [] udp_sendmsg+0xaf0/0xcf0
    [] inet_sendmsg+0x5c/0x80
    [] __sys_sendto+0x15c/0x218
    [] __arm64_sys_sendto+0x74/0x90
    [] el0_svc_handler+0xd0/0x1a0
    [] el0_svc+0x8/0xc

    Fixes: 2bdaf386f99c (mac80211: mesh: move path tables into if_mesh)
    Signed-off-by: Remi Pommarel
    Link: https://lore.kernel.org/r/20200704135419.27703-1-repk@triplefau.lt
    Signed-off-by: Johannes Berg
    Signed-off-by: Sasha Levin

    Remi Pommarel
     
  • [ Upstream commit 6a01afcf8468d3ca2bd8bbb27503f60dcf643b20 ]

    At ieee80211_join_mesh() some ie data could have been allocated (see
    copy_mesh_setup()) and need to be cleaned up when leaving the mesh.

    This fixes the following kmemleak report:

    unreferenced object 0xffff0000116bc600 (size 128):
    comm "wpa_supplicant", pid 608, jiffies 4294898983 (age 293.484s)
    hex dump (first 32 bytes):
    30 14 01 00 00 0f ac 04 01 00 00 0f ac 04 01 00 0...............
    00 0f ac 08 00 00 00 00 c4 65 40 00 00 00 00 00 .........e@.....
    backtrace:
    [] __kmalloc_track_caller+0x1c0/0x330
    [] kmemdup+0x28/0x50
    [] ieee80211_join_mesh+0x6c/0x3b8 [mac80211]
    [] __cfg80211_join_mesh+0x1e8/0x4f0 [cfg80211]
    [] nl80211_join_mesh+0x520/0x6b8 [cfg80211]
    [] genl_family_rcv_msg+0x374/0x680
    [] genl_rcv_msg+0x78/0x108
    [] netlink_rcv_skb+0xb0/0x1c0
    [] genl_rcv+0x34/0x48
    [] netlink_unicast+0x268/0x2e8
    [] netlink_sendmsg+0x320/0x4c0
    [] ____sys_sendmsg+0x354/0x3a0
    [] ___sys_sendmsg+0xd8/0x120
    [] __sys_sendmsg+0xa4/0xf8
    [] __arm64_sys_sendmsg+0x44/0x58
    [] el0_svc_handler+0xd0/0x1a0

    Fixes: c80d545da3f7 (mac80211: Let userspace enable and configure vendor specific path selection.)
    Signed-off-by: Remi Pommarel
    Link: https://lore.kernel.org/r/20200704135007.27292-1-repk@triplefau.lt
    Signed-off-by: Johannes Berg
    Signed-off-by: Sasha Levin

    Remi Pommarel
     
  • [ Upstream commit 4f47e8ab6ab796b5380f74866fa5287aca4dcc58 ]

    In commit ed17b8d377ea ("xfrm: fix a warning in xfrm_policy_insert_list"),
    it would take 'priority' to make a policy unique, and allow duplicated
    policies with different 'priority' to be added, which is not expected
    by userland, as Tobias reported in strongswan.

    To fix this duplicated policies issue, and also fix the issue in
    commit ed17b8d377ea ("xfrm: fix a warning in xfrm_policy_insert_list"),
    when doing add/del/get/update on user interfaces, this patch is to change
    to look up a policy with both mark and mask by doing:

    mark.v == pol->mark.v && mark.m == pol->mark.m

    and leave the check:

    (mark & pol->mark.m) == pol->mark.v

    for tx/rx path only.

    As the userland expects an exact mark and mask match to manage policies.

    v1->v2:
    - make xfrm_policy_mark_match inline and fix the changelog as
    Tobias suggested.

    Fixes: 295fae568885 ("xfrm: Allow user space manipulation of SPD mark")
    Fixes: ed17b8d377ea ("xfrm: fix a warning in xfrm_policy_insert_list")
    Reported-by: Tobias Brunner
    Tested-by: Tobias Brunner
    Signed-off-by: Xin Long
    Signed-off-by: Steffen Klassert
    Signed-off-by: Sasha Levin

    Xin Long
     
  • commit 8999dc89497ab1c80d0718828e838c7cd5f6bffe upstream.

    We should check null before do x25_neigh_put in x25_disconnect,
    otherwise may cause null-ptr-deref like this:

    #include
    #include

    int main() {
    int sck_x25;
    sck_x25 = socket(AF_X25, SOCK_SEQPACKET, 0);
    close(sck_x25);
    return 0;
    }

    BUG: kernel NULL pointer dereference, address: 00000000000000d8
    CPU: 0 PID: 4817 Comm: t2 Not tainted 5.7.0-rc3+ #159
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.9.3-
    RIP: 0010:x25_disconnect+0x91/0xe0
    Call Trace:
    x25_release+0x18a/0x1b0
    __sock_release+0x3d/0xc0
    sock_close+0x13/0x20
    __fput+0x107/0x270
    ____fput+0x9/0x10
    task_work_run+0x6d/0xb0
    exit_to_usermode_loop+0x102/0x110
    do_syscall_64+0x23c/0x260
    entry_SYSCALL_64_after_hwframe+0x49/0xb3

    Reported-by: syzbot+6db548b615e5aeefdce2@syzkaller.appspotmail.com
    Fixes: 4becb7ee5b3d ("net/x25: Fix x25_neigh refcnt leak when x25 disconnect")
    Signed-off-by: YueHaibing
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    YueHaibing
     
  • commit 4becb7ee5b3d2829ed7b9261a245a77d5b7de902 upstream.

    x25_connect() invokes x25_get_neigh(), which returns a reference of the
    specified x25_neigh object to "x25->neighbour" with increased refcnt.

    When x25 connect success and returns, the reference still be hold by
    "x25->neighbour", so the refcount should be decreased in
    x25_disconnect() to keep refcount balanced.

    The reference counting issue happens in x25_disconnect(), which forgets
    to decrease the refcnt increased by x25_get_neigh() in x25_connect(),
    causing a refcnt leak.

    Fix this issue by calling x25_neigh_put() before x25_disconnect()
    returns.

    Signed-off-by: Xiyu Yang
    Signed-off-by: Xin Tan
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Xiyu Yang
     
  • commit bbc8a99e952226c585ac17477a85ef1194501762 upstream.

    rds_notify_queue_get() is potentially copying uninitialized kernel stack
    memory to userspace since the compiler may leave a 4-byte hole at the end
    of `cmsg`.

    In 2016 we tried to fix this issue by doing `= { 0 };` on `cmsg`, which
    unfortunately does not always initialize that 4-byte hole. Fix it by using
    memset() instead.

    Cc: stable@vger.kernel.org
    Fixes: f037590fff30 ("rds: fix a leak of kernel memory")
    Fixes: bdbe6fbc6a2f ("RDS: recv.c")
    Suggested-by: Dan Carpenter
    Signed-off-by: Peilin Ye
    Acked-by: Santosh Shilimkar
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Peilin Ye
     
  • commit 74d6a5d5662975aed7f25952f62efbb6f6dadd29 upstream.

    p9_read_work and p9_fd_cancelled may be called concurrently.
    In some cases, req->req_list may be deleted by both p9_read_work
    and p9_fd_cancelled.

    We can fix it by ignoring replies associated with a cancelled
    request and ignoring cancelled request if message has been received
    before lock.

    Link: http://lkml.kernel.org/r/20200612090833.36149-1-wanghai38@huawei.com
    Fixes: 60ff779c4abb ("9p: client: remove unused code and any reference to "cancelled" function")
    Cc: # v3.12+
    Reported-by: syzbot+77a25acfa0382e06ab23@syzkaller.appspotmail.com
    Signed-off-by: Wang Hai
    Signed-off-by: Dominique Martinet
    Signed-off-by: Greg Kroah-Hartman

    Wang Hai
     
  • [ Upstream commit f45db2b909c7e76f35850e78f017221f30282b8e ]

    The domain table should be empty at module unload. If it isn't there is
    a bug somewhere. So check and report.

    Link: https://bugzilla.kernel.org/show_bug.cgi?id=206651
    Signed-off-by: NeilBrown
    Signed-off-by: J. Bruce Fields
    Signed-off-by: Sasha Levin

    Sasha Levin
     

01 Aug, 2020

14 commits

  • [ Upstream commit efc6b6f6c3113e8b203b9debfb72d81e0f3dcace ]

    Currently, SO_REUSEPORT does not work well if connected sockets are in a
    UDP reuseport group.

    Then reuseport_has_conns() returns true and the result of
    reuseport_select_sock() is discarded. Also, unconnected sockets have the
    same score, hence only does the first unconnected socket in udp_hslot
    always receive all packets sent to unconnected sockets.

    So, the result of reuseport_select_sock() should be used for load
    balancing.

    The noteworthy point is that the unconnected sockets placed after
    connected sockets in sock_reuseport.socks will receive more packets than
    others because of the algorithm in reuseport_select_sock().

    index | connected | reciprocal_scale | result
    ---------------------------------------------
    0 | no | 20% | 40%
    1 | no | 20% | 20%
    2 | yes | 20% | 0%
    3 | no | 20% | 40%
    4 | yes | 20% | 0%

    If most of the sockets are connected, this can be a problem, but it still
    works better than now.

    Fixes: acdcecc61285 ("udp: correct reuseport selection with connected sockets")
    CC: Willem de Bruijn
    Reviewed-by: Benjamin Herrenschmidt
    Signed-off-by: Kuniyuki Iwashima
    Acked-by: Willem de Bruijn
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Kuniyuki Iwashima
     
  • [ Upstream commit f2b2c55e512879a05456eaf5de4d1ed2f7757509 ]

    If an unconnected socket in a UDP reuseport group connect()s, has_conns is
    set to 1. Then, when a packet is received, udp[46]_lib_lookup2() scans all
    sockets in udp_hslot looking for the connected socket with the highest
    score.

    However, when the number of sockets bound to the port exceeds max_socks,
    reuseport_grow() resets has_conns to 0. It can cause udp[46]_lib_lookup2()
    to return without scanning all sockets, resulting in that packets sent to
    connected sockets may be distributed to unconnected sockets.

    Therefore, reuseport_grow() should copy has_conns.

    Fixes: acdcecc61285 ("udp: correct reuseport selection with connected sockets")
    CC: Willem de Bruijn
    Reviewed-by: Benjamin Herrenschmidt
    Signed-off-by: Kuniyuki Iwashima
    Acked-by: Willem de Bruijn
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Kuniyuki Iwashima
     
  • [ Upstream commit 3ecdda3e9ad837cf9cb41b6faa11b1af3a5abc0c ]

    When adding a stream with stream reconf, the new stream firstly is in
    CLOSED state but new out chunks can still be enqueued. Then once gets
    the confirmation from the peer, the state will change to OPEN.

    However, if the peer denies, it needs to roll back the stream. But when
    doing that, it only sets the stream outcnt back, and the chunks already
    in the new stream don't get purged. It caused these chunks can still be
    dequeued in sctp_outq_dequeue_data().

    As its stream is still in CLOSE, the chunk will be enqueued to the head
    again by sctp_outq_head_data(). This chunk will never be sent out, and
    the chunks after it can never be dequeued. The assoc will be 'hung' in
    a dead loop of sending this chunk.

    To fix it, this patch is to purge these chunks already in the new
    stream by calling sctp_stream_shrink_out() when failing to do the
    addstream reconf.

    Fixes: 11ae76e67a17 ("sctp: implement receiver-side procedures for the Reconf Response Parameter")
    Reported-by: Ying Xu
    Signed-off-by: Xin Long
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Xin Long
     
  • [ Upstream commit 8f13399db22f909a35735bf8ae2f932e0c8f0e30 ]

    It's not necessary to go list_for_each for outq->out_chunk_list
    when new outcnt >= old outcnt, as no chunk with higher sid than
    new (outcnt - 1) exists in the outqueue.

    While at it, also move the list_for_each code in a new function
    sctp_stream_shrink_out(), which will be used in the next patch.

    Signed-off-by: Xin Long
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Xin Long
     
  • [ Upstream commit 17ad73e941b71f3bec7523ea4e9cbc3752461c2d ]

    We recently added some bounds checking in ax25_connect() and
    ax25_sendmsg() and we so we removed the AX25_MAX_DIGIS checks because
    they were no longer required.

    Unfortunately, I believe they are required to prevent integer overflows
    so I have added them back.

    Fixes: 8885bb0621f0 ("AX.25: Prevent out-of-bounds read in ax25_sendmsg()")
    Fixes: 2f2a7ffad5c6 ("AX.25: Fix out-of-bounds read in ax25_connect()")
    Signed-off-by: Dan Carpenter
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Dan Carpenter
     
  • [ Upstream commit 76be93fc0702322179bb0ea87295d820ee46ad14 ]

    Previously TLP may send multiple probes of new data in one
    flight. This happens when the sender is cwnd limited. After the
    initial TLP containing new data is sent, the sender receives another
    ACK that acks partial inflight. It may re-arm another TLP timer
    to send more, if no further ACK returns before the next TLP timeout
    (PTO) expires. The sender may send in theory a large amount of TLP
    until send queue is depleted. This only happens if the sender sees
    such irregular uncommon ACK pattern. But it is generally undesirable
    behavior during congestion especially.

    The original TLP design restrict only one TLP probe per inflight as
    published in "Reducing Web Latency: the Virtue of Gentle Aggression",
    SIGCOMM 2013. This patch changes TLP to send at most one probe
    per inflight.

    Note that if the sender is app-limited, TLP retransmits old data
    and did not have this issue.

    Signed-off-by: Yuchung Cheng
    Signed-off-by: Neal Cardwell
    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Yuchung Cheng
     
  • [ Upstream commit 639f181f0ee20d3249dbc55f740f0167267180f0 ]

    rxrpc_sendmsg() returns EPIPE if there's an outstanding error, such as if
    rxrpc_recvmsg() indicating ENODATA if there's nothing for it to read.

    Change rxrpc_recvmsg() to return EAGAIN instead if there's nothing to read
    as this particular error doesn't get stored in ->sk_err by the networking
    core.

    Also change rxrpc_sendmsg() so that it doesn't fail with delayed receive
    errors (there's no way for it to report which call, if any, the error was
    caused by).

    Fixes: 17926a79320a ("[AF_RXRPC]: Provide secure RxRPC sockets for use by userspace and kernel both")
    Signed-off-by: David Howells
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    David Howells
     
  • [ Upstream commit cebb69754f37d68e1355a5e726fdac317bcda302 ]

    When vlan_newlink call register_vlan_dev fails, it might return error
    with dev->reg_state = NETREG_UNREGISTERED. The rtnl_newlink should
    free the memory. But currently rtnl_newlink only free the memory which
    state is NETREG_UNINITIALIZED.

    BUG: memory leak
    unreferenced object 0xffff8881051de000 (size 4096):
    comm "syz-executor139", pid 560, jiffies 4294745346 (age 32.445s)
    hex dump (first 32 bytes):
    76 6c 61 6e 32 00 00 00 00 00 00 00 00 00 00 00 vlan2...........
    00 45 28 03 81 88 ff ff 00 00 00 00 00 00 00 00 .E(.............
    backtrace:
    [] kmalloc_node include/linux/slab.h:578 [inline]
    [] kvmalloc_node+0x33/0xd0 mm/util.c:574
    [] kvmalloc include/linux/mm.h:753 [inline]
    [] kvzalloc include/linux/mm.h:761 [inline]
    [] alloc_netdev_mqs+0x83/0xd90 net/core/dev.c:9929
    [] rtnl_create_link+0x2c0/0xa20 net/core/rtnetlink.c:3067
    [] __rtnl_newlink+0xc9c/0x1330 net/core/rtnetlink.c:3329
    [] rtnl_newlink+0x66/0x90 net/core/rtnetlink.c:3397
    [] rtnetlink_rcv_msg+0x540/0x990 net/core/rtnetlink.c:5460
    [] netlink_rcv_skb+0x12b/0x3a0 net/netlink/af_netlink.c:2469
    [] netlink_unicast_kernel net/netlink/af_netlink.c:1303 [inline]
    [] netlink_unicast+0x4c6/0x690 net/netlink/af_netlink.c:1329
    [] netlink_sendmsg+0x735/0xcc0 net/netlink/af_netlink.c:1918
    [] sock_sendmsg_nosec net/socket.c:652 [inline]
    [] sock_sendmsg+0x109/0x140 net/socket.c:672
    [] ____sys_sendmsg+0x5f5/0x780 net/socket.c:2352
    [] ___sys_sendmsg+0x11d/0x1a0 net/socket.c:2406
    [] __sys_sendmsg+0xeb/0x1b0 net/socket.c:2439
    [] do_syscall_64+0x56/0xa0 arch/x86/entry/common.c:359
    [] entry_SYSCALL_64_after_hwframe+0x44/0xa9

    Fixes: cb626bf566eb ("net-sysfs: Fix reference count leak")
    Reported-by: Hulk Robot
    Signed-off-by: Weilong Chen
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Weilong Chen
     
  • [ Upstream commit af9f691f0f5bdd1ade65a7b84927639882d7c3e5 ]

    We have to detach sock from socket in qrtr_release(),
    otherwise skb->sk may still reference to this socket
    when the skb is released in tun->queue, particularly
    sk->sk_wq still points to &sock->wq, which leads to
    a UAF.

    Reported-and-tested-by: syzbot+6720d64f31c081c2f708@syzkaller.appspotmail.com
    Fixes: 28fb4e59a47d ("net: qrtr: Expose tunneling endpoint to user space")
    Cc: Bjorn Andersson
    Cc: Eric Dumazet
    Signed-off-by: Cong Wang
    Reviewed-by: Eric Dumazet
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Cong Wang
     
  • [ Upstream commit b0a422772fec29811e293c7c0e6f991c0fd9241d ]

    We can't use IS_UDPLITE to replace udp_sk->pcflag when UDPLITE_RECV_CC is
    checked.

    Fixes: b2bf1e2659b1 ("[UDP]: Clean up for IS_UDPLITE macro")
    Signed-off-by: Miaohe Lin
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Miaohe Lin
     
  • [ Upstream commit 9bb5fbea59f36a589ef886292549ca4052fe676c ]

    When I cat 'tx_timeout' by sysfs, it displays as follows. It's better to
    add a newline for easy reading.

    root@syzkaller:~# cat /sys/devices/virtual/net/lo/queues/tx-0/tx_timeout
    0root@syzkaller:~#

    Signed-off-by: Xiongfeng Wang
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Xiongfeng Wang
     
  • [ Upstream commit 46ef5b89ec0ecf290d74c4aee844f063933c4da4 ]

    KASAN report null-ptr-deref error when register_netdev() failed:

    KASAN: null-ptr-deref in range [0x00000000000003c0-0x00000000000003c7]
    CPU: 2 PID: 422 Comm: ip Not tainted 5.8.0-rc4+ #12
    Call Trace:
    ip6gre_init_net+0x4ab/0x580
    ? ip6gre_tunnel_uninit+0x3f0/0x3f0
    ops_init+0xa8/0x3c0
    setup_net+0x2de/0x7e0
    ? rcu_read_lock_bh_held+0xb0/0xb0
    ? ops_init+0x3c0/0x3c0
    ? kasan_unpoison_shadow+0x33/0x40
    ? __kasan_kmalloc.constprop.0+0xc2/0xd0
    copy_net_ns+0x27d/0x530
    create_new_namespaces+0x382/0xa30
    unshare_nsproxy_namespaces+0xa1/0x1d0
    ksys_unshare+0x39c/0x780
    ? walk_process_tree+0x2a0/0x2a0
    ? trace_hardirqs_on+0x4a/0x1b0
    ? _raw_spin_unlock_irq+0x1f/0x30
    ? syscall_trace_enter+0x1a7/0x330
    ? do_syscall_64+0x1c/0xa0
    __x64_sys_unshare+0x2d/0x40
    do_syscall_64+0x56/0xa0
    entry_SYSCALL_64_after_hwframe+0x44/0xa9

    ip6gre_tunnel_uninit() has set 'ign->fb_tunnel_dev' to NULL, later
    access to ign->fb_tunnel_dev cause null-ptr-deref. Fix it by saving
    'ign->fb_tunnel_dev' to local variable ndev.

    Fixes: dafabb6590cb ("ip6_gre: fix use-after-free in ip6gre_tunnel_lookup()")
    Reported-by: Hulk Robot
    Signed-off-by: Wei Yongjun
    Reviewed-by: Eric Dumazet
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Wei Yongjun
     
  • [ Upstream commit 7df5cb75cfb8acf96c7f2342530eb41e0c11f4c3 ]

    IRQs are disabled when freeing skbs in input queue.
    Use the IRQ safe variant to free skbs here.

    Fixes: 145dd5f9c88f ("net: flush the softnet backlog in process context")
    Signed-off-by: Subash Abhinov Kasiviswanathan
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Subash Abhinov Kasiviswanathan
     
  • [ Upstream commit 8885bb0621f01a6c82be60a91e5fc0f6e2f71186 ]

    Checks on `addr_len` and `usax->sax25_ndigis` are insufficient.
    ax25_sendmsg() can go out of bounds when `usax->sax25_ndigis` equals to 7
    or 8. Fix it.

    It is safe to remove `usax->sax25_ndigis > AX25_MAX_DIGIS`, since
    `addr_len` is guaranteed to be less than or equal to
    `sizeof(struct full_sockaddr_ax25)`

    Signed-off-by: Peilin Ye
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Peilin Ye