Skip to content
  1. Jan 12, 2023
  2. Jan 11, 2023
    • David S. Miller's avatar
    • Herbert Xu's avatar
      ipv6: raw: Deduct extension header length in rawv6_push_pending_frames · cb3e9864
      Herbert Xu authored
      
      
      The total cork length created by ip6_append_data includes extension
      headers, so we must exclude them when comparing them against the
      IPV6_CHECKSUM offset which does not include extension headers.
      
      Reported-by: default avatarKyle Zeng <zengyhkyle@gmail.com>
      Fixes: 357b40a1
      
       ("[IPV6]: IPV6_CHECKSUM socket option can corrupt kernel memory")
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      cb3e9864
    • Clément Léger's avatar
      net: lan966x: check for ptp to be enabled in lan966x_ptp_deinit() · b0e380b5
      Clément Léger authored
      If ptp was not enabled due to missing IRQ for instance,
      lan966x_ptp_deinit() will dereference NULL pointers.
      
      Fixes: d0964594
      
       ("net: lan966x: Add support for ptp clocks")
      Signed-off-by: default avatarClément Léger <clement.leger@bootlin.com>
      Reviewed-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b0e380b5
    • Jakub Kicinski's avatar
      Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue · 0aa7d35f
      Jakub Kicinski authored
      
      
      Tony Nguyen says:
      
      ====================
      Intel Wired LAN Driver Updates 2023-01-09 (ice)
      
      This series contains updates to ice driver only.
      
      Jiasheng Jiang frees allocated cmd_buf if write_buf allocation failed to
      prevent memory leak.
      
      Yuan Can adds check, and proper cleanup, of gnss_tty_port allocation call
      to avoid memory leaks.
      
      * '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue:
        ice: Add check for kzalloc
        ice: Fix potential memory leak in ice_gnss_tty_write()
      ====================
      
      Link: https://lore.kernel.org/r/20230109225358.3478060-1-anthony.l.nguyen@intel.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      0aa7d35f
    • Frederick Lawler's avatar
      net: sched: disallow noqueue for qdisc classes · 96398560
      Frederick Lawler authored
      While experimenting with applying noqueue to a classful queue discipline,
      we discovered a NULL pointer dereference in the __dev_queue_xmit()
      path that generates a kernel OOPS:
      
          # dev=enp0s5
          # tc qdisc replace dev $dev root handle 1: htb default 1
          # tc class add dev $dev parent 1: classid 1:1 htb rate 10mbit
          # tc qdisc add dev $dev parent 1:1 handle 10: noqueue
          # ping -I $dev -w 1 -c 1 1.1.1.1
      
      [    2.172856] BUG: kernel NULL pointer dereference, address: 0000000000000000
      [    2.173217] #PF: supervisor instruction fetch in kernel mode
      ...
      [    2.178451] Call Trace:
      [    2.178577]  <TASK>
      [    2.178686]  htb_enqueue+0x1c8/0x370
      [    2.178880]  dev_qdisc_enqueue+0x15/0x90
      [    2.179093]  __dev_queue_xmit+0x798/0xd00
      [    2.179305]  ? _raw_write_lock_bh+0xe/0x30
      [    2.179522]  ? __local_bh_enable_ip+0x32/0x70
      [    2.179759]  ? ___neigh_create+0x610/0x840
      [    2.179968]  ? eth_header+0x21/0xc0
      [    2.180144]  ip_finish_output2+0x15e/0x4f0
      [    2.180348]  ? dst_output+0x30/0x30
      [    2.180525]  ip_push_pending_frames+0x9d/0xb0
      [    2.180739]  raw_sendmsg+0x601/0xcb0
      [    2.180916]  ? _raw_spin_trylock+0xe/0x50
      [    2.181112]  ? _raw_spin_unlock_irqrestore+0x16/0x30
      [    2.181354]  ? get_page_from_freelist+0xcd6/0xdf0
      [    2.181594]  ? sock_sendmsg+0x56/0x60
      [    2.181781]  sock_sendmsg+0x56/0x60
      [    2.181958]  __sys_sendto+0xf7/0x160
      [    2.182139]  ? handle_mm_fault+0x6e/0x1d0
      [    2.182366]  ? do_user_addr_fault+0x1e1/0x660
      [    2.182627]  __x64_sys_sendto+0x1b/0x30
      [    2.182881]  do_syscall_64+0x38/0x90
      [    2.183085]  entry_SYSCALL_64_after_hwframe+0x63/0xcd
      ...
      [    2.187402]  </TASK>
      
      Previously in commit d66d6c31 ("net: sched: register noqueue
      qdisc"), NULL was set for the noqueue discipline on noqueue init
      so that __dev_queue_xmit() falls through for the noqueue case. This
      also sets a bypass of the enqueue NULL check in the
      register_qdisc() function for the struct noqueue_disc_ops.
      
      Classful queue disciplines make it past the NULL check in
      __dev_queue_xmit() because the discipline is set to htb (in this case),
      and then in the call to __dev_xmit_skb(), it calls into htb_enqueue()
      which grabs a leaf node for a class and then calls qdisc_enqueue() by
      passing in a queue discipline which assumes ->enqueue() is not set to NULL.
      
      Fix this by not allowing classes to be assigned to the noqueue
      discipline. Linux TC Notes states that classes cannot be set to
      the noqueue discipline. [1] Let's enforce that here.
      
      Links:
      1. https://linux-tc-notes.sourceforge.net/tc/doc/sch_noqueue.txt
      
      Fixes: d66d6c31
      
       ("net: sched: register noqueue qdisc")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarFrederick Lawler <fred@cloudflare.com>
      Reviewed-by: default avatarJakub Sitnicki <jakub@cloudflare.com>
      Link: https://lore.kernel.org/r/20230109163906.706000-1-fred@cloudflare.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      96398560
  3. Jan 10, 2023
  4. Jan 09, 2023
    • Mirsad Goran Todorovac's avatar
      af_unix: selftest: Fix the size of the parameter to connect() · 7d6ceeb1
      Mirsad Goran Todorovac authored
      
      
      Adjust size parameter in connect() to match the type of the parameter, to
      fix "No such file or directory" error in selftests/net/af_unix/
      test_oob_unix.c:127.
      
      The existing code happens to work provided that the autogenerated pathname
      is shorter than sizeof (struct sockaddr), which is why it hasn't been
      noticed earlier.
      
      Visible from the trace excerpt:
      
      bind(3, {sa_family=AF_UNIX, sun_path="unix_oob_453059"}, 110) = 0
      clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fa6a6577a10) = 453060
      [pid <child>] connect(6, {sa_family=AF_UNIX, sun_path="unix_oob_45305"}, 16) = -1 ENOENT (No such file or directory)
      
      BUG: The filename is trimmed to sizeof (struct sockaddr).
      
      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: Shuah Khan <shuah@kernel.org>
      Cc: Kuniyuki Iwashima <kuniyu@amazon.co.jp>
      Cc: Florian Westphal <fw@strlen.de>
      Reviewed-by: default avatarFlorian Westphal <fw@strlen.de>
      Fixes: 314001f0
      
       ("af_unix: Add OOB support")
      Signed-off-by: default avatarMirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr>
      Reviewed-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7d6ceeb1
    • Horatiu Vultur's avatar
      net: lan966x: Allow to add rules in TCAM even if not enabled · 76761bab
      Horatiu Vultur authored
      The blamed commit implemented the vcap_operations to allow to add an
      entry in the TCAM. One of the callbacks is to validate the supported
      keysets. If the TCAM lookup was not enabled, then this will return
      failure so no entries could be added.
      This doesn't make much sense, as you can enable at a later point the
      TCAM. Therefore change it such to allow entries in TCAM even it is not
      enabled.
      
      Fixes: 4426b78c
      
       ("net: lan966x: Add port keyset config and callback interface")
      Signed-off-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      76761bab
    • Eric Dumazet's avatar
      gro: take care of DODGY packets · 7871f54e
      Eric Dumazet authored
      Jaroslav reported a recent throughput regression with virtio_net
      caused by blamed commit.
      
      It is unclear if DODGY GSO packets coming from user space
      can be accepted by GRO engine in the future with minimal
      changes, and if there is any expected gain from it.
      
      In the meantime, make sure to detect and flush DODGY packets.
      
      Fixes: 5eddb249
      
       ("gro: add support of (hw)gro packets to gro stack")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-and-bisected-by: default avatarJaroslav Pulchart <jaroslav.pulchart@gooddata.com>
      Cc: Coco Li <lixiaoyan@google.com>
      Cc: Paolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7871f54e
    • Minsuk Kang's avatar
      nfc: pn533: Wait for out_urb's completion in pn533_usb_send_frame() · 9dab880d
      Minsuk Kang authored
      Fix a use-after-free that occurs in hcd when in_urb sent from
      pn533_usb_send_frame() is completed earlier than out_urb. Its callback
      frees the skb data in pn533_send_async_complete() that is used as a
      transfer buffer of out_urb. Wait before sending in_urb until the
      callback of out_urb is called. To modify the callback of out_urb alone,
      separate the complete function of out_urb and ack_urb.
      
      Found by a modified version of syzkaller.
      
      BUG: KASAN: use-after-free in dummy_timer
      Call Trace:
       memcpy (mm/kasan/shadow.c:65)
       dummy_perform_transfer (drivers/usb/gadget/udc/dummy_hcd.c:1352)
       transfer (drivers/usb/gadget/udc/dummy_hcd.c:1453)
       dummy_timer (drivers/usb/gadget/udc/dummy_hcd.c:1972)
       arch_static_branch (arch/x86/include/asm/jump_label.h:27)
       static_key_false (include/linux/jump_label.h:207)
       timer_expire_exit (include/trace/events/timer.h:127)
       call_timer_fn (kernel/time/timer.c:1475)
       expire_timers (kernel/time/timer.c:1519)
       __run_timers (kernel/time/timer.c:1790)
       run_timer_softirq (kernel/time/timer.c:1803)
      
      Fixes: c46ee386
      
       ("NFC: pn533: add NXP pn533 nfc device driver")
      Signed-off-by: default avatarMinsuk Kang <linuxlovemin@yonsei.ac.kr>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9dab880d
    • Kees Cook's avatar
      mlxsw: spectrum_router: Replace 0-length array with flexible array · 2ab6478d
      Kees Cook authored
      
      
      Zero-length arrays are deprecated[1]. Replace struct
      mlxsw_sp_nexthop_group_info's "nexthops" 0-length array with a flexible
      array. Detected with GCC 13, using -fstrict-flex-arrays=3:
      
      drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c: In function 'mlxsw_sp_nexthop_group_hash_obj':
      drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c:3278:38: warning: array subscript i is outside array bounds of 'struct mlxsw_sp_nexthop[0]' [-Warray-bounds=]
       3278 |                         val ^= jhash(&nh->ifindex, sizeof(nh->ifindex), seed);
            |                                      ^~~~~~~~~~~~
      drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c:2954:33: note: while referencing 'nexthops'
       2954 |         struct mlxsw_sp_nexthop nexthops[0];
            |                                 ^~~~~~~~
      
      [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays
      
      Cc: Ido Schimmel <idosch@nvidia.com>
      Cc: Petr Machata <petrm@nvidia.com>
      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: "Gustavo A. R. Silva" <gustavoars@kernel.org>
      Cc: netdev@vger.kernel.org
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Reviewed-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
      Tested-by: default avatarPetr Machata <petrm@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2ab6478d
    • Alex Elder's avatar
      net: ipa: correct IPA v4.7 IMEM offset · 60ea6f00
      Alex Elder authored
      Commit b310de78 ("net: ipa: add IPA v4.7 support") was merged
      despite an unresolved comment made by Konrad Dybcio.  Konrad
      observed that the IMEM region specified for IPA v4.7 did not match
      that used downstream for the SM7225 SoC.  In "lagoon.dtsi" present
      in a Sony Xperia source tree, a ipa_smmu_ap node was defined with a
      "qcom,additional-mapping" property that defined the IPA IMEM area
      starting at offset 0x146a8000 (not 0x146a9000 that was committed).
      
      The IPA v4.7 target system used for testing uses the SM7225 SoC, so
      we'll adhere what the downstream code specifies is the address of
      the IMEM region used for IPA.
      
      Link: https://lore.kernel.org/linux-arm-msm/20221208211529.757669-1-elder@linaro.org
      Fixes: b310de78
      
       ("net: ipa: add IPA v4.7 support")
      Tested-by: default avatarLuca Weiss <luca.weiss@fairphone.com>
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Reviewed-by: default avatarKonrad Dybcio <konrad.dybcio@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      60ea6f00
    • Ivan T. Ivanov's avatar
      brcmfmac: Prefer DT board type over DMI board type · a5a36720
      Ivan T. Ivanov authored
      The introduction of support for Apple board types inadvertently changed
      the precedence order, causing hybrid SMBIOS+DT platforms to look up the
      firmware using the DMI information instead of the device tree compatible
      to generate the board type. Revert back to the old behavior,
      as affected platforms use firmwares named after the DT compatible.
      
      Fixes: 7682de8b
      
       ("wifi: brcmfmac: of: Fetch Apple properties")
      
      [1] https://bugzilla.opensuse.org/show_bug.cgi?id=1206697#c13
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarIvan T. Ivanov <iivanov@suse.de>
      Reviewed-by: default avatarHector Martin <marcan@marcan.st>
      Reviewed-by: default avatarArend van Spriel <arend.vanspriel@broadcom.com>
      Tested-by: default avatarPeter Robinson <pbrobinson@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a5a36720