Skip to content
  1. Jul 18, 2024
    • Wolfram Sang's avatar
      i2c: rcar: reset controller is mandatory for Gen3+ · ff7879da
      Wolfram Sang authored
      
      
      [ Upstream commit 0e864b55 ]
      
      Initially, we only needed a reset controller to make sure RXDMA works at
      least once per transfer. Meanwhile, documentation has been updated. It
      now says that a reset has to be performed prior every transaction, even
      if it is non-DMA. So, make the reset controller a requirement instead of
      being optional. And bail out if resetting fails.
      
      Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
      Reviewed-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
      Stable-dep-of: ea5ea84c ("i2c: rcar: ensure Gen3+ reset does not disturb local targets")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ff7879da
    • Geert Uytterhoeven's avatar
      i2c: rcar: Add R-Car Gen4 support · 504cc003
      Geert Uytterhoeven authored
      
      
      [ Upstream commit ea01b71b ]
      
      Add support for the I2C Bus Interface on R-Car Gen4 SoCs (e.g. R-Car
      S4-8) by matching on a family-specific compatible value.
      
      While I2C on R-Car Gen4 does support some extra features (Slave Clock
      Stretch Select), for now it is treated the same as I2C on R-Car Gen3.
      
      Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Reviewed-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
      [wsa: removed incorrect "FM+" from commit message]
      Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
      Stable-dep-of: ea5ea84c ("i2c: rcar: ensure Gen3+ reset does not disturb local targets")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      504cc003
    • Wolfram Sang's avatar
      i2c: mark HostNotify target address as used · f42afb06
      Wolfram Sang authored
      
      
      [ Upstream commit bd9f5348 ]
      
      I2C core handles the local target for receiving HostNotify alerts. There
      is no separate driver bound to that address. That means userspace can
      access it if desired, leading to further complications if controllers
      are not capable of reading their own local target. Bind the local target
      to the dummy driver so it will be marked as "handled by the kernel" if
      the HostNotify feature is used. That protects aginst userspace access
      and prevents other drivers binding to it.
      
      Fixes: 2a71593d ("i2c: smbus: add core function handling SMBus host-notify")
      Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f42afb06
    • Wolfram Sang's avatar
      i2c: rcar: bring hardware to known state when probing · 72dd9b81
      Wolfram Sang authored
      
      
      [ Upstream commit 4e36c0f2 ]
      
      When probing, the hardware is not brought into a known state. This may
      be a problem when a hypervisor restarts Linux without resetting the
      hardware, leaving an old state running. Make sure the hardware gets
      initialized, especially interrupts should be cleared and disabled.
      
      Reported-by: default avatarDirk Behme <dirk.behme@de.bosch.com>
      Reported-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Closes: https://lore.kernel.org/r/20240702045535.2000393-1-dirk.behme@de.bosch.com
      
      
      Fixes: 6ccbe607 ("i2c: add Renesas R-Car I2C driver")
      Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
      Signed-off-by: default avatarAndi Shyti <andi.shyti@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      72dd9b81
    • Ryusuke Konishi's avatar
      nilfs2: fix kernel bug on rename operation of broken directory · 7000b438
      Ryusuke Konishi authored
      commit a9e1ddc0 upstream.
      
      Syzbot reported that in rename directory operation on broken directory on
      nilfs2, __block_write_begin_int() called to prepare block write may fail
      BUG_ON check for access exceeding the folio/page size.
      
      This is because nilfs_dotdot(), which gets parent directory reference
      entry ("..") of the directory to be moved or renamed, does not check
      consistency enough, and may return location exceeding folio/page size for
      broken directories.
      
      Fix this issue by checking required directory entries ("." and "..") in
      the first chunk of the directory in nilfs_dotdot().
      
      Link: https://lkml.kernel.org/r/20240628165107.9006-1-konishi.ryusuke@gmail.com
      
      
      Signed-off-by: default avatarRyusuke Konishi <konishi.ryusuke@gmail.com>
      Reported-by: default avatar <syzbot+d3abed1ad3d367fa2627@syzkaller.appspotmail.com>
      Closes: https://syzkaller.appspot.com/bug?extid=d3abed1ad3d367fa2627
      
      
      Fixes: 2ba466d7 ("nilfs2: directory entry operations")
      Tested-by: default avatarRyusuke Konishi <konishi.ryusuke@gmail.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7000b438
    • Eduard Zingerman's avatar
      bpf: Allow reads from uninit stack · e30bc19a
      Eduard Zingerman authored
      commit 6715df8d upstream.
      
      This commits updates the following functions to allow reads from
      uninitialized stack locations when env->allow_uninit_stack option is
      enabled:
      - check_stack_read_fixed_off()
      - check_stack_range_initialized(), called from:
        - check_stack_read_var_off()
        - check_helper_mem_access()
      
      Such change allows to relax logic in stacksafe() to treat STACK_MISC
      and STACK_INVALID in a same way and make the following stack slot
      configurations equivalent:
      
        |  Cached state    |  Current state   |
        |   stack slot     |   stack slot     |
        |------------------+------------------|
        | STACK_INVALID or | STACK_INVALID or |
        | STACK_MISC       | STACK_SPILL   or |
        |                  | STACK_MISC    or |
        |                  | STACK_ZERO    or |
        |                  | STACK_DYNPTR     |
      
      This leads to significant verification speed gains (see below).
      
      The idea was suggested by Andrii Nakryiko [1] and initial patch was
      created by Alexei Starovoitov [2].
      
      Currently the env->allow_uninit_stack is allowed for programs loaded
      by users with CAP_PERFMON or CAP_SYS_ADMIN capabilities.
      
      A number of test cases from verifier/*.c were expecting uninitialized
      stack access to be an error. These test cases were updated to execute
      in unprivileged mode (thus preserving the tests).
      
      The test progs/test_global_func10.c expected "invalid indirect read
      from stack" error message because of the access to uninitialized
      memory region. This error is no longer possible in privileged mode.
      The test is updated to provoke an error "invalid indirect access to
      stack" because of access to invalid stack address (such error is not
      verified by progs/test_global_func*.c series of tests).
      
      The following tests had to be removed because these can't be made
      unprivileged:
      - verifier/sock.c:
        - "sk_storage_get(map, skb->sk, &stack_value, 1): partially init
        stack_value"
        BPF_PROG_TYPE_SCHED_CLS programs are not executed in unprivileged mode.
      - verifier/var_off.c:
        - "indirect variable-offset stack access, max_off+size > max_initialized"
        - "indirect variable-offset stack access, uninitialized"
        These tests verify that access to uninitialized stack values is
        detected when stack offset is not a constant. However, variable
        stack access is prohibited in unprivileged mode, thus these tests
        are no longer valid.
      
       * * *
      
      Here is veristat log comparing this patch with current master on a
      set of selftest binaries listed in tools/testing/selftests/bpf/veristat.cfg
      and cilium BPF binaries (see [3]):
      
      $ ./veristat -e file,prog,states -C -f 'states_pct<-30' master.log current.log
      File                        Program                     States (A)  States (B)  States    (DIFF)
      --------------------------  --------------------------  ----------  ----------  ----------------
      bpf_host.o                  tail_handle_ipv6_from_host         349         244    -105 (-30.09%)
      bpf_host.o                  tail_handle_nat_fwd_ipv4          1320         895    -425 (-32.20%)
      bpf_lxc.o                   tail_handle_nat_fwd_ipv4          1320         895    -425 (-32.20%)
      bpf_sock.o                  cil_sock4_connect                   70          48     -22 (-31.43%)
      bpf_sock.o                  cil_sock4_sendmsg                   68          46     -22 (-32.35%)
      bpf_xdp.o                   tail_handle_nat_fwd_ipv4          1554         803    -751 (-48.33%)
      bpf_xdp.o                   tail_lb_ipv4                      6457        2473   -3984 (-61.70%)
      bpf_xdp.o                   tail_lb_ipv6                      7249        3908   -3341 (-46.09%)
      pyperf600_bpf_loop.bpf.o    on_event                           287         145    -142 (-49.48%)
      strobemeta.bpf.o            on_event                         15915        4772  -11143 (-70.02%)
      strobemeta_nounroll2.bpf.o  on_event                         17087        3820  -13267 (-77.64%)
      xdp_synproxy_kern.bpf.o     syncookie_tc                     21271        6635  -14636 (-68.81%)
      xdp_synproxy_kern.bpf.o     syncookie_xdp                    23122        6024  -17098 (-73.95%)
      --------------------------  --------------------------  ----------  ----------  ----------------
      
      Note: I limited selection by states_pct<-30%.
      
      Inspection of differences in pyperf600_bpf_loop behavior shows that
      the following patch for the test removes almost all differences:
      
          - a/tools/testing/selftests/bpf/progs/pyperf.h
          + b/tools/testing/selftests/bpf/progs/pyperf.h
          @ -266,8 +266,8 @ int __on_event(struct bpf_raw_tracepoint_args *ctx)
                  }
      
                  if (event->pthread_match || !pidData->use_tls) {
          -               void* frame_ptr;
          -               FrameData frame;
          +               void* frame_ptr = 0;
          +               FrameData frame = {};
                          Symbol sym = {};
                          int cur_cpu = bpf_get_smp_processor_id();
      
      W/o this patch the difference comes from the following pattern
      (for different variables):
      
          static bool get_frame_data(... FrameData *frame ...)
          {
              ...
              bpf_probe_read_user(&frame->f_code, ...);
              if (!frame->f_code)
                  return false;
              ...
              bpf_probe_read_user(&frame->co_name, ...);
              if (frame->co_name)
                  ...;
          }
      
          int __on_event(struct bpf_raw_tracepoint_args *ctx)
          {
              FrameData frame;
              ...
              get_frame_data(... &frame ...) // indirectly via a bpf_loop & callback
              ...
          }
      
          SEC("raw_tracepoint/kfree_skb")
          int on_event(struct bpf_raw_tracepoint_args* ctx)
          {
              ...
              ret |= __on_event(ctx);
              ret |= __on_event(ctx);
              ...
          }
      
      With regards to value `frame->co_name` the following is important:
      - Because of the conditional `if (!frame->f_code)` each call to
        __on_event() produces two states, one with `frame->co_name` marked
        as STACK_MISC, another with it as is (and marked STACK_INVALID on a
        first call).
      - The call to bpf_probe_read_user() does not mark stack slots
        corresponding to `&frame->co_name` as REG_LIVE_WRITTEN but it marks
        these slots as BPF_MISC, this happens because of the following loop
        in the check_helper_call():
      
      	for (i = 0; i < meta.access_size; i++) {
      		err = check_mem_access(env, insn_idx, meta.regno, i, BPF_B,
      				       BPF_WRITE, -1, false);
      		if (err)
      			return err;
      	}
      
        Note the size of the write, it is a one byte write for each byte
        touched by a helper. The BPF_B write does not lead to write marks
        for the target stack slot.
      - Which means that w/o this patch when second __on_event() call is
        verified `if (frame->co_name)` will propagate read marks first to a
        stack slot with STACK_MISC marks and second to a stack slot with
        STACK_INVALID marks and these states would be considered different.
      
      [1] https://lore.kernel.org/bpf/CAEf4BzY3e+ZuC6HUa8dCiUovQRg2SzEk7M-dSkqNZyn=xEmnPA@mail.gmail.com/
      [2] https://lore.kernel.org/bpf/CAADnVQKs2i1iuZ5SUGuJtxWVfGYR9kDgYKhq3rNV+kBLQCu7rA@mail.gmail.com/
      
      
      [3] git@github.com:anakryiko/cilium.git
      
      Suggested-by: default avatarAndrii Nakryiko <andrii@kernel.org>
      Co-developed-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarEduard Zingerman <eddyz87@gmail.com>
      Acked-by: default avatarAndrii Nakryiko <andrii@kernel.org>
      Link: https://lore.kernel.org/r/20230219200427.606541-2-eddyz87@gmail.com
      
      
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarMaxim Mikityanskiy <maxim@isovalent.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e30bc19a
    • Eric Dumazet's avatar
      ipv6: prevent NULL dereference in ip6_output() · 2272e2db
      Eric Dumazet authored
      
      
      commit 4db783d6 upstream.
      
      According to syzbot, there is a chance that ip6_dst_idev()
      returns NULL in ip6_output(). Most places in IPv6 stack
      deal with a NULL idev just fine, but not here.
      
      syzbot reported:
      
      general protection fault, probably for non-canonical address 0xdffffc00000000bc: 0000 [#1] PREEMPT SMP KASAN PTI
      KASAN: null-ptr-deref in range [0x00000000000005e0-0x00000000000005e7]
      CPU: 0 PID: 9775 Comm: syz-executor.4 Not tainted 6.9.0-rc5-syzkaller-00157-g6a30653b604a #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
       RIP: 0010:ip6_output+0x231/0x3f0 net/ipv6/ip6_output.c:237
      Code: 3c 1e 00 49 89 df 74 08 4c 89 ef e8 19 58 db f7 48 8b 44 24 20 49 89 45 00 49 89 c5 48 8d 9d e0 05 00 00 48 89 d8 48 c1 e8 03 <42> 0f b6 04 38 84 c0 4c 8b 74 24 28 0f 85 61 01 00 00 8b 1b 31 ff
      RSP: 0018:ffffc9000927f0d8 EFLAGS: 00010202
      RAX: 00000000000000bc RBX: 00000000000005e0 RCX: 0000000000040000
      RDX: ffffc900131f9000 RSI: 0000000000004f47 RDI: 0000000000004f48
      RBP: 0000000000000000 R08: ffffffff8a1f0b9a R09: 1ffffffff1f51fad
      R10: dffffc0000000000 R11: fffffbfff1f51fae R12: ffff8880293ec8c0
      R13: ffff88805d7fc000 R14: 1ffff1100527d91a R15: dffffc0000000000
      FS:  00007f135c6856c0(0000) GS:ffff8880b9400000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000000020000080 CR3: 0000000064096000 CR4: 00000000003506f0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       <TASK>
        NF_HOOK include/linux/netfilter.h:314 [inline]
        ip6_xmit+0xefe/0x17f0 net/ipv6/ip6_output.c:358
        sctp_v6_xmit+0x9f2/0x13f0 net/sctp/ipv6.c:248
        sctp_packet_transmit+0x26ad/0x2ca0 net/sctp/output.c:653
        sctp_packet_singleton+0x22c/0x320 net/sctp/outqueue.c:783
        sctp_outq_flush_ctrl net/sctp/outqueue.c:914 [inline]
        sctp_outq_flush+0x6d5/0x3e20 net/sctp/outqueue.c:1212
        sctp_side_effects net/sctp/sm_sideeffect.c:1198 [inline]
        sctp_do_sm+0x59cc/0x60c0 net/sctp/sm_sideeffect.c:1169
        sctp_primitive_ASSOCIATE+0x95/0xc0 net/sctp/primitive.c:73
        __sctp_connect+0x9cd/0xe30 net/sctp/socket.c:1234
        sctp_connect net/sctp/socket.c:4819 [inline]
        sctp_inet_connect+0x149/0x1f0 net/sctp/socket.c:4834
        __sys_connect_file net/socket.c:2048 [inline]
        __sys_connect+0x2df/0x310 net/socket.c:2065
        __do_sys_connect net/socket.c:2075 [inline]
        __se_sys_connect net/socket.c:2072 [inline]
        __x64_sys_connect+0x7a/0x90 net/socket.c:2072
        do_syscall_x64 arch/x86/entry/common.c:52 [inline]
        do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f
      
      Fixes: 778d80be ("ipv6: Add disable_ipv6 sysctl to disable IPv6 operaion on specific interface.")
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reviewed-by: default avatarLarysa Zaremba <larysa.zaremba@intel.com>
      Link: https://lore.kernel.org/r/20240507161842.773961-1-edumazet@google.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      [Ashwin: Regenerated the Patch for v5.15]
      Signed-off-by: default avatarAshwin Dayanand Kamat <ashwin.kamat@broadcom.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2272e2db
    • Eric Dumazet's avatar
      ipv6: annotate data-races around cnf.disable_ipv6 · e79f46ba
      Eric Dumazet authored
      
      
      commit d289ab65 upstream.
      
      disable_ipv6 is read locklessly, add appropriate READ_ONCE()
      and WRITE_ONCE() annotations.
      
      v2: do not preload net before rtnl_trylock() in
          addrconf_disable_ipv6() (Jiri)
      
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Stable-dep-of: 4db783d6 ("ipv6: prevent NULL dereference in ip6_output()")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      [Ashwin: Regenerated the Patch for v5.15]
      Signed-off-by: default avatarAshwin Dayanand Kamat <ashwin.kamat@broadcom.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e79f46ba
    • Jason A. Donenfeld's avatar
      wireguard: send: annotate intentional data race in checking empty queue · 6f98a223
      Jason A. Donenfeld authored
      
      
      commit 381a7d45 upstream.
      
      KCSAN reports a race in wg_packet_send_keepalive, which is intentional:
      
          BUG: KCSAN: data-race in wg_packet_send_keepalive / wg_packet_send_staged_packets
      
          write to 0xffff88814cd91280 of 8 bytes by task 3194 on cpu 0:
           __skb_queue_head_init include/linux/skbuff.h:2162 [inline]
           skb_queue_splice_init include/linux/skbuff.h:2248 [inline]
           wg_packet_send_staged_packets+0xe5/0xad0 drivers/net/wireguard/send.c:351
           wg_xmit+0x5b8/0x660 drivers/net/wireguard/device.c:218
           __netdev_start_xmit include/linux/netdevice.h:4940 [inline]
           netdev_start_xmit include/linux/netdevice.h:4954 [inline]
           xmit_one net/core/dev.c:3548 [inline]
           dev_hard_start_xmit+0x11b/0x3f0 net/core/dev.c:3564
           __dev_queue_xmit+0xeff/0x1d80 net/core/dev.c:4349
           dev_queue_xmit include/linux/netdevice.h:3134 [inline]
           neigh_connected_output+0x231/0x2a0 net/core/neighbour.c:1592
           neigh_output include/net/neighbour.h:542 [inline]
           ip6_finish_output2+0xa66/0xce0 net/ipv6/ip6_output.c:137
           ip6_finish_output+0x1a5/0x490 net/ipv6/ip6_output.c:222
           NF_HOOK_COND include/linux/netfilter.h:303 [inline]
           ip6_output+0xeb/0x220 net/ipv6/ip6_output.c:243
           dst_output include/net/dst.h:451 [inline]
           NF_HOOK include/linux/netfilter.h:314 [inline]
           ndisc_send_skb+0x4a2/0x670 net/ipv6/ndisc.c:509
           ndisc_send_rs+0x3ab/0x3e0 net/ipv6/ndisc.c:719
           addrconf_dad_completed+0x640/0x8e0 net/ipv6/addrconf.c:4295
           addrconf_dad_work+0x891/0xbc0
           process_one_work kernel/workqueue.c:2633 [inline]
           process_scheduled_works+0x5b8/0xa30 kernel/workqueue.c:2706
           worker_thread+0x525/0x730 kernel/workqueue.c:2787
           kthread+0x1d7/0x210 kernel/kthread.c:388
           ret_from_fork+0x48/0x60 arch/x86/kernel/process.c:147
           ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:242
      
          read to 0xffff88814cd91280 of 8 bytes by task 3202 on cpu 1:
           skb_queue_empty include/linux/skbuff.h:1798 [inline]
           wg_packet_send_keepalive+0x20/0x100 drivers/net/wireguard/send.c:225
           wg_receive_handshake_packet drivers/net/wireguard/receive.c:186 [inline]
           wg_packet_handshake_receive_worker+0x445/0x5e0 drivers/net/wireguard/receive.c:213
           process_one_work kernel/workqueue.c:2633 [inline]
           process_scheduled_works+0x5b8/0xa30 kernel/workqueue.c:2706
           worker_thread+0x525/0x730 kernel/workqueue.c:2787
           kthread+0x1d7/0x210 kernel/kthread.c:388
           ret_from_fork+0x48/0x60 arch/x86/kernel/process.c:147
           ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:242
      
          value changed: 0xffff888148fef200 -> 0xffff88814cd91280
      
      Mark this race as intentional by using the skb_queue_empty_lockless()
      function rather than skb_queue_empty(), which uses READ_ONCE()
      internally to annotate the race.
      
      Cc: stable@vger.kernel.org
      Fixes: e7096c13 ("net: WireGuard secure network tunnel")
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Link: https://patch.msgid.link/20240704154517.1572127-5-Jason@zx2c4.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6f98a223
    • Jason A. Donenfeld's avatar
      wireguard: queueing: annotate intentional data race in cpu round robin · 21a0f856
      Jason A. Donenfeld authored
      
      
      commit 2fe3d6d2 upstream.
      
      KCSAN reports a race in the CPU round robin function, which, as the
      comment points out, is intentional:
      
          BUG: KCSAN: data-race in wg_packet_send_staged_packets / wg_packet_send_staged_packets
      
          read to 0xffff88811254eb28 of 4 bytes by task 3160 on cpu 1:
           wg_cpumask_next_online drivers/net/wireguard/queueing.h:127 [inline]
           wg_queue_enqueue_per_device_and_peer drivers/net/wireguard/queueing.h:173 [inline]
           wg_packet_create_data drivers/net/wireguard/send.c:320 [inline]
           wg_packet_send_staged_packets+0x60e/0xac0 drivers/net/wireguard/send.c:388
           wg_packet_send_keepalive+0xe2/0x100 drivers/net/wireguard/send.c:239
           wg_receive_handshake_packet drivers/net/wireguard/receive.c:186 [inline]
           wg_packet_handshake_receive_worker+0x449/0x5f0 drivers/net/wireguard/receive.c:213
           process_one_work kernel/workqueue.c:3248 [inline]
           process_scheduled_works+0x483/0x9a0 kernel/workqueue.c:3329
           worker_thread+0x526/0x720 kernel/workqueue.c:3409
           kthread+0x1d1/0x210 kernel/kthread.c:389
           ret_from_fork+0x4b/0x60 arch/x86/kernel/process.c:147
           ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
      
          write to 0xffff88811254eb28 of 4 bytes by task 3158 on cpu 0:
           wg_cpumask_next_online drivers/net/wireguard/queueing.h:130 [inline]
           wg_queue_enqueue_per_device_and_peer drivers/net/wireguard/queueing.h:173 [inline]
           wg_packet_create_data drivers/net/wireguard/send.c:320 [inline]
           wg_packet_send_staged_packets+0x6e5/0xac0 drivers/net/wireguard/send.c:388
           wg_packet_send_keepalive+0xe2/0x100 drivers/net/wireguard/send.c:239
           wg_receive_handshake_packet drivers/net/wireguard/receive.c:186 [inline]
           wg_packet_handshake_receive_worker+0x449/0x5f0 drivers/net/wireguard/receive.c:213
           process_one_work kernel/workqueue.c:3248 [inline]
           process_scheduled_works+0x483/0x9a0 kernel/workqueue.c:3329
           worker_thread+0x526/0x720 kernel/workqueue.c:3409
           kthread+0x1d1/0x210 kernel/kthread.c:389
           ret_from_fork+0x4b/0x60 arch/x86/kernel/process.c:147
           ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
      
          value changed: 0xffffffff -> 0x00000000
      
      Mark this race as intentional by using READ/WRITE_ONCE().
      
      Cc: stable@vger.kernel.org
      Fixes: e7096c13 ("net: WireGuard secure network tunnel")
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Link: https://patch.msgid.link/20240704154517.1572127-4-Jason@zx2c4.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      21a0f856
    • Helge Deller's avatar
      wireguard: allowedips: avoid unaligned 64-bit memory accesses · b4764f0a
      Helge Deller authored
      
      
      commit 948f991c upstream.
      
      On the parisc platform, the kernel issues kernel warnings because
      swap_endian() tries to load a 128-bit IPv6 address from an unaligned
      memory location:
      
       Kernel: unaligned access to 0x55f4688c in wg_allowedips_insert_v6+0x2c/0x80 [wireguard] (iir 0xf3010df)
       Kernel: unaligned access to 0x55f46884 in wg_allowedips_insert_v6+0x38/0x80 [wireguard] (iir 0xf2010dc)
      
      Avoid such unaligned memory accesses by instead using the
      get_unaligned_be64() helper macro.
      
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      [Jason: replace src[8] in original patch with src+8]
      Cc: stable@vger.kernel.org
      Fixes: e7096c13 ("net: WireGuard secure network tunnel")
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Link: https://patch.msgid.link/20240704154517.1572127-3-Jason@zx2c4.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b4764f0a
    • Ilya Dryomov's avatar
      libceph: fix race between delayed_work() and ceph_monc_stop() · 20cf67dc
      Ilya Dryomov authored
      commit 69c7b2fe upstream.
      
      The way the delayed work is handled in ceph_monc_stop() is prone to
      races with mon_fault() and possibly also finish_hunting().  Both of
      these can requeue the delayed work which wouldn't be canceled by any of
      the following code in case that happens after cancel_delayed_work_sync()
      runs -- __close_session() doesn't mess with the delayed work in order
      to avoid interfering with the hunting interval logic.  This part was
      missed in commit b5d91704 ("libceph: behave in mon_fault() if
      cur_mon < 0") and use-after-free can still ensue on monc and objects
      that hang off of it, with monc->auth and monc->monmap being
      particularly susceptible to quickly being reused.
      
      To fix this:
      
      - clear monc->cur_mon and monc->hunting as part of closing the session
        in ceph_monc_stop()
      - bail from delayed_work() if monc->cur_mon is cleared, similar to how
        it's done in mon_fault() and finish_hunting() (based on monc->hunting)
      - call cancel_delayed_work_sync() after the session is closed
      
      Cc: stable@vger.kernel.org
      Link: https://tracker.ceph.com/issues/66857
      
      
      Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
      Reviewed-by: default avatarXiubo Li <xiubli@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      20cf67dc
    • Audra Mitchell's avatar
      Fix userfaultfd_api to return EINVAL as expected · 51954776
      Audra Mitchell authored
      commit 1723f04c upstream.
      
      Currently if we request a feature that is not set in the Kernel config we
      fail silently and return all the available features.  However, the man
      page indicates we should return an EINVAL.
      
      We need to fix this issue since we can end up with a Kernel warning should
      a program request the feature UFFD_FEATURE_WP_UNPOPULATED on a kernel with
      the config not set with this feature.
      
       [  200.812896] WARNING: CPU: 91 PID: 13634 at mm/memory.c:1660 zap_pte_range+0x43d/0x660
       [  200.820738] Modules linked in:
       [  200.869387] CPU: 91 PID: 13634 Comm: userfaultfd Kdump: loaded Not tainted 6.9.0-rc5+ #8
       [  200.877477] Hardware name: Dell Inc. PowerEdge R6525/0N7YGH, BIOS 2.7.3 03/30/2022
       [  200.885052] RIP: 0010:zap_pte_range+0x43d/0x660
      
      Link: https://lkml.kernel.org/r/20240626130513.120193-1-audra@redhat.com
      
      
      Fixes: e06f1e1d ("userfaultfd: wp: enabled write protection in userfaultfd API")
      Signed-off-by: default avatarAudra Mitchell <audra@redhat.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Christian Brauner <brauner@kernel.org>
      Cc: Jan Kara <jack@suse.cz>
      Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
      Cc: Peter Xu <peterx@redhat.com>
      Cc: Rafael Aquini <raquini@redhat.com>
      Cc: Shaohua Li <shli@fb.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      51954776
    • Edson Juliano Drosdeck's avatar
      ALSA: hda/realtek: Limit mic boost on VAIO PRO PX · b3e1890b
      Edson Juliano Drosdeck authored
      
      
      commit 6db03b19 upstream.
      
      The internal mic boost on the VAIO models VJFE-CL and VJFE-IL is too high.
      Fix this by applying the ALC269_FIXUP_LIMIT_INT_MIC_BOOST fixup to the machine
      to limit the gain.
      
      Signed-off-by: default avatarEdson Juliano Drosdeck <edson.drosdeck@gmail.com>
      Cc: <stable@vger.kernel.org>
      Link: https://patch.msgid.link/20240705141012.5368-1-edson.drosdeck@gmail.com
      
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b3e1890b
    • Nazar Bilinskyi's avatar
      ALSA: hda/realtek: Enable Mute LED on HP 250 G7 · 26af2ccf
      Nazar Bilinskyi authored
      
      
      commit b4695302 upstream.
      
      HP 250 G7 has a mute LED that can be made to work using quirk
      ALC269_FIXUP_HP_LINE1_MIC1_LED. Enable already existing quirk.
      
      Signed-off-by: default avatarNazar Bilinskyi <nbilinskyi@gmail.com>
      Cc: <stable@vger.kernel.org>
      Link: https://patch.msgid.link/20240709080546.18344-1-nbilinskyi@gmail.com
      
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      26af2ccf
    • Michał Kopeć's avatar
      ALSA: hda/realtek: add quirk for Clevo V5[46]0TU · fb9e1ee1
      Michał Kopeć authored
      
      
      commit e1c6db86 upstream.
      
      Apply quirk to fix combo jack detection on a new Clevo model: V5[46]0TU
      
      Signed-off-by: default avatarMichał Kopeć <michal.kopec@3mdeb.com>
      Cc: <stable@vger.kernel.org>
      Link: https://patch.msgid.link/20240701111010.1496569-1-michal.kopec@3mdeb.com
      
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fb9e1ee1
    • Thomas Weißschuh's avatar
      nvmem: core: only change name to fram for current attribute · 679df0bc
      Thomas Weißschuh authored
      
      
      commit 0ba424c9 upstream.
      
      bin_attr_nvmem_eeprom_compat is the template from which all future
      compat attributes are created.
      Changing it means to change all subsquent compat attributes, too.
      
      Instead only use the "fram" name for the currently registered attribute.
      
      Fixes: fd307a4a ("nvmem: prepare basics for FRAM support")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarThomas Weißschuh <linux@weissschuh.net>
      Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Link: https://lore.kernel.org/r/20240628113704.13742-4-srinivas.kandagatla@linaro.org
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      679df0bc
    • Joy Chakraborty's avatar
      nvmem: meson-efuse: Fix return value of nvmem callbacks · d2135fbc
      Joy Chakraborty authored
      
      
      commit 7a0a6d0a upstream.
      
      Read/write callbacks registered with nvmem core expect 0 to be returned
      on success and a negative value to be returned on failure.
      
      meson_efuse_read() and meson_efuse_write() call into
      meson_sm_call_read() and meson_sm_call_write() respectively which return
      the number of bytes read or written on success as per their api
      description.
      
      Fix to return error if meson_sm_call_read()/meson_sm_call_write()
      returns an error else return 0.
      
      Fixes: a29a63bd ("nvmem: meson-efuse: simplify read callback")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJoy Chakraborty <joychakr@google.com>
      Reviewed-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
      Reviewed-by: default avatarNeil Armstrong <neil.armstrong@linaro.org>
      Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Link: https://lore.kernel.org/r/20240628113704.13742-3-srinivas.kandagatla@linaro.org
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d2135fbc
    • Joy Chakraborty's avatar
      nvmem: rmem: Fix return value of rmem_read() · da5989e5
      Joy Chakraborty authored
      
      
      commit 28b00875 upstream.
      
      reg_read() callback registered with nvmem core expects 0 on success and
      a negative value on error but rmem_read() returns the number of bytes
      read which is treated as an error at the nvmem core.
      
      This does not break when rmem is accessed using sysfs via
      bin_attr_nvmem_read()/write() but causes an error when accessed from
      places like nvmem_access_with_keepouts(), etc.
      
      Change to return 0 on success and error in case
      memory_read_from_buffer() returns an error or -EIO if bytes read do not
      match what was requested.
      
      Fixes: 5a3fa75a ("nvmem: Add driver to expose reserved memory as nvmem")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJoy Chakraborty <joychakr@google.com>
      Reviewed-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
      Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Link: https://lore.kernel.org/r/20240628113704.13742-2-srinivas.kandagatla@linaro.org
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      da5989e5
    • He Zhe's avatar
      hpet: Support 32-bit userspace · ae3808a8
      He Zhe authored
      
      
      commit 4e60131d upstream.
      
      hpet_compat_ioctl and read file operations failed to handle parameters from
      32-bit userspace and thus samples/timers/hpet_example.c fails as below.
      
      root@intel-x86-64:~# ./hpet_example-32.out poll /dev/hpet 1 2
      -hpet: executing poll
      hpet_poll: HPET_IRQFREQ failed
      
      This patch fixes cmd and arg handling in hpet_compat_ioctl and adds compat
      handling for 32-bit userspace in hpet_read.
      
      hpet_example now shows that it works for both 64-bit and 32-bit.
      
      root@intel-x86-64:~# ./hpet_example-32.out poll /dev/hpet 1 2
      -hpet: executing poll
      hpet_poll: info.hi_flags 0x0
      hpet_poll: expired time = 0xf4298
      hpet_poll: revents = 0x1
      hpet_poll: data 0x1
      hpet_poll: expired time = 0xf4235
      hpet_poll: revents = 0x1
      hpet_poll: data 0x1
      root@intel-x86-64:~# ./hpet_example-64.out poll /dev/hpet 1 2
      -hpet: executing poll
      hpet_poll: info.hi_flags 0x0
      hpet_poll: expired time = 0xf42a1
      hpet_poll: revents = 0x1
      hpet_poll: data 0x1
      hpet_poll: expired time = 0xf4232
      hpet_poll: revents = 0x1
      hpet_poll: data 0x1
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarHe Zhe <zhe.he@windriver.com>
      Fixes: 54066a57 ("hpet: kill BKL, add compat_ioctl")
      Reviewed-by: default avatarArnd Bergmann <arnd@arndb.de>
      Link: https://lore.kernel.org/r/20240606123908.738733-1-zhe.he@windriver.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ae3808a8
    • Alan Stern's avatar
      USB: core: Fix duplicate endpoint bug by clearing reserved bits in the descriptor · 2bd8534a
      Alan Stern authored
      
      
      commit a368ecde upstream.
      
      Syzbot has identified a bug in usbcore (see the Closes: tag below)
      caused by our assumption that the reserved bits in an endpoint
      descriptor's bEndpointAddress field will always be 0.  As a result of
      the bug, the endpoint_is_duplicate() routine in config.c (and possibly
      other routines as well) may believe that two descriptors are for
      distinct endpoints, even though they have the same direction and
      endpoint number.  This can lead to confusion, including the bug
      identified by syzbot (two descriptors with matching endpoint numbers
      and directions, where one was interrupt and the other was bulk).
      
      To fix the bug, we will clear the reserved bits in bEndpointAddress
      when we parse the descriptor.  (Note that both the USB-2.0 and USB-3.1
      specs say these bits are "Reserved, reset to zero".)  This requires us
      to make a copy of the descriptor earlier in usb_parse_endpoint() and
      use the copy instead of the original when checking for duplicates.
      
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Reported-and-tested-by: default avatar <syzbot+8693a0bb9c10b554272a@syzkaller.appspotmail.com>
      Closes: https://lore.kernel.org/linux-usb/0000000000003d868e061bc0f554@google.com/
      Fixes: 0a8fd134 ("USB: fix problems with duplicate endpoint addresses")
      CC: Oliver Neukum <oneukum@suse.com>
      CC: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/205a5edc-7fef-4159-b64a-80374b6b101a@rowland.harvard.edu
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2bd8534a
    • Lee Jones's avatar
      usb: gadget: configfs: Prevent OOB read/write in usb_string_copy() · 72b8ee0d
      Lee Jones authored
      
      
      commit 6d3c721e upstream.
      
      Userspace provided string 's' could trivially have the length zero. Left
      unchecked this will firstly result in an OOB read in the form
      `if (str[0 - 1] == '\n') followed closely by an OOB write in the form
      `str[0 - 1] = '\0'`.
      
      There is already a validating check to catch strings that are too long.
      Let's supply an additional check for invalid strings that are too short.
      
      Signed-off-by: default avatarLee Jones <lee@kernel.org>
      Cc: stable <stable@kernel.org>
      Link: https://lore.kernel.org/r/20240705074339.633717-1-lee@kernel.org
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      72b8ee0d
    • WangYuli's avatar
      USB: Add USB_QUIRK_NO_SET_INTF quirk for START BP-850k · 840940bf
      WangYuli authored
      
      
      commit 3859e85d upstream.
      
      START BP-850K is a dot matrix printer that crashes when
      it receives a Set-Interface request and needs USB_QUIRK_NO_SET_INTF
      to work properly.
      
      Cc: stable <stable@kernel.org>
      Signed-off-by: default avatarjinxiaobo <jinxiaobo@uniontech.com>
      Signed-off-by: default avatarWangYuli <wangyuli@uniontech.com>
      Link: https://lore.kernel.org/r/202E4B2BD0F0FEA4+20240702154408.631201-1-wangyuli@uniontech.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      840940bf
    • Dmitry Smirnov's avatar
      USB: serial: mos7840: fix crash on resume · b14aa567
      Dmitry Smirnov authored
      
      
      commit c15a688e upstream.
      
      Since commit c49cfa91 ("USB: serial: use generic method if no
      alternative is provided in usb serial layer"), USB serial core calls the
      generic resume implementation when the driver has not provided one.
      
      This can trigger a crash on resume with mos7840 since support for
      multiple read URBs was added back in 2011. Specifically, both port read
      URBs are now submitted on resume for open ports, but the context pointer
      of the second URB is left set to the core rather than mos7840 port
      structure.
      
      Fix this by implementing dedicated suspend and resume functions for
      mos7840.
      
      Tested with Delock 87414 USB 2.0 to 4x serial adapter.
      
      Signed-off-by: default avatarDmitry Smirnov <d.smirnov@inbox.lv>
      [ johan: analyse crash and rewrite commit message; set busy flag on
               resume; drop bulk-in check; drop unnecessary usb_kill_urb() ]
      Fixes: d83b4053 ("USB: serial: add support for multiple read urbs")
      Cc: stable@vger.kernel.org	# 3.3
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b14aa567
    • Vanillan Wang's avatar
      USB: serial: option: add Rolling RW350-GL variants · e7542834
      Vanillan Wang authored
      
      
      commit ae420771 upstream.
      
      Update the USB serial option driver support for the Rolling
      RW350-GL
      - VID:PID 33f8:0802, RW350-GL are laptop M.2 cards (with
      MBIM interfaces for /Linux/Chrome OS)
      
      Here are the outputs of usb-devices:
      
      usbmode=63: mbim, pipe
      
      T:  Bus=02 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#=  2 Spd=5000 MxCh= 0
      D:  Ver= 3.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS= 9 #Cfgs=  1
      P:  Vendor=33f8 ProdID=0802 Rev=00.01
      S:  Manufacturer=Rolling Wireless S.a.r.l.
      S:  Product=USB DATA CARD
      C:  #Ifs= 3 Cfg#= 1 Atr=a0 MxPwr=896mA
      I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
      E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
      I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      E:  Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=83(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      
      usbmode=64: mbim, others at (If#= 5 adb)
      
      MBIM(MI0) + GNSS(MI2) + AP log(MI3) + AP META(MI4) + ADB(MI5) +
      MD AT(MI6) + MD META(MI7) + NPT(MI8) + Debug(MI9)
      
      T:  Bus=02 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#=  5 Spd=5000 MxCh= 0
      D:  Ver= 3.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS= 9 #Cfgs=  1
      P:  Vendor=33f8 ProdID=0802 Rev=00.01
      S:  Manufacturer=Rolling Wireless S.a.r.l.
      S:  Product=USB DATA CARD
      C:  #Ifs=10 Cfg#= 1 Atr=a0 MxPwr=896mA
      I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
      E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
      I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      E:  Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=83(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:  If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=03(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=84(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=04(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=85(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:  If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs
      E:  Ad=05(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=86(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:  If#= 6 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=06(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=87(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:  If#= 7 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=07(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=88(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:  If#= 8 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=08(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=89(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:  If#= 9 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=09(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=8a(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      
      Signed-off-by: default avatarVanillan Wang <vanillanwang@163.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e7542834
    • Mank Wang's avatar
      USB: serial: option: add Netprisma LCUK54 series modules · 9d672c57
      Mank Wang authored
      
      
      commit dc6dbe3e upstream.
      
      Add support for Netprisma LCUK54 series modules.
      
      LCUK54-WRD-LWW(0x3731/0x0100): NetPrisma LCUK54-WWD for Global
      LCUK54-WRD-LWW(0x3731/0x0101): NetPrisma LCUK54-WRD for Global SKU
      LCUK54-WRD-LCN(0x3731/0x0106): NetPrisma LCUK54-WRD for China SKU
      LCUK54-WRD-LWW(0x3731/0x0111): NetPrisma LCUK54-WWD for SA
      LCUK54-WRD-LWW(0x3731/0x0112): NetPrisma LCUK54-WWD for EU
      LCUK54-WRD-LWW(0x3731/0x0113): NetPrisma LCUK54-WWD for NA
      LCUK54-WWD-LCN(0x3731/0x0115): NetPrisma LCUK54-WWD for China EDU
      LCUK54-WWD-LWW(0x3731/0x0116): NetPrisma LCUK54-WWD for Golbal EDU
      
      Above products use the exact same interface layout and option
      driver:
      MBIM + GNSS + DIAG + NMEA + AT + QDSS + DPL
      
      T:  Bus=03 Lev=01 Prnt=01 Port=01 Cnt=02 Dev#=  5 Spd=480  MxCh= 0
      D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=3731 ProdID=0101 Rev= 5.04
      S:  Manufacturer=NetPrisma
      S:  Product=LCUK54-WRD
      S:  SerialNumber=b6250c36
      C:* #Ifs= 8 Cfg#= 1 Atr=a0 MxPwr=500mA
      A:  FirstIf#= 0 IfCount= 2 Cls=02(comm.) Sub=0e Prot=00
      I:* If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0e Prot=00 Driver=cdc_mbim
      E:  Ad=81(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
      I:  If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      I:* If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      E:  Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=0f(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 2 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
      E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
      I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
      E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=40 Driver=option
      E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 6 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=70 Driver=(none)
      E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 7 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none)
      E:  Ad=8f(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      Signed-off-by: default avatarMank Wang <mank.wang@netprisma.us>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9d672c57
    • Slark Xiao's avatar
      USB: serial: option: add support for Foxconn T99W651 · d2e942dc
      Slark Xiao authored
      
      
      commit 3c841d54 upstream.
      
      T99W651 is a RNDIS based modem device. There are 3 serial ports
      need to be enumerated: Diag, NMEA and AT.
      
      Test evidence as below:
      T:  Bus=01 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#=  6 Spd=480 MxCh= 0
      D:  Ver= 2.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=0489 ProdID=e145 Rev=05.15
      S:  Manufacturer=QCOM
      S:  Product=SDXPINN-IDP _SN:93B562B2
      S:  SerialNumber=82e6fe26
      C:  #Ifs= 7 Cfg#= 1 Atr=a0 MxPwr=500mA
      I:  If#=0x0 Alt= 0 #EPs= 1 Cls=ef(misc ) Sub=04 Prot=01 Driver=rndis_host
      I:  If#=0x1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=rndis_host
      I:  If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      I:  If#=0x3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      I:  If#=0x4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
      I:  If#=0x5 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=70 Driver=(none)
      I:  If#=0x6 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
      
      0&1: RNDIS, 2:AT, 3:NMEA, 4:DIAG, 5:QDSS, 6:ADB
      QDSS is not a serial port.
      
      Signed-off-by: default avatarSlark Xiao <slark_xiao@163.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d2e942dc
    • Bjørn Mork's avatar
      USB: serial: option: add Fibocom FM350-GL · 8c2bf484
      Bjørn Mork authored
      
      
      commit 2604e08f upstream.
      
      FM350-GL is 5G Sub-6 WWAN module which uses M.2 form factor interface.
      It is based on Mediatek's MTK T700 CPU. The module supports PCIe Gen3
      x1 and USB 2.0 and 3.0 interfaces.
      
      The manufacturer states that USB is "for debug" but it has been
      confirmed to be fully functional, except for modem-control requests on
      some of the interfaces.
      
      USB device composition is controlled by AT+GTUSBMODE=<mode> command.
      Two values are currently supported for the <mode>:
      
      40: RNDIS+AT+AP(GNSS)+META+DEBUG+NPT+ADB
      41: RNDIS+AT+AP(GNSS)+META+DEBUG+NPT+ADB+AP(LOG)+AP(META) (default value)
      
      [ Note that the functions above are not ordered by interface number. ]
      
      Mode 40 corresponds to:
      
      T:  Bus=03 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 22 Spd=480  MxCh= 0
      D:  Ver= 2.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=0e8d ProdID=7126 Rev= 0.01
      S:  Manufacturer=Fibocom Wireless Inc.
      S:  Product=FM350-GL
      C:* #Ifs= 8 Cfg#= 1 Atr=a0 MxPwr=500mA
      A:  FirstIf#= 0 IfCount= 2 Cls=e0(wlcon) Sub=01 Prot=03
      I:* If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=02 Prot=ff Driver=rndis_host
      E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=125us
      I:* If#= 1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=rndis_host
      E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
      E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 6 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 7 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      Mode 41 corresponds to:
      
      T:  Bus=03 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#=  7 Spd=480  MxCh= 0
      D:  Ver= 2.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=0e8d ProdID=7127 Rev= 0.01
      S:  Manufacturer=Fibocom Wireless Inc.
      S:  Product=FM350-GL
      C:* #Ifs=10 Cfg#= 1 Atr=a0 MxPwr=500mA
      A:  FirstIf#= 0 IfCount= 2 Cls=e0(wlcon) Sub=01 Prot=03
      I:* If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=02 Prot=ff Driver=rndis_host
      E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=125us
      I:* If#= 1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=rndis_host
      E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
      E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 6 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 7 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 8 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=08(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 9 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=8a(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=09(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarBjørn Mork <bjorn@mork.no>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8c2bf484
    • Daniele Palmas's avatar
      USB: serial: option: add Telit FN912 rmnet compositions · 3fc4c03f
      Daniele Palmas authored
      
      
      commit 9a590ff2 upstream.
      
      Add the following Telit FN912 compositions:
      
      0x3000: rmnet + tty (AT/NMEA) + tty (AT) + tty (diag)
      T:  Bus=03 Lev=01 Prnt=03 Port=07 Cnt=01 Dev#=  8 Spd=480  MxCh= 0
      D:  Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=1bc7 ProdID=3000 Rev=05.15
      S:  Manufacturer=Telit Cinterion
      S:  Product=FN912
      S:  SerialNumber=92c4c4d8
      C:  #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=500mA
      I:  If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan
      E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=82(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
      I:  If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option
      E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=86(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      I:  If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
      E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      0x3001: rmnet + tty (AT) + tty (diag) + DPL (data packet logging) + adb
      T:  Bus=03 Lev=01 Prnt=03 Port=07 Cnt=01 Dev#=  7 Spd=480  MxCh= 0
      D:  Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=1bc7 ProdID=3001 Rev=05.15
      S:  Manufacturer=Telit Cinterion
      S:  Product=FN912
      S:  SerialNumber=92c4c4d8
      C:  #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA
      I:  If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan
      E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=82(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
      I:  If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
      E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:  If#= 3 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none)
      E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs
      E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      Signed-off-by: default avatarDaniele Palmas <dnlplm@gmail.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3fc4c03f
    • Daniele Palmas's avatar
      USB: serial: option: add Telit generic core-dump composition · e0686854
      Daniele Palmas authored
      
      
      commit 4298e400 upstream.
      
      Add the following core-dump composition, used in different Telit modems:
      
      0x9000: tty (sahara)
      T:  Bus=03 Lev=01 Prnt=03 Port=07 Cnt=01 Dev#= 41 Spd=480  MxCh= 0
      D:  Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=1bc7 ProdID=9000 Rev=00.00
      S:  Manufacturer=Telit Cinterion
      S:  Product=FN990-dump
      S:  SerialNumber=e815bdde
      C:  #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=2mA
      I:  If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=10 Driver=option
      E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      Signed-off-by: default avatarDaniele Palmas <dnlplm@gmail.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e0686854
    • Ronald Wahl's avatar
      net: ks8851: Fix potential TX stall after interface reopen · c0d03cdd
      Ronald Wahl authored
      
      
      commit 7a99afef upstream.
      
      The amount of TX space in the hardware buffer is tracked in the tx_space
      variable. The initial value is currently only set during driver probing.
      
      After closing the interface and reopening it the tx_space variable has
      the last value it had before close. If it is smaller than the size of
      the first send packet after reopeing the interface the queue will be
      stopped. The queue is woken up after receiving a TX interrupt but this
      will never happen since we did not send anything.
      
      This commit moves the initialization of the tx_space variable to the
      ks8851_net_open function right before starting the TX queue. Also query
      the value from the hardware instead of using a hard coded value.
      
      Only the SPI chip variant is affected by this issue because only this
      driver variant actually depends on the tx_space variable in the xmit
      function.
      
      Fixes: 3dc5d445 ("net: ks8851: Fix TX stall caused by TX buffer overrun")
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: Jakub Kicinski <kuba@kernel.org>
      Cc: Paolo Abeni <pabeni@redhat.com>
      Cc: Simon Horman <horms@kernel.org>
      Cc: netdev@vger.kernel.org
      Cc: stable@vger.kernel.org # 5.10+
      Signed-off-by: default avatarRonald Wahl <ronald.wahl@raritan.com>
      Reviewed-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Link: https://patch.msgid.link/20240709195845.9089-1-rwahl@gmx.de
      
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c0d03cdd
    • Eric Dumazet's avatar
      tcp: avoid too many retransmit packets · 04317a24
      Eric Dumazet authored
      
      
      commit 97a90635 upstream.
      
      If a TCP socket is using TCP_USER_TIMEOUT, and the other peer
      retracted its window to zero, tcp_retransmit_timer() can
      retransmit a packet every two jiffies (2 ms for HZ=1000),
      for about 4 minutes after TCP_USER_TIMEOUT has 'expired'.
      
      The fix is to make sure tcp_rtx_probe0_timed_out() takes
      icsk->icsk_user_timeout into account.
      
      Before blamed commit, the socket would not timeout after
      icsk->icsk_user_timeout, but would use standard exponential
      backoff for the retransmits.
      
      Also worth noting that before commit e89688e3 ("net: tcp:
      fix unexcepted socket die when snd_wnd is 0"), the issue
      would last 2 minutes instead of 4.
      
      Fixes: b701a99e ("tcp: Add tcp_clamp_rto_to_user_timeout() helper to improve accuracy")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Neal Cardwell <ncardwell@google.com>
      Reviewed-by: default avatarJason Xing <kerneljasonxing@gmail.com>
      Reviewed-by: default avatarJon Maxwell <jmaxwell37@gmail.com>
      Reviewed-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
      Link: https://patch.msgid.link/20240710001402.2758273-1-edumazet@google.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      04317a24
    • Eric Dumazet's avatar
      tcp: use signed arithmetic in tcp_rtx_probe0_timed_out() · 3c65bfcb
      Eric Dumazet authored
      
      
      commit 36534d3c upstream.
      
      Due to timer wheel implementation, a timer will usually fire
      after its schedule.
      
      For instance, for HZ=1000, a timeout between 512ms and 4s
      has a granularity of 64ms.
      For this range of values, the extra delay could be up to 63ms.
      
      For TCP, this means that tp->rcv_tstamp may be after
      inet_csk(sk)->icsk_timeout whenever the timer interrupt
      finally triggers, if one packet came during the extra delay.
      
      We need to make sure tcp_rtx_probe0_timed_out() handles this case.
      
      Fixes: e89688e3 ("net: tcp: fix unexcepted socket die when snd_wnd is 0")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Menglong Dong <imagedong@tencent.com>
      Acked-by: default avatarNeal Cardwell <ncardwell@google.com>
      Reviewed-by: default avatarJason Xing <kerneljasonxing@gmail.com>
      Link: https://lore.kernel.org/r/20240607125652.1472540-1-edumazet@google.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3c65bfcb
    • Satheesh Paul's avatar
      octeontx2-af: fix issue with IPv4 match for RSS · 15c010d3
      Satheesh Paul authored
      
      
      [ Upstream commit 60795bbf ]
      
      While performing RSS based on IPv4, packets with
      IPv4 options are not being considered. Adding changes
      to match both plain IPv4 and IPv4 with option header.
      
      Fixes: 41a7aa7b ("octeontx2-af: NIX Rx flowkey configuration for RSS")
      Signed-off-by: default avatarSatheesh Paul <psatheesh@marvell.com>
      Reviewed-by: default avatarKalesh AP <kalesh-anakkur.purayil@broadcom.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      15c010d3
    • Kiran Kumar K's avatar
      octeontx2-af: fix issue with IPv6 ext match for RSS · ab3a1c38
      Kiran Kumar K authored
      
      
      [ Upstream commit e23ac109 ]
      
      While performing RSS based on IPv6, extension ltype
      is not being considered. This will be problem for
      fragmented packets or packets with extension header.
      Adding changes to match IPv6 ext header along with IPv6
      ltype.
      
      Fixes: 41a7aa7b ("octeontx2-af: NIX Rx flowkey configuration for RSS")
      Signed-off-by: default avatarKiran Kumar K <kirankumark@marvell.com>
      Reviewed-by: default avatarKalesh AP <kalesh-anakkur.purayil@broadcom.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ab3a1c38
    • Kiran Kumar K's avatar
      octeontx2-af: extend RSS supported offload types · 71d0f158
      Kiran Kumar K authored
      
      
      [ Upstream commit 79bc788c ]
      
      Add support to select L3 SRC or DST only, L4 SRC or DST only for RSS
      calculation.
      
      AF consumer may have requirement as we can select only SRC or DST data for
      RSS calculation in L3, L4 layers. With this requirement there will be
      following combinations, IPV[4,6]_SRC_ONLY, IPV[4,6]_DST_ONLY,
      [TCP,UDP,SCTP]_SRC_ONLY, [TCP,UDP,SCTP]_DST_ONLY. So, instead of creating
      a bit for each combination, we are using upper 4 bits (31:28) in the
      flow_key_cfg to represent the SRC, DST selection. 31 => L3_SRC,
      30 => L3_DST, 29 => L4_SRC, 28 => L4_DST. These won't be part of flow_cfg,
      so that we don't need to change the existing ABI.
      
      Signed-off-by: default avatarKiran Kumar K <kirankumark@marvell.com>
      Signed-off-by: default avatarGeetha sowjanya <gakula@marvell.com>
      Signed-off-by: default avatarNaveen Mamindlapalli <naveenm@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Stable-dep-of: e23ac109 ("octeontx2-af: fix issue with IPv6 ext match for RSS")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      71d0f158
    • Michal Mazur's avatar
      octeontx2-af: fix detection of IP layer · 74c5bc33
      Michal Mazur authored
      
      
      [ Upstream commit 404dc0fd ]
      
      Checksum and length checks are not enabled for IPv4 header with
      options and IPv6 with extension headers.
      To fix this a change in enum npc_kpu_lc_ltype is required which will
      allow adjustment of LTYPE_MASK to detect all types of IP headers.
      
      Fixes: 21e6699e ("octeontx2-af: Add NPC KPU profile")
      Signed-off-by: default avatarMichal Mazur <mmazur2@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      74c5bc33
    • Srujana Challa's avatar
      octeontx2-af: fix a issue with cpt_lf_alloc mailbox · b65406f5
      Srujana Challa authored
      
      
      [ Upstream commit 845fe191 ]
      
      This patch fixes CPT_LF_ALLOC mailbox error due to
      incompatible mailbox message format. Specifically, it
      corrects the `blkaddr` field type from `int` to `u8`.
      
      Fixes: de2854c8 ("octeontx2-af: Mailbox changes for 98xx CPT block")
      Signed-off-by: default avatarSrujana Challa <schalla@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b65406f5
    • Srujana Challa's avatar
      octeontx2-af: update cpt lf alloc mailbox · bacb3fc5
      Srujana Challa authored
      
      
      [ Upstream commit c0688ec0 ]
      
      The CN10K CPT coprocessor contains a context processor
      to accelerate updates to the IPsec security association
      contexts. The context processor contains a context cache.
      This patch updates CPT LF ALLOC mailbox to config ctx_ilen
      requested by VFs. CPT_LF_ALLOC:ctx_ilen is the size of
      initial context fetch.
      
      Signed-off-by: default avatarSrujana Challa <schalla@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Stable-dep-of: 845fe191 ("octeontx2-af: fix a issue with cpt_lf_alloc mailbox")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      bacb3fc5
    • Nithin Dabilpuram's avatar
      octeontx2-af: replace cpt slot with lf id on reg write · e4dc9e89
      Nithin Dabilpuram authored
      
      
      [ Upstream commit bc35e28a ]
      
      Replace slot id with global CPT lf id on reg read/write as
      CPTPF/VF driver would send slot number instead of global
      lf id in the reg offset. And also update the mailbox response
      with the global lf's register offset.
      
      Fixes: ae454086 ("octeontx2-af: add mailbox interface for CPT")
      Signed-off-by: default avatarNithin Dabilpuram <ndabilpuram@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e4dc9e89
Loading