Skip to content
  1. Apr 27, 2024
    • Florian Westphal's avatar
      netfilter: nft_set_pipapo: do not free live element · 7a1679e2
      Florian Westphal authored
      [ Upstream commit 3cfc9ec0 ]
      
      Pablo reports a crash with large batches of elements with a
      back-to-back add/remove pattern.  Quoting Pablo:
      
        add_elem("00000000") timeout 100 ms
        ...
        add_elem("0000000X") timeout 100 ms
        del_elem("0000000X") <---------------- delete one that was just added
        ...
        add_elem("00005000") timeout 100 ms
      
        1) nft_pipapo_remove() removes element 0000000X
        Then, KASAN shows a splat.
      
      Looking at the remove function there is a chance that we will drop a
      rule that maps to a non-deactivated element.
      
      Removal happens in two steps, first we do a lookup for key k and return the
      to-be-removed element and mark it as inactive in the next generation.
      Then, in a second step, the element gets removed from the set/map.
      
      The _remove function does not work correctly if we have more than one
      element that share the same key.
      
      This can happen if we insert an element into a set when the set already
      holds an element with same key, but the element mapping to the existing
      key has timed out or is not active in the next generation.
      
      In such case its possible that removal will unmap the wrong element.
      If this happens, we will leak the non-deactivated element, it becomes
      unreachable.
      
      The element that got deactivated (and will be freed later) will
      remain reachable in the set data structure, this can result in
      a crash when such an element is retrieved during lookup (stale
      pointer).
      
      Add a check that the fully matching key does in fact map to the element
      that we have marked as inactive in the deactivation step.
      If not, we need to continue searching.
      
      Add a bug/warn trap at the end of the function as well, the remove
      function must not ever be called with an invisible/unreachable/non-existent
      element.
      
      v2: avoid uneeded temporary variable (Stefano)
      
      Fixes: 3c4287f6
      
       ("nf_tables: Add set type for arbitrary concatenation of ranges")
      Reported-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Reviewed-by: default avatarStefano Brivio <sbrivio@redhat.com>
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      7a1679e2
    • Pablo Neira Ayuso's avatar
      netfilter: br_netfilter: skip conntrack input hook for promisc packets · dceb683a
      Pablo Neira Ayuso authored
      [ Upstream commit 751de201 ]
      
      For historical reasons, when bridge device is in promisc mode, packets
      that are directed to the taps follow bridge input hook path. This patch
      adds a workaround to reset conntrack for these packets.
      
      Jianbo Liu reports warning splats in their test infrastructure where
      cloned packets reach the br_netfilter input hook to confirm the
      conntrack object.
      
      Scratch one bit from BR_INPUT_SKB_CB to annotate that this packet has
      reached the input hook because it is passed up to the bridge device to
      reach the taps.
      
      [   57.571874] WARNING: CPU: 1 PID: 0 at net/bridge/br_netfilter_hooks.c:616 br_nf_local_in+0x157/0x180 [br_netfilter]
      [   57.572749] Modules linked in: xt_MASQUERADE nf_conntrack_netlink nfnetlink iptable_nat xt_addrtype xt_conntrack nf_nat br_netfilter rpcsec_gss_krb5 auth_rpcgss oid_registry overlay rpcrdma rdma_ucm ib_iser libiscsi scsi_transport_isc si ib_umad rdma_cm ib_ipoib iw_cm ib_cm mlx5_ib ib_uverbs ib_core mlx5ctl mlx5_core
      [   57.575158] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 6.8.0+ #19
      [   57.575700] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
      [   57.576662] RIP: 0010:br_nf_local_in+0x157/0x180 [br_netfilter]
      [   57.577195] Code: fe ff ff 41 bd 04 00 00 00 be 04 00 00 00 e9 4a ff ff ff be 04 00 00 00 48 89 ef e8 f3 a9 3c e1 66 83 ad b4 00 00 00 04 eb 91 <0f> 0b e9 f1 fe ff ff 0f 0b e9 df fe ff ff 48 89 df e8 b3 53 47 e1
      [   57.578722] RSP: 0018:ffff88885f845a08 EFLAGS: 00010202
      [   57.579207] RAX: 0000000000000002 RBX: ffff88812dfe8000 RCX: 0000000000000000
      [   57.579830] RDX: ffff88885f845a60 RSI: ffff8881022dc300 RDI: 0000000000000000
      [   57.580454] RBP: ffff88885f845a60 R08: 0000000000000001 R09: 0000000000000003
      [   57.581076] R10: 00000000ffff1300 R11: 0000000000000002 R12: 0000000000000000
      [   57.581695] R13: ffff8881047ffe00 R14: ffff888108dbee00 R15: ffff88814519b800
      [   57.582313] FS:  0000000000000000(0000) GS:ffff88885f840000(0000) knlGS:0000000000000000
      [   57.583040] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [   57.583564] CR2: 000000c4206aa000 CR3: 0000000103847001 CR4: 0000000000370eb0
      [   57.584194] DR0: 0000000000000000 DR1: 0000000000000000 DR2:
      0000000000000000
      [   57.584820] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7:
      0000000000000400
      [   57.585440] Call Trace:
      [   57.585721]  <IRQ>
      [   57.585976]  ? __warn+0x7d/0x130
      [   57.586323]  ? br_nf_local_in+0x157/0x180 [br_netfilter]
      [   57.586811]  ? report_bug+0xf1/0x1c0
      [   57.587177]  ? handle_bug+0x3f/0x70
      [   57.587539]  ? exc_invalid_op+0x13/0x60
      [   57.587929]  ? asm_exc_invalid_op+0x16/0x20
      [   57.588336]  ? br_nf_local_in+0x157/0x180 [br_netfilter]
      [   57.588825]  nf_hook_slow+0x3d/0xd0
      [   57.589188]  ? br_handle_vlan+0x4b/0x110
      [   57.589579]  br_pass_frame_up+0xfc/0x150
      [   57.589970]  ? br_port_flags_change+0x40/0x40
      [   57.590396]  br_handle_frame_finish+0x346/0x5e0
      [   57.590837]  ? ipt_do_table+0x32e/0x430
      [   57.591221]  ? br_handle_local_finish+0x20/0x20
      [   57.591656]  br_nf_hook_thresh+0x4b/0xf0 [br_netfilter]
      [   57.592286]  ? br_handle_local_finish+0x20/0x20
      [   57.592802]  br_nf_pre_routing_finish+0x178/0x480 [br_netfilter]
      [   57.593348]  ? br_handle_local_finish+0x20/0x20
      [   57.593782]  ? nf_nat_ipv4_pre_routing+0x25/0x60 [nf_nat]
      [   57.594279]  br_nf_pre_routing+0x24c/0x550 [br_netfilter]
      [   57.594780]  ? br_nf_hook_thresh+0xf0/0xf0 [br_netfilter]
      [   57.595280]  br_handle_frame+0x1f3/0x3d0
      [   57.595676]  ? br_handle_local_finish+0x20/0x20
      [   57.596118]  ? br_handle_frame_finish+0x5e0/0x5e0
      [   57.596566]  __netif_receive_skb_core+0x25b/0xfc0
      [   57.597017]  ? __napi_build_skb+0x37/0x40
      [   57.597418]  __netif_receive_skb_list_core+0xfb/0x220
      
      Fixes: 62e7151a
      
       ("netfilter: bridge: confirm multicast packets before passing them up the stack")
      Reported-by: default avatarJianbo Liu <jianbol@nvidia.com>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      dceb683a
    • Ziyang Xuan's avatar
      netfilter: nf_tables: Fix potential data-race in __nft_obj_type_get() · 379bf725
      Ziyang Xuan authored
      [ Upstream commit d78d867d ]
      
      nft_unregister_obj() can concurrent with __nft_obj_type_get(),
      and there is not any protection when iterate over nf_tables_objects
      list in __nft_obj_type_get(). Therefore, there is potential data-race
      of nf_tables_objects list entry.
      
      Use list_for_each_entry_rcu() to iterate over nf_tables_objects
      list in __nft_obj_type_get(), and use rcu_read_lock() in the caller
      nft_obj_type_get() to protect the entire type query process.
      
      Fixes: e5009240
      
       ("netfilter: nf_tables: add stateful objects")
      Signed-off-by: default avatarZiyang Xuan <william.xuanziyang@huawei.com>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      379bf725
    • Ziyang Xuan's avatar
      netfilter: nf_tables: Fix potential data-race in __nft_expr_type_get() · 0b6de002
      Ziyang Xuan authored
      [ Upstream commit f969eb84 ]
      
      nft_unregister_expr() can concurrent with __nft_expr_type_get(),
      and there is not any protection when iterate over nf_tables_expressions
      list in __nft_expr_type_get(). Therefore, there is potential data-race
      of nf_tables_expressions list entry.
      
      Use list_for_each_entry_rcu() to iterate over nf_tables_expressions
      list in __nft_expr_type_get(), and use rcu_read_lock() in the caller
      nft_expr_type_get() to protect the entire type query process.
      
      Fixes: ef1f7df9
      
       ("netfilter: nf_tables: expression ops overloading")
      Signed-off-by: default avatarZiyang Xuan <william.xuanziyang@huawei.com>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0b6de002
    • Chuck Lever's avatar
      Revert "lockd: introduce safe async lock op" · fc102133
      Chuck Lever authored
      This reverts commit 2267b2e8.
      
      ltp test fcntl17 fails on v5.15.154. This was bisected to commit
      2267b2e8
      
       ("lockd: introduce safe async lock op").
      
      Reported-by: default avatarHarshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fc102133
    • Siddh Raman Pant's avatar
      Revert "tracing/trigger: Fix to return error if failed to alloc snapshot" · 2a3073d5
      Siddh Raman Pant authored
      This reverts commit b5085b5a which is
      commit 0958b33e upstream.
      
      The change has an incorrect assumption about the return value because
      in the current stable trees for versions 5.15 and before, the following
      commit responsible for making 0 a success value is not present:
      b8cc44a4
      
       ("tracing: Remove logic for registering multiple event triggers at a time")
      
      The return value should be 0 on failure in the current tree, because in
      the functions event_trigger_callback() and event_enable_trigger_func(),
      we have:
      
      	ret = cmd_ops->reg(glob, trigger_ops, trigger_data, file);
      	/*
      	 * The above returns on success the # of functions enabled,
      	 * but if it didn't find any functions it returns zero.
      	 * Consider no functions a failure too.
      	 */
      	if (!ret) {
      		ret = -ENOENT;
      
      Cc: stable@kernel.org # 5.15, 5.10, 5.4, 4.19
      Signed-off-by: default avatarSiddh Raman Pant <siddh.raman.pant@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2a3073d5
    • Zheng Yejian's avatar
      kprobes: Fix possible use-after-free issue on kprobe registration · 2df2dd27
      Zheng Yejian authored
      commit 325f3fb5 upstream.
      
      When unloading a module, its state is changing MODULE_STATE_LIVE ->
       MODULE_STATE_GOING -> MODULE_STATE_UNFORMED. Each change will take
      a time. `is_module_text_address()` and `__module_text_address()`
      works with MODULE_STATE_LIVE and MODULE_STATE_GOING.
      If we use `is_module_text_address()` and `__module_text_address()`
      separately, there is a chance that the first one is succeeded but the
      next one is failed because module->state becomes MODULE_STATE_UNFORMED
      between those operations.
      
      In `check_kprobe_address_safe()`, if the second `__module_text_address()`
      is failed, that is ignored because it expected a kernel_text address.
      But it may have failed simply because module->state has been changed
      to MODULE_STATE_UNFORMED. In this case, arm_kprobe() will try to modify
      non-exist module text address (use-after-free).
      
      To fix this problem, we should not use separated `is_module_text_address()`
      and `__module_text_address()`, but use only `__module_text_address()`
      once and do `try_module_get(module)` which is only available with
      MODULE_STATE_LIVE.
      
      Link: https://lore.kernel.org/all/20240410015802.265220-1-zhengyejian1@huawei.com/
      
      Fixes: 28f6c37a
      
       ("kprobes: Forbid probing on trampoline and BPF code areas")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarZheng Yejian <zhengyejian1@huawei.com>
      Signed-off-by: default avatarMasami Hiramatsu (Google) <mhiramat@kernel.org>
      [Fix conflict due to lack dependency
      commit 223a76b2
      
       ("kprobes: Fix coding style issues")]
      Signed-off-by: default avatarZheng Yejian <zhengyejian1@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2df2dd27
    • Daniel Borkmann's avatar
      bpf: Fix ringbuf memory type confusion when passing to helpers · 1253e34a
      Daniel Borkmann authored
      commit a672b2e3 upstream.
      
      The bpf_ringbuf_submit() and bpf_ringbuf_discard() have ARG_PTR_TO_ALLOC_MEM
      in their bpf_func_proto definition as their first argument, and thus both expect
      the result from a prior bpf_ringbuf_reserve() call which has a return type of
      RET_PTR_TO_ALLOC_MEM_OR_NULL.
      
      While the non-NULL memory from bpf_ringbuf_reserve() can be passed to other
      helpers, the two sinks (bpf_ringbuf_submit(), bpf_ringbuf_discard()) right now
      only enforce a register type of PTR_TO_MEM.
      
      This can lead to potential type confusion since it would allow other PTR_TO_MEM
      memory to be passed into the two sinks which did not come from bpf_ringbuf_reserve().
      
      Add a new MEM_ALLOC composable type attribute for PTR_TO_MEM, and enforce that:
      
       - bpf_ringbuf_reserve() returns NULL or PTR_TO_MEM | MEM_ALLOC
       - bpf_ringbuf_submit() and bpf_ringbuf_discard() only take PTR_TO_MEM | MEM_ALLOC
         but not plain PTR_TO_MEM arguments via ARG_PTR_TO_ALLOC_MEM
       - however, other helpers might treat PTR_TO_MEM | MEM_ALLOC as plain PTR_TO_MEM
         to populate the memory area when they use ARG_PTR_TO_{UNINIT_,}MEM in their
         func proto description
      
      Fixes: 457f4436
      
       ("bpf: Implement BPF ring buffer and verifier support for it")
      Reported-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarEdward Liaw <edliaw@google.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1253e34a
    • Daniel Borkmann's avatar
      bpf: Fix out of bounds access for ringbuf helpers · cc9ac419
      Daniel Borkmann authored
      commit 64620e0a upstream.
      
      Both bpf_ringbuf_submit() and bpf_ringbuf_discard() have ARG_PTR_TO_ALLOC_MEM
      in their bpf_func_proto definition as their first argument. They both expect
      the result from a prior bpf_ringbuf_reserve() call which has a return type of
      RET_PTR_TO_ALLOC_MEM_OR_NULL.
      
      Meaning, after a NULL check in the code, the verifier will promote the register
      type in the non-NULL branch to a PTR_TO_MEM and in the NULL branch to a known
      zero scalar. Generally, pointer arithmetic on PTR_TO_MEM is allowed, so the
      latter could have an offset.
      
      The ARG_PTR_TO_ALLOC_MEM expects a PTR_TO_MEM register type. However, the non-
      zero result from bpf_ringbuf_reserve() must be fed into either bpf_ringbuf_submit()
      or bpf_ringbuf_discard() but with the original offset given it will then read
      out the struct bpf_ringbuf_hdr mapping.
      
      The verifier missed to enforce a zero offset, so that out of bounds access
      can be triggered which could be used to escalate privileges if unprivileged
      BPF was enabled (disabled by default in kernel).
      
      Fixes: 457f4436
      
       ("bpf: Implement BPF ring buffer and verifier support for it")
      Reported-by: <tr3e.wang@gmail.com> (SecCoder Security Lab)
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarEdward Liaw <edliaw@google.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cc9ac419
    • Daniel Borkmann's avatar
      bpf: Generally fix helper register offset check · adc2d11b
      Daniel Borkmann authored
      commit 6788ab23 upstream.
      
      Right now the assertion on check_ptr_off_reg() is only enforced for register
      types PTR_TO_CTX (and open coded also for PTR_TO_BTF_ID), however, this is
      insufficient since many other PTR_TO_* register types such as PTR_TO_FUNC do
      not handle/expect register offsets when passed to helper functions.
      
      Given this can slip-through easily when adding new types, make this an explicit
      allow-list and reject all other current and future types by default if this is
      encountered.
      
      Also, extend check_ptr_off_reg() to handle PTR_TO_BTF_ID as well instead of
      duplicating it. For PTR_TO_BTF_ID, reg->off is used for BTF to match expected
      BTF ids if struct offset is used. This part still needs to be allowed, but the
      dynamic off from the tnum must be rejected.
      
      Fixes: 69c087ba ("bpf: Add bpf_for_each_map_elem() helper")
      Fixes: eaa6bcb7
      
       ("bpf: Introduce bpf_per_cpu_ptr()")
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarEdward Liaw <edliaw@google.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      adc2d11b
    • Daniel Borkmann's avatar
      bpf: Generalize check_ctx_reg for reuse with other types · 0c261cbc
      Daniel Borkmann authored
      commit be80a1d3
      
       upstream.
      
      Generalize the check_ctx_reg() helper function into a more generic named one
      so that it can be reused for other register types as well to check whether
      their offset is non-zero. No functional change.
      
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarEdward Liaw <edliaw@google.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0c261cbc
    • Kumar Kartikeya Dwivedi's avatar
      bpf: Extend kfunc with PTR_TO_CTX, PTR_TO_MEM argument support · 1b661661
      Kumar Kartikeya Dwivedi authored
      commit 3363bd0c
      
       upstream.
      
      Allow passing PTR_TO_CTX, if the kfunc expects a matching struct type,
      and punt to PTR_TO_MEM block if reg->type does not fall in one of
      PTR_TO_BTF_ID or PTR_TO_SOCK* types. This will be used by future commits
      to get access to XDP and TC PTR_TO_CTX, and pass various data (flags,
      l4proto, netns_id, etc.) encoded in opts struct passed as pointer to
      kfunc.
      
      For PTR_TO_MEM support, arguments are currently limited to pointer to
      scalar, or pointer to struct composed of scalars. This is done so that
      unsafe scenarios (like passing PTR_TO_MEM where PTR_TO_BTF_ID of
      in-kernel valid structure is expected, which may have pointers) are
      avoided. Since the argument checking happens basd on argument register
      type, it is not easy to ascertain what the expected type is. In the
      future, support for PTR_TO_MEM for kfunc can be extended to serve other
      usecases. The struct type whose pointer is passed in may have maximum
      nesting depth of 4, all recursively composed of scalars or struct with
      scalars.
      
      Future commits will add negative tests that check whether these
      restrictions imposed for kfunc arguments are duly rejected by BPF
      verifier or not.
      
      Signed-off-by: default avatarKumar Kartikeya Dwivedi <memxor@gmail.com>
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Link: https://lore.kernel.org/bpf/20211217015031.1278167-4-memxor@gmail.com
      
      
      Signed-off-by: default avatarEdward Liaw <edliaw@google.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1b661661
    • Yuanhe Shu's avatar
      selftests/ftrace: Limit length in subsystem-enable tests · 621bbe92
      Yuanhe Shu authored
      commit 1a4ea83a upstream.
      
      While sched* events being traced and sched* events continuously happen,
      "[xx] event tracing - enable/disable with subsystem level files" would
      not stop as on some slower systems it seems to take forever.
      Select the first 100 lines of output would be enough to judge whether
      there are more than 3 types of sched events.
      
      Fixes: 815b18ea
      
       ("ftracetest: Add basic event tracing test cases")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarYuanhe Shu <xiangzao@linux.alibaba.com>
      Acked-by: default avatarMasami Hiramatsu (Google) <mhiramat@kernel.org>
      Acked-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      621bbe92
    • Steven Rostedt (Google)'s avatar
      SUNRPC: Fix rpcgss_context trace event acceptor field · edfaf679
      Steven Rostedt (Google) authored
      commit a4833e3a upstream.
      
      The rpcgss_context trace event acceptor field is a dynamically sized
      string that records the "data" parameter. But this parameter is also
      dependent on the "len" field to determine the size of the data.
      
      It needs to use __string_len() helper macro where the length can be passed
      in. It also incorrectly uses strncpy() to save it instead of
      __assign_str(). As these macros can change, it is not wise to open code
      them in trace events.
      
      As of commit c759e609 ("tracing: Remove __assign_str_len()"),
      __assign_str() can be used for both __string() and __string_len() fields.
      Before that commit, __assign_str_len() is required to be used. This needs
      to be noted for backporting. (In actuality, commit c1fa617c ("tracing:
      Rework __assign_str() and __string() to not duplicate getting the string")
      is the commit that makes __string_str_len() obsolete).
      
      Cc: stable@vger.kernel.org
      Fixes: 0c77668d
      
       ("SUNRPC: Introduce trace points in rpc_auth_gss.ko")
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      edfaf679
    • Boris Burkov's avatar
      btrfs: record delayed inode root in transaction · 2364d027
      Boris Burkov authored
      [ Upstream commit 71537e35 ]
      
      When running delayed inode updates, we do not record the inode's root in
      the transaction, but we do allocate PREALLOC and thus converted PERTRANS
      space for it. To be sure we free that PERTRANS meta rsv, we must ensure
      that we record the root in the transaction.
      
      Fixes: 4f5427cc
      
       ("btrfs: delayed-inode: Use new qgroup meta rsv for delayed inode and item")
      CC: stable@vger.kernel.org # 6.1+
      Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
      Signed-off-by: default avatarBoris Burkov <boris@bur.io>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2364d027
    • Namjae Jeon's avatar
      ksmbd: do not set SMB2_GLOBAL_CAP_ENCRYPTION for SMB 3.1.1 · 74722892
      Namjae Jeon authored
      [ Upstream commit 5ed11af1
      
       ]
      
      SMB2_GLOBAL_CAP_ENCRYPTION flag should be used only for 3.0 and
      3.0.2 dialects. This flags set cause compatibility problems with
      other SMB clients.
      
      Reported-by: default avatarJames Christopher Adduono <jc@adduono.com>
      Tested-by: default avatarJames Christopher Adduono <jc@adduono.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      74722892
    • Namjae Jeon's avatar
      ksmbd: validate payload size in ipc response · 88b7f114
      Namjae Jeon authored
      [ Upstream commit a677ebd8
      
       ]
      
      If installing malicious ksmbd-tools, ksmbd.mountd can return invalid ipc
      response to ksmbd kernel server. ksmbd should validate payload size of
      ipc response from ksmbd.mountd to avoid memory overrun or
      slab-out-of-bounds. This patch validate 3 ipc response that has payload.
      
      Cc: stable@vger.kernel.org
      Reported-by: default avatarChao Ma <machao2019@gmail.com>
      Signed-off-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      88b7f114
    • Namjae Jeon's avatar
      ksmbd: don't send oplock break if rename fails · 044b3d6c
      Namjae Jeon authored
      [ Upstream commit c1832f67
      
       ]
      
      Don't send oplock break if rename fails. This patch fix
      smb2.oplock.batch20 test.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      044b3d6c
  2. Apr 17, 2024