Skip to content
  1. Jun 05, 2023
    • Oleksij Rempel's avatar
      can: j1939: j1939_sk_send_loop_abort(): improved error queue handling in J1939 Socket · 2a84aea8
      Oleksij Rempel authored
      
      
      This patch addresses an issue within the j1939_sk_send_loop_abort()
      function in the j1939/socket.c file, specifically in the context of
      Transport Protocol (TP) sessions.
      
      Without this patch, when a TP session is initiated and a Clear To Send
      (CTS) frame is received from the remote side requesting one data packet,
      the kernel dispatches the first Data Transport (DT) frame and then waits
      for the next CTS. If the remote side doesn't respond with another CTS,
      the kernel aborts due to a timeout. This leads to the user-space
      receiving an EPOLLERR on the socket, and the socket becomes active.
      
      However, when trying to read the error queue from the socket with
      sock.recvmsg(, , socket.MSG_ERRQUEUE), it returns -EAGAIN,
      given that the socket is non-blocking. This situation results in an
      infinite loop: the user-space repeatedly calls epoll(), epoll() returns
      the socket file descriptor with EPOLLERR, but the socket then blocks on
      the recv() of ERRQUEUE.
      
      This patch introduces an additional check for the J1939_SOCK_ERRQUEUE
      flag within the j1939_sk_send_loop_abort() function. If the flag is set,
      it indicates that the application has subscribed to receive error queue
      messages. In such cases, the kernel can communicate the current transfer
      state via the error queue. This allows for the function to return early,
      preventing the unnecessary setting of the socket into an error state,
      and breaking the infinite loop. It is crucial to note that a socket
      error is only needed if the application isn't using the error queue, as,
      without it, the application wouldn't be aware of transfer issues.
      
      Fixes: 9d71dd0c ("can: add support of SAE J1939 protocol")
      Reported-by: default avatarDavid Jander <david@protonic.nl>
      Tested-by: default avatarDavid Jander <david@protonic.nl>
      Signed-off-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
      Link: https://lore.kernel.org/r/20230526081946.715190-1-o.rempel@pengutronix.de
      
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      2a84aea8
  2. Jun 04, 2023
    • Min-Hua Chen's avatar
      net: sched: wrap tc_skip_wrapper with CONFIG_RETPOLINE · 8cde87b0
      Min-Hua Chen authored
      
      
      This patch fixes the following sparse warning:
      
      net/sched/sch_api.c:2305:1: sparse: warning: symbol 'tc_skip_wrapper' was not declared. Should it be static?
      
      No functional change intended.
      
      Signed-off-by: default avatarMin-Hua Chen <minhuadotchen@gmail.com>
      Acked-by: default avatarPedro Tammela <pctammela@mojatatu.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8cde87b0
    • David S. Miller's avatar
      Merge branch 'enetc-fixes' · 3d5f4d29
      David S. Miller authored
      
      
      Wei Fang says:
      
      ====================
      net: enetc: correct the statistics of rx bytes
      
      The purpose of this patch set is to fix the issue of rx bytes
      statistics. The first patch corrects the rx bytes statistics
      of normal kernel protocol stack path, and the second patch is
      used to correct the rx bytes statistics of XDP.
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3d5f4d29
    • Wei Fang's avatar
      net: enetc: correct rx_bytes statistics of XDP · fdebd850
      Wei Fang authored
      
      
      The rx_bytes statistics of XDP are always zero, because rx_byte_cnt
      is not updated after it is initialized to 0. So fix it.
      
      Fixes: d1b15102 ("net: enetc: add support for XDP_DROP and XDP_PASS")
      Signed-off-by: default avatarWei Fang <wei.fang@nxp.com>
      Reviewed-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      fdebd850
    • Wei Fang's avatar
      net: enetc: correct the statistics of rx bytes · 7190d0ff
      Wei Fang authored
      
      
      The rx_bytes of struct net_device_stats should count the length of
      ethernet frames excluding the FCS. However, there are two problems
      with the rx_bytes statistics of the current enetc driver. one is
      that the length of VLAN header is not counted if the VLAN extraction
      feature is enabled. The other is that the length of L2 header is not
      counted, because eth_type_trans() is invoked before updating rx_bytes
      which will subtract the length of L2 header from skb->len.
      BTW, the rx_bytes statistics of XDP path also have similar problem,
      I will fix it in another patch.
      
      Fixes: a800abd3 ("net: enetc: move skb creation into enetc_build_skb")
      Signed-off-by: default avatarWei Fang <wei.fang@nxp.com>
      Reviewed-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7190d0ff
    • Wen Gu's avatar
      net/smc: Avoid to access invalid RMBs' MRs in SMCRv1 ADD LINK CONT · c308e9ec
      Wen Gu authored
      SMCRv1 has a similar issue to SMCRv2 (see link below) that may access
      invalid MRs of RMBs when construct LLC ADD LINK CONT messages.
      
       BUG: kernel NULL pointer dereference, address: 0000000000000014
       #PF: supervisor read access in kernel mode
       #PF: error_code(0x0000) - not-present page
       PGD 0 P4D 0
       Oops: 0000 [#1] PREEMPT SMP PTI
       CPU: 5 PID: 48 Comm: kworker/5:0 Kdump: loaded Tainted: G W   E      6.4.0-rc3+ #49
       Workqueue: events smc_llc_add_link_work [smc]
       RIP: 0010:smc_llc_add_link_cont+0x160/0x270 [smc]
       RSP: 0018:ffffa737801d3d50 EFLAGS: 00010286
       RAX: ffff964f82144000 RBX: ffffa737801d3dd8 RCX: 0000000000000000
       RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff964f81370c30
       RBP: ffffa737801d3dd4 R08: ffff964f81370000 R09: ffffa737801d3db0
       R10: 0000000000000001 R11: 0000000000000060 R12: ffff964f82e70000
       R13: ffff964f81370c38 R14: ffffa737801d3dd3 R15: 0000000000000001
       FS:  0000000000000000(0000) GS:ffff9652bfd40000(0000) knlGS:0000000000000000
       CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
       CR2: 0000000000000014 CR3: 000000008fa20004 CR4: 00000000003706e0
       DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
       DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
       Call Trace:
        <TASK>
        smc_llc_srv_rkey_exchange+0xa7/0x190 [smc]
        smc_llc_srv_add_link+0x3ae/0x5a0 [smc]
        smc_llc_add_link_work+0xb8/0x140 [smc]
        process_one_work+0x1e5/0x3f0
        worker_thread+0x4d/0x2f0
        ? __pfx_worker_thread+0x10/0x10
        kthread+0xe5/0x120
        ? __pfx_kthread+0x10/0x10
        ret_from_fork+0x2c/0x50
        </TASK>
      
      When an alernate RNIC is available in system, SMC will try to add a new
      link based on the RNIC for resilience. All the RMBs in use will be mapped
      to the new link. Then the RMBs' MRs corresponding to the new link will
      be filled into LLC messages. For SMCRv1, they are ADD LINK CONT messages.
      
      However smc_llc_add_link_cont() may mistakenly access to unused RMBs which
      haven't been mapped to the new link and have no valid MRs, thus causing a
      crash. So this patch fixes it.
      
      Fixes: 87f88cda ("net/smc: rkey processing for a new link as SMC client")
      Link: https://lore.kernel.org/r/1685101741-74826-3-git-send-email-guwen@linux.alibaba.com
      
      
      Signed-off-by: default avatarWen Gu <guwen@linux.alibaba.com>
      Reviewed-by: default avatarWenjia Zhang <wenjia@linux.ibm.com>
      Reviewed-by: default avatarTony Lu <tonylu@linux.alibaba.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c308e9ec
    • Weihao Gao's avatar
      Fix gitignore for recently added usptream self tests · 02a7eee1
      Weihao Gao authored
      
      
      This resolves the issue that generated binary is showing up as an untracked git file after every build on the kernel.
      
      Signed-off-by: default avatarWeihao Gao <weihaogao@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      02a7eee1
  3. Jun 03, 2023
  4. Jun 02, 2023
  5. Jun 01, 2023