Skip to content
Snippets Groups Projects
  1. Dec 14, 2024
    • Saurav Kashyap's avatar
      scsi: qla2xxx: Remove check req_sg_cnt should be equal to rsp_sg_cnt · df43d8da
      Saurav Kashyap authored
      
      commit 833c70e2 upstream.
      
      Firmware supports multiple sg_cnt for request and response for CT
      commands, so remove the redundant check. A check is there where sg_cnt
      for request and response should be same. This is not required as driver
      and FW have code to handle multiple and different sg_cnt on request and
      response.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSaurav Kashyap <skashyap@marvell.com>
      Signed-off-by: default avatarNilesh Javali <njavali@marvell.com>
      Link: https://lore.kernel.org/r/20241115130313.46826-5-njavali@marvell.com
      
      
      Reviewed-by: default avatarHimanshu Madhani <himanshu.madhani@oracle.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      df43d8da
    • Quinn Tran's avatar
      scsi: qla2xxx: Fix use after free on unload · 12f04fc8
      Quinn Tran authored
      
      commit 07c903db upstream.
      
      System crash is observed with stack trace warning of use after
      free. There are 2 signals to tell dpc_thread to terminate (UNLOADING
      flag and kthread_stop).
      
      On setting the UNLOADING flag when dpc_thread happens to run at the time
      and sees the flag, this causes dpc_thread to exit and clean up
      itself. When kthread_stop is called for final cleanup, this causes use
      after free.
      
      Remove UNLOADING signal to terminate dpc_thread.  Use the kthread_stop
      as the main signal to exit dpc_thread.
      
      [596663.812935] kernel BUG at mm/slub.c:294!
      [596663.812950] invalid opcode: 0000 [#1] SMP PTI
      [596663.812957] CPU: 13 PID: 1475935 Comm: rmmod Kdump: loaded Tainted: G          IOE    --------- -  - 4.18.0-240.el8.x86_64 #1
      [596663.812960] Hardware name: HP ProLiant DL380p Gen8, BIOS P70 08/20/2012
      [596663.812974] RIP: 0010:__slab_free+0x17d/0x360
      
      ...
      [596663.813008] Call Trace:
      [596663.813022]  ? __dentry_kill+0x121/0x170
      [596663.813030]  ? _cond_resched+0x15/0x30
      [596663.813034]  ? _cond_resched+0x15/0x30
      [596663.813039]  ? wait_for_completion+0x35/0x190
      [596663.813048]  ? try_to_wake_up+0x63/0x540
      [596663.813055]  free_task+0x5a/0x60
      [596663.813061]  kthread_stop+0xf3/0x100
      [596663.813103]  qla2x00_remove_one+0x284/0x440 [qla2xxx]
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarQuinn Tran <qutran@marvell.com>
      Signed-off-by: default avatarNilesh Javali <njavali@marvell.com>
      Link: https://lore.kernel.org/r/20241115130313.46826-3-njavali@marvell.com
      
      
      Reviewed-by: default avatarHimanshu Madhani <himanshu.madhani@oracle.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      12f04fc8
    • Anil Gurumurthy's avatar
      scsi: qla2xxx: Supported speed displayed incorrectly for VPorts · c87add0d
      Anil Gurumurthy authored
      
      commit e4e268f8 upstream.
      
      The fc_function_template for vports was missing the
      .show_host_supported_speeds. The base port had the same.
      
      Add .show_host_supported_speeds to the vport template as well.
      
      Cc: stable@vger.kernel.org
      Fixes: 2c3dfe3f ("[SCSI] qla2xxx: add support for NPIV")
      Signed-off-by: default avatarAnil Gurumurthy <agurumurthy@marvell.com>
      Signed-off-by: default avatarNilesh Javali <njavali@marvell.com>
      Link: https://lore.kernel.org/r/20241115130313.46826-7-njavali@marvell.com
      
      
      Reviewed-by: default avatarHimanshu Madhani <himanshu.madhani@oracle.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c87add0d
    • Quinn Tran's avatar
      scsi: qla2xxx: Fix NVMe and NPIV connect issue · 406e5732
      Quinn Tran authored
      
      commit 4812b779 upstream.
      
      NVMe controller fails to send connect command due to failure to locate
      hw context buffer for NVMe queue 0 (blk_mq_hw_ctx, hctx_idx=0). The
      cause of the issue is NPIV host did not initialize the vha->irq_offset
      field.  This field is given to blk-mq (blk_mq_pci_map_queues) to help
      locate the beginning of IO Queues which in turn help locate NVMe queue
      0.
      
      Initialize this field to allow NVMe to work properly with NPIV host.
      
       kernel: nvme nvme5: Connect command failed, errno: -18
       kernel: nvme nvme5: qid 0: secure concatenation is not supported
       kernel: nvme nvme5: NVME-FC{5}: create_assoc failed, assoc_id 2e9100 ret 401
       kernel: nvme nvme5: NVME-FC{5}: reset: Reconnect attempt failed (401)
       kernel: nvme nvme5: NVME-FC{5}: Reconnect attempt in 2 seconds
      
      Cc: stable@vger.kernel.org
      Fixes: f0783d43 ("scsi: qla2xxx: Use correct number of vectors for online CPUs")
      Signed-off-by: default avatarQuinn Tran <qutran@marvell.com>
      Signed-off-by: default avatarNilesh Javali <njavali@marvell.com>
      Link: https://lore.kernel.org/r/20241115130313.46826-6-njavali@marvell.com
      
      
      Reviewed-by: default avatarHimanshu Madhani <himanshu.madhani@oracle.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      406e5732
    • Sahas Leelodharry's avatar
      ALSA: hda/realtek: Add support for Samsung Galaxy Book3 360 (NP730QFG) · d7fd14dd
      Sahas Leelodharry authored
      
      commit e2974a22 upstream.
      
      Fixes the 3.5mm headphone jack on the Samsung Galaxy Book 3 360
      NP730QFG laptop.
      Unlike the other Galaxy Book3 series devices, this device only needs
      the ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET quirk.
      Verified changes on the device and compared with codec state in Windows.
      
      [ white-space fixes by tiwai ]
      
      Signed-off-by: default avatarSahas Leelodharry <sahas.leelodharry@mail.mcgill.ca>
      Cc: <stable@vger.kernel.org>
      Link: https://patch.msgid.link/QB1PR01MB40047D4CC1282DB7F1333124CC352@QB1PR01MB4004.CANPRD01.PROD.OUTLOOK.COM
      
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d7fd14dd
    • Nazar Bilinskyi's avatar
      ALSA: hda/realtek: Enable mute and micmute LED on HP ProBook 430 G8 · a59d39e4
      Nazar Bilinskyi authored
      
      commit 3a83f7ba upstream.
      
      HP ProBook 430 G8 has a mute and micmute LEDs that can be made to work
      using quirk ALC236_FIXUP_HP_GPIO_LED. Enable already existing quirk.
      
      Signed-off-by: default avatarNazar Bilinskyi <nbilinskyi@gmail.com>
      Cc: <stable@vger.kernel.org>
      Link: https://patch.msgid.link/20241130231631.8929-1-nbilinskyi@gmail.com
      
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a59d39e4
    • Marie Ramlow's avatar
      ALSA: usb-audio: add mixer mapping for Corsair HS80 · b3ebf8cb
      Marie Ramlow authored
      
      commit a7de2b87 upstream.
      
      The Corsair HS80 RGB Wireless is a USB headset with a mic and a sidetone
      feature. It has the same quirk as the Virtuoso series.
      This labels the mixers appropriately, so applications don't
      move the sidetone volume when they actually intend to move the main
      headset volume.
      
      Signed-off-by: default avatarMarie Ramlow <me@nycode.dev>
      cc: <stable@vger.kernel.org>
      Link: https://patch.msgid.link/20241130165240.17838-1-me@nycode.dev
      
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b3ebf8cb
    • Mark Rutland's avatar
      arm64: ptrace: fix partial SETREGSET for NT_ARM_TAGGED_ADDR_CTRL · 1152dd13
      Mark Rutland authored
      
      commit ca62d900 upstream.
      
      Currently tagged_addr_ctrl_set() doesn't initialize the temporary 'ctrl'
      variable, and a SETREGSET call with a length of zero will leave this
      uninitialized. Consequently tagged_addr_ctrl_set() will consume an
      arbitrary value, potentially leaking up to 64 bits of memory from the
      kernel stack. The read is limited to a specific slot on the stack, and
      the issue does not provide a write mechanism.
      
      As set_tagged_addr_ctrl() only accepts values where bits [63:4] zero and
      rejects other values, a partial SETREGSET attempt will randomly succeed
      or fail depending on the value of the uninitialized value, and the
      exposure is significantly limited.
      
      Fix this by initializing the temporary value before copying the regset
      from userspace, as for other regsets (e.g. NT_PRSTATUS, NT_PRFPREG,
      NT_ARM_SYSTEM_CALL). In the case of a zero-length write, the existing
      value of the tagged address ctrl will be retained.
      
      The NT_ARM_TAGGED_ADDR_CTRL regset is only visible in the
      user_aarch64_view used by a native AArch64 task to manipulate another
      native AArch64 task. As get_tagged_addr_ctrl() only returns an error
      value when called for a compat task, tagged_addr_ctrl_get() and
      tagged_addr_ctrl_set() should never observe an error value from
      get_tagged_addr_ctrl(). Add a WARN_ON_ONCE() to both to indicate that
      such an error would be unexpected, and error handlnig is not missing in
      either case.
      
      Fixes: 2200aa71 ("arm64: mte: ptrace: Add NT_ARM_TAGGED_ADDR_CTRL regset")
      Cc: <stable@vger.kernel.org> # 5.10.x
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Reviewed-by: default avatarMark Brown <broonie@kernel.org>
      Link: https://lore.kernel.org/r/20241205121655.1824269-2-mark.rutland@arm.com
      
      
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1152dd13
    • Kuan-Wei Chiu's avatar
      tracing: Fix cmp_entries_dup() to respect sort() comparison rules · 4a6f053a
      Kuan-Wei Chiu authored
      commit e63fbd5f upstream.
      
      The cmp_entries_dup() function used as the comparator for sort()
      violated the symmetry and transitivity properties required by the
      sorting algorithm. Specifically, it returned 1 whenever memcmp() was
      non-zero, which broke the following expectations:
      
      * Symmetry: If x < y, then y > x.
      * Transitivity: If x < y and y < z, then x < z.
      
      These violations could lead to incorrect sorting and failure to
      correctly identify duplicate elements.
      
      Fix the issue by directly returning the result of memcmp(), which
      adheres to the required comparison properties.
      
      Cc: stable@vger.kernel.org
      Fixes: 08d43a5f ("tracing: Add lock-free tracing_map")
      Link: https://lore.kernel.org/20241203202228.1274403-1-visitorckw@gmail.com
      
      
      Signed-off-by: default avatarKuan-Wei Chiu <visitorckw@gmail.com>
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4a6f053a
    • Alexander Sverdlin's avatar
      watchdog: rti: of: honor timeout-sec property · 4cbc202f
      Alexander Sverdlin authored
      
      commit 4962ee04 upstream.
      
      Currently "timeout-sec" Device Tree property is being silently ignored:
      even though watchdog_init_timeout() is being used, the driver always passes
      "heartbeat" == DEFAULT_HEARTBEAT == 60 as argument.
      
      Fix this by setting struct watchdog_device::timeout to DEFAULT_HEARTBEAT
      and passing real module parameter value to watchdog_init_timeout() (which
      may now be 0 if not specified).
      
      Cc: stable@vger.kernel.org
      Fixes: 2d63908b ("watchdog: Add K3 RTI watchdog support")
      Signed-off-by: default avatarAlexander Sverdlin <alexander.sverdlin@siemens.com>
      Reviewed-by: default avatarVignesh Raghavendra <vigneshr@ti.com>
      Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Link: https://lore.kernel.org/r/20241107203830.1068456-1-alexander.sverdlin@siemens.com
      
      
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarWim Van Sebroeck <wim@linux-watchdog.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4cbc202f
    • WangYuli's avatar
      HID: wacom: fix when get product name maybe null pointer · 5912a921
      WangYuli authored
      
      commit 59548215 upstream.
      
      Due to incorrect dev->product reporting by certain devices, null
      pointer dereferences occur when dev->product is empty, leading to
      potential system crashes.
      
      This issue was found on EXCELSIOR DL37-D05 device with
      Loongson-LS3A6000-7A2000-DL37 motherboard.
      
      Kernel logs:
      [   56.470885] usb 4-3: new full-speed USB device number 4 using ohci-pci
      [   56.671638] usb 4-3: string descriptor 0 read error: -22
      [   56.671644] usb 4-3: New USB device found, idVendor=056a, idProduct=0374, bcdDevice= 1.07
      [   56.671647] usb 4-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
      [   56.678839] hid-generic 0003:056A:0374.0004: hiddev0,hidraw3: USB HID v1.10 Device [HID 056a:0374] on usb-0000:00:05.0-3/input0
      [   56.697719] CPU 2 Unable to handle kernel paging request at virtual address 0000000000000000, era == 90000000066e35c8, ra == ffff800004f98a80
      [   56.697732] Oops[#1]:
      [   56.697734] CPU: 2 PID: 2742 Comm: (udev-worker) Tainted: G           OE      6.6.0-loong64-desktop #25.00.2000.015
      [   56.697737] Hardware name: Inspur CE520L2/C09901N000000000, BIOS 2.09.00 10/11/2024
      [   56.697739] pc 90000000066e35c8 ra ffff800004f98a80 tp 9000000125478000 sp 900000012547b8a0
      [   56.697741] a0 0000000000000000 a1 ffff800004818b28 a2 0000000000000000 a3 0000000000000000
      [   56.697743] a4 900000012547b8f0 a5 0000000000000000 a6 0000000000000000 a7 0000000000000000
      [   56.697745] t0 ffff800004818b2d t1 0000000000000000 t2 0000000000000003 t3 0000000000000005
      [   56.697747] t4 0000000000000000 t5 0000000000000000 t6 0000000000000000 t7 0000000000000000
      [   56.697748] t8 0000000000000000 u0 0000000000000000 s9 0000000000000000 s0 900000011aa48028
      [   56.697750] s1 0000000000000000 s2 0000000000000000 s3 ffff800004818e80 s4 ffff800004810000
      [   56.697751] s5 90000001000b98d0 s6 ffff800004811f88 s7 ffff800005470440 s8 0000000000000000
      [   56.697753]    ra: ffff800004f98a80 wacom_update_name+0xe0/0x300 [wacom]
      [   56.697802]   ERA: 90000000066e35c8 strstr+0x28/0x120
      [   56.697806]  CRMD: 000000b0 (PLV0 -IE -DA +PG DACF=CC DACM=CC -WE)
      [   56.697816]  PRMD: 0000000c (PPLV0 +PIE +PWE)
      [   56.697821]  EUEN: 00000000 (-FPE -SXE -ASXE -BTE)
      [   56.697827]  ECFG: 00071c1d (LIE=0,2-4,10-12 VS=7)
      [   56.697831] ESTAT: 00010000 [PIL] (IS= ECode=1 EsubCode=0)
      [   56.697835]  BADV: 0000000000000000
      [   56.697836]  PRID: 0014d000 (Loongson-64bit, Loongson-3A6000)
      [   56.697838] Modules linked in: wacom(+) bnep bluetooth rfkill qrtr nls_iso8859_1 nls_cp437 snd_hda_codec_conexant snd_hda_codec_generic ledtrig_audio snd_hda_codec_hdmi snd_hda_intel snd_intel_dspcfg snd_hda_codec snd_hda_core snd_hwdep snd_pcm snd_timer snd soundcore input_leds mousedev led_class joydev deepin_netmonitor(OE) fuse nfnetlink dmi_sysfs ip_tables x_tables overlay amdgpu amdxcp drm_exec gpu_sched drm_buddy radeon drm_suballoc_helper i2c_algo_bit drm_ttm_helper r8169 ttm drm_display_helper spi_loongson_pci xhci_pci cec xhci_pci_renesas spi_loongson_core hid_generic realtek gpio_loongson_64bit
      [   56.697887] Process (udev-worker) (pid: 2742, threadinfo=00000000aee0d8b4, task=00000000a9eff1f3)
      [   56.697890] Stack : 0000000000000000 ffff800004817e00 0000000000000000 0000251c00000000
      [   56.697896]         0000000000000000 00000011fffffffd 0000000000000000 0000000000000000
      [   56.697901]         0000000000000000 1b67a968695184b9 0000000000000000 90000001000b98d0
      [   56.697906]         90000001000bb8d0 900000011aa48028 0000000000000000 ffff800004f9d74c
      [   56.697911]         90000001000ba000 ffff800004f9ce58 0000000000000000 ffff800005470440
      [   56.697916]         ffff800004811f88 90000001000b98d0 9000000100da2aa8 90000001000bb8d0
      [   56.697921]         0000000000000000 90000001000ba000 900000011aa48028 ffff800004f9d74c
      [   56.697926]         ffff8000054704e8 90000001000bb8b8 90000001000ba000 0000000000000000
      [   56.697931]         90000001000bb8d0 9000000006307564 9000000005e666e0 90000001752359b8
      [   56.697936]         9000000008cbe400 900000000804d000 9000000005e666e0 0000000000000000
      [   56.697941]         ...
      [   56.697944] Call Trace:
      [   56.697945] [<90000000066e35c8>] strstr+0x28/0x120
      [   56.697950] [<ffff800004f98a80>] wacom_update_name+0xe0/0x300 [wacom]
      [   56.698000] [<ffff800004f9ce58>] wacom_parse_and_register+0x338/0x900 [wacom]
      [   56.698050] [<ffff800004f9d74c>] wacom_probe+0x32c/0x420 [wacom]
      [   56.698099] [<9000000006307564>] hid_device_probe+0x144/0x260
      [   56.698103] [<9000000005e65d68>] really_probe+0x208/0x540
      [   56.698109] [<9000000005e661dc>] __driver_probe_device+0x13c/0x1e0
      [   56.698112] [<9000000005e66620>] driver_probe_device+0x40/0x100
      [   56.698116] [<9000000005e6680c>] __device_attach_driver+0x12c/0x180
      [   56.698119] [<9000000005e62bc8>] bus_for_each_drv+0x88/0x160
      [   56.698123] [<9000000005e66468>] __device_attach+0x108/0x260
      [   56.698126] [<9000000005e63918>] device_reprobe+0x78/0x100
      [   56.698129] [<9000000005e62a68>] bus_for_each_dev+0x88/0x160
      [   56.698132] [<9000000006304e54>] __hid_bus_driver_added+0x34/0x80
      [   56.698134] [<9000000005e62bc8>] bus_for_each_drv+0x88/0x160
      [   56.698137] [<9000000006304df0>] __hid_register_driver+0x70/0xa0
      [   56.698142] [<9000000004e10fe4>] do_one_initcall+0x104/0x320
      [   56.698146] [<9000000004f38150>] do_init_module+0x90/0x2c0
      [   56.698151] [<9000000004f3a3d8>] init_module_from_file+0xb8/0x120
      [   56.698155] [<9000000004f3a590>] idempotent_init_module+0x150/0x3a0
      [   56.698159] [<9000000004f3a890>] sys_finit_module+0xb0/0x140
      [   56.698163] [<900000000671e4e8>] do_syscall+0x88/0xc0
      [   56.698166] [<9000000004e12404>] handle_syscall+0xc4/0x160
      [   56.698171] Code: 0011958f  00150224  5800cd85 <2a00022c> 00150004  4000c180  0015022c  03400000  03400000
      [   56.698192] ---[ end trace 0000000000000000 ]---
      
      Fixes: 09dc28ac ("HID: wacom: Improve generic name generation")
      Reported-by: default avatarZhenxing Chen <chenzhenxing@uniontech.com>
      Co-developed-by: default avatarXu Rao <raoxu@uniontech.com>
      Signed-off-by: default avatarXu Rao <raoxu@uniontech.com>
      Signed-off-by: default avatarWangYuli <wangyuli@uniontech.com>
      Link: https://patch.msgid.link/B31757FE8E1544CF+20241125052616.18261-1-wangyuli@uniontech.com
      
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarBenjamin Tissoires <bentiss@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5912a921
    • Hou Tao's avatar
      bpf: Fix exact match conditions in trie_get_next_key() · 43c6d763
      Hou Tao authored
      
      [ Upstream commit 27abc7b3 ]
      
      trie_get_next_key() uses node->prefixlen == key->prefixlen to identify
      an exact match, However, it is incorrect because when the target key
      doesn't fully match the found node (e.g., node->prefixlen != matchlen),
      these two nodes may also have the same prefixlen. It will return
      expected result when the passed key exist in the trie. However when a
      recently-deleted key or nonexistent key is passed to
      trie_get_next_key(), it may skip keys and return incorrect result.
      
      Fix it by using node->prefixlen == matchlen to identify exact matches.
      When the condition is true after the search, it also implies
      node->prefixlen equals key->prefixlen, otherwise, the search would
      return NULL instead.
      
      Fixes: b471f2f1 ("bpf: implement MAP_GET_NEXT_KEY command for LPM_TRIE map")
      Reviewed-by: default avatarToke Høiland-Jørgensen <toke@redhat.com>
      Signed-off-by: default avatarHou Tao <houtao1@huawei.com>
      Link: https://lore.kernel.org/r/20241206110622.1161752-6-houtao@huaweicloud.com
      
      
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      43c6d763
    • Hou Tao's avatar
      bpf: Handle BPF_EXIST and BPF_NOEXIST for LPM trie · adb4a970
      Hou Tao authored
      
      [ Upstream commit eae6a075 ]
      
      Add the currently missing handling for the BPF_EXIST and BPF_NOEXIST
      flags. These flags can be specified by users and are relevant since LPM
      trie supports exact matches during update.
      
      Fixes: b95a5c4d ("bpf: add a longest prefix match trie map implementation")
      Reviewed-by: default avatarToke Høiland-Jørgensen <toke@redhat.com>
      Acked-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Signed-off-by: default avatarHou Tao <houtao1@huawei.com>
      Link: https://lore.kernel.org/r/20241206110622.1161752-4-houtao@huaweicloud.com
      
      
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      adb4a970
    • Tetsuo Handa's avatar
      ocfs2: free inode when ocfs2_get_init_inode() fails · 9c19ea59
      Tetsuo Handa authored
      [ Upstream commit 965b5dd1 ]
      
      syzbot is reporting busy inodes after unmount, for commit 9c89fe0a
      ("ocfs2: Handle error from dquot_initialize()") forgot to call iput() when
      new_inode() succeeded and dquot_initialize() failed.
      
      Link: https://lkml.kernel.org/r/e68c0224-b7c6-4784-b4fa-a9fc8c675525@I-love.SAKURA.ne.jp
      
      
      Fixes: 9c89fe0a ("ocfs2: Handle error from dquot_initialize()")
      Signed-off-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Reported-by: default avatar <syzbot+0af00f6a2cba2058b5db@syzkaller.appspotmail.com>
      Closes: https://syzkaller.appspot.com/bug?extid=0af00f6a2cba2058b5db
      
      
      Tested-by: default avatar <syzbot+0af00f6a2cba2058b5db@syzkaller.appspotmail.com>
      Reviewed-by: default avatarJoseph Qi <joseph.qi@linux.alibaba.com>
      Cc: Mark Fasheh <mark@fasheh.com>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: Junxiao Bi <junxiao.bi@oracle.com>
      Cc: Changwei Ge <gechangwei@live.cn>
      Cc: Jun Piao <piaojun@huawei.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9c19ea59
    • Pei Xiao's avatar
      spi: mpc52xx: Add cancel_work_sync before module remove · e0c6ce84
      Pei Xiao authored
      
      [ Upstream commit 98483662 ]
      
      If we remove the module which will call mpc52xx_spi_remove
      it will free 'ms' through spi_unregister_controller.
      while the work ms->work will be used. The sequence of operations
      that may lead to a UAF bug.
      
      Fix it by ensuring that the work is canceled before proceeding with
      the cleanup in mpc52xx_spi_remove.
      
      Fixes: ca632f55 ("spi: reorganize drivers")
      Signed-off-by: default avatarPei Xiao <xiaopei01@kylinos.cn>
      Link: https://patch.msgid.link/1f16f8ae0e50ca9adb1dc849bf2ac65a40c9ceb9.1732783000.git.xiaopei01@kylinos.cn
      
      
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e0c6ce84
    • Zijian Zhang's avatar
      tcp_bpf: Fix the sk_mem_uncharge logic in tcp_bpf_sendmsg · dbedc7e1
      Zijian Zhang authored
      
      [ Upstream commit ca70b8ba ]
      
      The current sk memory accounting logic in __SK_REDIRECT is pre-uncharging
      tosend bytes, which is either msg->sg.size or a smaller value apply_bytes.
      
      Potential problems with this strategy are as follows:
      
      - If the actual sent bytes are smaller than tosend, we need to charge some
        bytes back, as in line 487, which is okay but seems not clean.
      
      - When tosend is set to apply_bytes, as in line 417, and (ret < 0), we may
        miss uncharging (msg->sg.size - apply_bytes) bytes.
      
      [...]
      415 tosend = msg->sg.size;
      416 if (psock->apply_bytes && psock->apply_bytes < tosend)
      417   tosend = psock->apply_bytes;
      [...]
      443 sk_msg_return(sk, msg, tosend);
      444 release_sock(sk);
      446 origsize = msg->sg.size;
      447 ret = tcp_bpf_sendmsg_redir(sk_redir, redir_ingress,
      448                             msg, tosend, flags);
      449 sent = origsize - msg->sg.size;
      [...]
      454 lock_sock(sk);
      455 if (unlikely(ret < 0)) {
      456   int free = sk_msg_free_nocharge(sk, msg);
      458   if (!cork)
      459     *copied -= free;
      460 }
      [...]
      487 if (eval == __SK_REDIRECT)
      488   sk_mem_charge(sk, tosend - sent);
      [...]
      
      When running the selftest test_txmsg_redir_wait_sndmem with txmsg_apply,
      the following warning will be reported:
      
      ------------[ cut here ]------------
      WARNING: CPU: 6 PID: 57 at net/ipv4/af_inet.c:156 inet_sock_destruct+0x190/0x1a0
      Modules linked in:
      CPU: 6 UID: 0 PID: 57 Comm: kworker/6:0 Not tainted 6.12.0-rc1.bm.1-amd64+ #43
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014
      Workqueue: events sk_psock_destroy
      RIP: 0010:inet_sock_destruct+0x190/0x1a0
      RSP: 0018:ffffad0a8021fe08 EFLAGS: 00010206
      RAX: 0000000000000011 RBX: ffff9aab4475b900 RCX: ffff9aab481a0800
      RDX: 0000000000000303 RSI: 0000000000000011 RDI: ffff9aab4475b900
      RBP: ffff9aab4475b990 R08: 0000000000000000 R09: ffff9aab40050ec0
      R10: 0000000000000000 R11: ffff9aae6fdb1d01 R12: ffff9aab49c60400
      R13: ffff9aab49c60598 R14: ffff9aab49c60598 R15: dead000000000100
      FS:  0000000000000000(0000) GS:ffff9aae6fd80000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00007ffec7e47bd8 CR3: 00000001a1a1c004 CR4: 0000000000770ef0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      PKRU: 55555554
      Call Trace:
      <TASK>
      ? __warn+0x89/0x130
      ? inet_sock_destruct+0x190/0x1a0
      ? report_bug+0xfc/0x1e0
      ? handle_bug+0x5c/0xa0
      ? exc_invalid_op+0x17/0x70
      ? asm_exc_invalid_op+0x1a/0x20
      ? inet_sock_destruct+0x190/0x1a0
      __sk_destruct+0x25/0x220
      sk_psock_destroy+0x2b2/0x310
      process_scheduled_works+0xa3/0x3e0
      worker_thread+0x117/0x240
      ? __pfx_worker_thread+0x10/0x10
      kthread+0xcf/0x100
      ? __pfx_kthread+0x10/0x10
      ret_from_fork+0x31/0x40
      ? __pfx_kthread+0x10/0x10
      ret_from_fork_asm+0x1a/0x30
      </TASK>
      ---[ end trace 0000000000000000 ]---
      
      In __SK_REDIRECT, a more concise way is delaying the uncharging after sent
      bytes are finalized, and uncharge this value. When (ret < 0), we shall
      invoke sk_msg_free.
      
      Same thing happens in case __SK_DROP, when tosend is set to apply_bytes,
      we may miss uncharging (msg->sg.size - apply_bytes) bytes. The same
      warning will be reported in selftest.
      
      [...]
      468 case __SK_DROP:
      469 default:
      470 sk_msg_free_partial(sk, msg, tosend);
      471 sk_msg_apply_bytes(psock, tosend);
      472 *copied -= (tosend + delta);
      473 return -EACCES;
      [...]
      
      So instead of sk_msg_free_partial we can do sk_msg_free here.
      
      Fixes: 604326b4 ("bpf, sockmap: convert to generic sk_msg interface")
      Fixes: 8ec95b94 ("bpf, sockmap: Fix the sk->sk_forward_alloc warning of sk_stream_kill_queues")
      Signed-off-by: default avatarZijian Zhang <zijianzhang@bytedance.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Link: https://lore.kernel.org/bpf/20241016234838.3167769-3-zijianzhang@bytedance.com
      
      
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      dbedc7e1
    • Pei Xiao's avatar
      drm/sti: Add __iomem for mixer_dbg_mxn's parameter · 8cd416aa
      Pei Xiao authored
      
      [ Upstream commit 86e8f947 ]
      
      Sparse complains about incorrect type in argument 1.
      expected void const volatile  __iomem *ptr but got void *.
      so modify mixer_dbg_mxn's addr parameter.
      
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Closes: https://lore.kernel.org/oe-kbuild-all/202411191809.6V3c826r-lkp@intel.com/
      
      
      Fixes: a5f81078 ("drm/sti: add debugfs entries for MIXER crtc")
      Signed-off-by: default avatarPei Xiao <xiaopei01@kylinos.cn>
      Acked-by: default avatarRaphael Gallais-Pou <rgallaispou@gmail.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/c28f0dcb6a4526721d83ba1f659bba30564d3d54.1732087094.git.xiaopei01@kylinos.cn
      
      
      Signed-off-by: default avatarRaphael Gallais-Pou <raphael.gallais-pou@foss.st.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      8cd416aa
    • Frank Li's avatar
      i3c: master: Fix dynamic address leak when 'assigned-address' is present · 7fd09abc
      Frank Li authored
      
      [ Upstream commit 851bd21c ]
      
      If the DTS contains 'assigned-address', a dynamic address leak occurs
      during hotjoin events.
      
      Assume a device have assigned-address 0xb.
        - Device issue Hotjoin
        - Call i3c_master_do_daa()
        - Call driver xxx_do_daa()
        - Call i3c_master_get_free_addr() to get dynamic address 0x9
        - i3c_master_add_i3c_dev_locked(0x9)
        -     expected_dyn_addr  = newdev->boardinfo->init_dyn_addr (0xb);
        -     i3c_master_reattach_i3c_dev(newdev(0xb), old_dyn_addr(0x9));
        -         if (dev->info.dyn_addr != old_dyn_addr &&
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 0xb != 0x9 -> TRUE
                      (!dev->boardinfo ||
                       ^^^^^^^^^^^^^^^ ->  FALSE
                       dev->info.dyn_addr != dev->boardinfo->init_dyn_addr)) {
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                       0xb != 0xb      ->  FALSE
                       ...
                       i3c_bus_set_addr_slot_status(&master->bus, old_dyn_addr,
                                                           I3C_ADDR_SLOT_FREE);
      		 ^^^
                       This will be skipped. So old_dyn_addr never free
                  }
      
        - i3c_master_get_free_addr() will return increased sequence number.
      
      Remove dev->info.dyn_addr != dev->boardinfo->init_dyn_addr condition check.
      dev->info.dyn_addr should be checked before calling this function because
      i3c_master_setnewda_locked() has already been called and the target device
      has already accepted dyn_addr. It is too late to check if dyn_addr is free
      in i3c_master_reattach_i3c_dev().
      
      Add check to ensure expected_dyn_addr is free before
      i3c_master_setnewda_locked().
      
      Fixes: cc3a392d ("i3c: master: fix for SETDASA and DAA process")
      Cc: stable@kernel.org
      Reviewed-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
      Signed-off-by: default avatarFrank Li <Frank.Li@nxp.com>
      Link: https://lore.kernel.org/r/20241021-i3c_dts_assign-v8-3-4098b8bde01e@nxp.com
      
      
      Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      7fd09abc
    • Frank Li's avatar
      i3c: master: Extend address status bit to 4 and add I3C_ADDR_SLOT_EXT_DESIRED · b70ba15c
      Frank Li authored
      
      [ Upstream commit 2f552fa2 ]
      
      Extend the address status bit to 4 and introduce the
      I3C_ADDR_SLOT_EXT_DESIRED macro to indicate that a device prefers a
      specific address. This is generally set by the 'assigned-address' in the
      device tree source (dts) file.
      
       ┌────┬─────────────┬───┬─────────┬───┐
       │S/Sr│ 7'h7E RnW=0 │ACK│ ENTDAA  │ T ├────┐
       └────┴─────────────┴───┴─────────┴───┘    │
       ┌─────────────────────────────────────────┘
       │  ┌──┬─────────────┬───┬─────────────────┬────────────────┬───┬─────────┐
       └─►│Sr│7'h7E RnW=1  │ACK│48bit UID BCR DCR│Assign 7bit Addr│PAR│ ACK/NACK│
          └──┴─────────────┴───┴─────────────────┴────────────────┴───┴─────────┘
      
      Some master controllers (such as HCI) need to prepare the entire above
      transaction before sending it out to the I3C bus. This means that a 7-bit
      dynamic address needs to be allocated before knowing the target device's
      UID information.
      
      However, some I3C targets may request specific addresses (called as
      "init_dyn_addr"), which is typically specified by the DT-'s
      assigned-address property. Lower addresses having higher IBI priority. If
      it is available, i3c_bus_get_free_addr() preferably return a free address
      that is not in the list of desired addresses (called as "init_dyn_addr").
      This allows the device with the "init_dyn_addr" to switch to its
      "init_dyn_addr" when it hot-joins the I3C bus. Otherwise, if the
      "init_dyn_addr" is already in use by another I3C device, the target device
      will not be able to switch to its desired address.
      
      If the previous step fails, fallback returning one of the remaining
      unassigned address, regardless of its state in the desired list.
      
      Reviewed-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
      Signed-off-by: default avatarFrank Li <Frank.Li@nxp.com>
      Link: https://lore.kernel.org/r/20241021-i3c_dts_assign-v8-2-4098b8bde01e@nxp.com
      
      
      Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
      Stable-dep-of: 851bd21c ("i3c: master: Fix dynamic address leak when 'assigned-address' is present")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b70ba15c
    • Frank Li's avatar
      i3c: master: Replace hard code 2 with macro I3C_ADDR_SLOT_STATUS_BITS · 1c47272e
      Frank Li authored
      
      [ Upstream commit 16aed0a6 ]
      
      Replace the hardcoded value 2, which indicates 2 bits for I3C address
      status, with the predefined macro I3C_ADDR_SLOT_STATUS_BITS.
      
      Improve maintainability and extensibility of the code.
      
      Reviewed-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
      Signed-off-by: default avatarFrank Li <Frank.Li@nxp.com>
      Link: https://lore.kernel.org/r/20241021-i3c_dts_assign-v8-1-4098b8bde01e@nxp.com
      
      
      Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
      Stable-dep-of: 851bd21c ("i3c: master: Fix dynamic address leak when 'assigned-address' is present")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1c47272e
    • Jamie Iles's avatar
      i3c: fix incorrect address slot lookup on 64-bit · 3aecd6fd
      Jamie Iles authored
      
      [ Upstream commit f18f9811 ]
      
      The address slot bitmap is an array of unsigned long's which are the
      same size as an int on 32-bit platforms but not 64-bit.  Loading the
      bitmap into an int could result in the incorrect status being returned
      for a slot and slots being reported as the wrong status.
      
      Fixes: 3a379bbc ("i3c: Add core I3C infrastructure")
      Cc: Boris Brezillon <bbrezillon@kernel.org>
      Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
      Signed-off-by: default avatarJamie Iles <quic_jiles@quicinc.com>
      Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
      Link: https://lore.kernel.org/r/20210922165600.179394-1-quic_jiles@quicinc.com
      
      
      Stable-dep-of: 851bd21c ("i3c: master: Fix dynamic address leak when 'assigned-address' is present")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3aecd6fd
    • Michal Simek's avatar
      dt-bindings: serial: rs485: Fix rs485-rts-delay property · fbb3aa94
      Michal Simek authored
      
      [ Upstream commit 12b3642b ]
      
      Code expects array only with 2 items which should be checked.
      But also item checking is not working as it should likely because of
      incorrect items description.
      
      Fixes: d50f974c ("dt-bindings: serial: Convert rs485 bindings to json-schema")
      Signed-off-by: default avatarMichal Simek <michal.simek@amd.com>
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarKrzysztof Kozlowski <krzk@kernel.org>
      Link: https://lore.kernel.org/r/820c639b9e22fe037730ed44d1b044cdb6d28b75.1726480384.git.michal.simek@amd.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      fbb3aa94
    • Lino Sanfilippo's avatar
      dt_bindings: rs485: Correct delay values · 0da0be3b
      Lino Sanfilippo authored
      
      [ Upstream commit 885dcb08 ]
      
      Currently the documentation claims that a maximum of 1000 msecs is allowed
      for RTS delays. However nothing actually checks the values read from device
      tree/ACPI and so it is possible to set much higher values.
      
      There is already a maximum of 100 ms enforced for RTS delays that are set
      via the UART TIOCSRS485 ioctl. To be consistent with that use the same
      limit for DT/ACPI values.
      
      Although this change is visible to userspace the risk of breaking anything
      when reducing the max delays from 1000 to 100 ms should be very low, since
      100 ms is already a very high maximum for delays that are usually rather in
      the usecs range.
      
      Acked-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarLino Sanfilippo <l.sanfilippo@kunbus.com>
      Link: https://lore.kernel.org/r/20220710164442.2958979-7-LinoSanfilippo@gmx.de
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Stable-dep-of: 12b3642b ("dt-bindings: serial: rs485: Fix rs485-rts-delay property")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0da0be3b
    • Charles Han's avatar
      gpio: grgpio: Add NULL check in grgpio_probe · 4733f68e
      Charles Han authored
      
      [ Upstream commit 050b23d0 ]
      
      devm_kasprintf() can return a NULL pointer on failure,but this
      returned value in grgpio_probe is not checked.
      Add NULL check in grgpio_probe, to handle kernel NULL
      pointer dereference error.
      
      Cc: stable@vger.kernel.org
      Fixes: 7eb6ce2f ("gpio: Convert to using %pOF instead of full_name")
      Signed-off-by: default avatarCharles Han <hanchunchao@inspur.com>
      Link: https://lore.kernel.org/r/20241114091822.78199-1-hanchunchao@inspur.com
      
      
      Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4733f68e
    • Bartosz Golaszewski's avatar
      gpio: grgpio: use a helper variable to store the address of ofdev->dev · c8e3aa36
      Bartosz Golaszewski authored
      [ Upstream commit d036ae41 ]
      
      Instead of dereferencing the platform device pointer repeatedly, just
      store its address in a helper variable.
      
      Link: https://lore.kernel.org/r/20241015131832.44678-3-brgl@bgdev.pl
      
      
      Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
      Stable-dep-of: 050b23d0 ("gpio: grgpio: Add NULL check in grgpio_probe")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c8e3aa36
    • Eric Dumazet's avatar
      geneve: do not assume mac header is set in geneve_xmit_skb() · d9fa09ca
      Eric Dumazet authored
      
      [ Upstream commit 8588c99c ]
      
      We should not assume mac header is set in output path.
      
      Use skb_eth_hdr() instead of eth_hdr() to fix the issue.
      
      sysbot reported the following :
      
       WARNING: CPU: 0 PID: 11635 at include/linux/skbuff.h:3052 skb_mac_header include/linux/skbuff.h:3052 [inline]
       WARNING: CPU: 0 PID: 11635 at include/linux/skbuff.h:3052 eth_hdr include/linux/if_ether.h:24 [inline]
       WARNING: CPU: 0 PID: 11635 at include/linux/skbuff.h:3052 geneve_xmit_skb drivers/net/geneve.c:898 [inline]
       WARNING: CPU: 0 PID: 11635 at include/linux/skbuff.h:3052 geneve_xmit+0x4c38/0x5730 drivers/net/geneve.c:1039
      Modules linked in:
      CPU: 0 UID: 0 PID: 11635 Comm: syz.4.1423 Not tainted 6.12.0-syzkaller-10296-gaaf20f870da0 #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
       RIP: 0010:skb_mac_header include/linux/skbuff.h:3052 [inline]
       RIP: 0010:eth_hdr include/linux/if_ether.h:24 [inline]
       RIP: 0010:geneve_xmit_skb drivers/net/geneve.c:898 [inline]
       RIP: 0010:geneve_xmit+0x4c38/0x5730 drivers/net/geneve.c:1039
      Code: 21 c6 02 e9 35 d4 ff ff e8 a5 48 4c fb 90 0f 0b 90 e9 fd f5 ff ff e8 97 48 4c fb 90 0f 0b 90 e9 d8 f5 ff ff e8 89 48 4c fb 90 <0f> 0b 90 e9 41 e4 ff ff e8 7b 48 4c fb 90 0f 0b 90 e9 cd e7 ff ff
      RSP: 0018:ffffc90003b2f870 EFLAGS: 00010283
      RAX: 000000000000037a RBX: 000000000000ffff RCX: ffffc9000dc3d000
      RDX: 0000000000080000 RSI: ffffffff86428417 RDI: 0000000000000003
      RBP: ffffc90003b2f9f0 R08: 0000000000000003 R09: 000000000000ffff
      R10: 000000000000ffff R11: 0000000000000002 R12: ffff88806603c000
      R13: 0000000000000000 R14: ffff8880685b2780 R15: 0000000000000e23
      FS:  00007fdc2deed6c0(0000) GS:ffff8880b8600000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000001b30a1dff8 CR3: 0000000056b8c000 CR4: 00000000003526f0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       <TASK>
        __netdev_start_xmit include/linux/netdevice.h:5002 [inline]
        netdev_start_xmit include/linux/netdevice.h:5011 [inline]
        __dev_direct_xmit+0x58a/0x720 net/core/dev.c:4490
        dev_direct_xmit include/linux/netdevice.h:3181 [inline]
        packet_xmit+0x1e4/0x360 net/packet/af_packet.c:285
        packet_snd net/packet/af_packet.c:3146 [inline]
        packet_sendmsg+0x2700/0x5660 net/packet/af_packet.c:3178
        sock_sendmsg_nosec net/socket.c:711 [inline]
        __sock_sendmsg net/socket.c:726 [inline]
        __sys_sendto+0x488/0x4f0 net/socket.c:2197
        __do_sys_sendto net/socket.c:2204 [inline]
        __se_sys_sendto net/socket.c:2200 [inline]
        __x64_sys_sendto+0xe0/0x1c0 net/socket.c:2200
        do_syscall_x64 arch/x86/entry/common.c:52 [inline]
        do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f
      
      Fixes: a025fb5f ("geneve: Allow configuration of DF behaviour")
      Reported-by: default avatar <syzbot+3ec5271486d7cb2d242a@syzkaller.appspotmail.com>
      Closes: https://lore.kernel.org/netdev/674f4b72.050a0220.17bd51.004a.GAE@google.com/T/#u
      
      
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reviewed-by: default avatarStefano Brivio <sbrivio@redhat.com>
      Link: https://patch.msgid.link/20241203182122.2725517-1-edumazet@google.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d9fa09ca
    • Kory Maincent's avatar
      ethtool: Fix wrong mod state in case of verbose and no_mask bitset · d93efe18
      Kory Maincent authored
      
      [ Upstream commit 910c4788 ]
      
      A bitset without mask in a _SET request means we want exactly the bits in
      the bitset to be set. This works correctly for compact format but when
      verbose format is parsed, ethnl_update_bitset32_verbose() only sets the
      bits present in the request bitset but does not clear the rest. The commit
      66991703 ("ethtool: fix application of verbose no_mask bitset") fixes
      this issue by clearing the whole target bitmap before we start iterating.
      The solution proposed brought an issue with the behavior of the mod
      variable. As the bitset is always cleared the old value will always
      differ to the new value.
      
      Fix it by adding a new function to compare bitmaps and a temporary variable
      which save the state of the old bitmap.
      
      Fixes: 66991703 ("ethtool: fix application of verbose no_mask bitset")
      Signed-off-by: default avatarKory Maincent <kory.maincent@bootlin.com>
      Link: https://patch.msgid.link/20241202153358.1142095-1-kory.maincent@bootlin.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d93efe18
    • Pablo Neira Ayuso's avatar
      netfilter: nft_set_hash: skip duplicated elements pending gc run · e2185509
      Pablo Neira Ayuso authored
      
      [ Upstream commit 7ffc7481 ]
      
      rhashtable does not provide stable walk, duplicated elements are
      possible in case of resizing. I considered that checking for errors when
      calling rhashtable_walk_next() was sufficient to detect the resizing.
      However, rhashtable_walk_next() returns -EAGAIN only at the end of the
      iteration, which is too late, because a gc work containing duplicated
      elements could have been already scheduled for removal to the worker.
      
      Add a u32 gc worker sequence number per set, bump it on every workqueue
      run. Annotate gc worker sequence number on the expired element. Use it
      to skip those already seen in this gc workqueue run.
      
      Note that this new field is never reset in case gc transaction fails, so
      next gc worker run on the expired element overrides it. Wraparound of gc
      worker sequence number should not be an issue with stale gc worker
      sequence number in the element, that would just postpone the element
      removal in one gc run.
      
      Note that it is not possible to use flags to annotate that element is
      pending gc run to detect duplicates, given that gc transaction can be
      invalidated in case of update from the control plane, therefore, not
      allowing to clear such flag.
      
      On x86_64, pahole reports no changes in the size of nft_rhash_elem.
      
      Fixes: f6c383b8 ("netfilter: nf_tables: adapt set backend to use GC transaction API")
      Reported-by: default avatarLaurent Fasnacht <laurent.fasnacht@proton.ch>
      Tested-by: default avatarLaurent Fasnacht <laurent.fasnacht@proton.ch>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e2185509
    • Phil Sutter's avatar
      netfilter: ipset: Hold module reference while requesting a module · 6099b5d3
      Phil Sutter authored
      
      [ Upstream commit 456f010b ]
      
      User space may unload ip_set.ko while it is itself requesting a set type
      backend module, leading to a kernel crash. The race condition may be
      provoked by inserting an mdelay() right after the nfnl_unlock() call.
      
      Fixes: a7b4f989 ("netfilter: ipset: IP set core support")
      Signed-off-by: default avatarPhil Sutter <phil@nwl.cc>
      Acked-by: default avatarJozsef Kadlecsik <kadlec@netfilter.org>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6099b5d3
    • Xin Long's avatar
      net: sched: fix erspan_opt settings in cls_flower · 98ea587a
      Xin Long authored
      
      [ Upstream commit 29220780 ]
      
      When matching erspan_opt in cls_flower, only the (version, dir, hwid)
      fields are relevant. However, in fl_set_erspan_opt() it initializes
      all bits of erspan_opt and its mask to 1. This inadvertently requires
      packets to match not only the (version, dir, hwid) fields but also the
      other fields that are unexpectedly set to 1.
      
      This patch resolves the issue by ensuring that only the (version, dir,
      hwid) fields are configured in fl_set_erspan_opt(), leaving the other
      fields to 0 in erspan_opt.
      
      Fixes: 79b1011c ("net: sched: allow flower to match erspan options")
      Reported-by: default avatarShuang Li <shuali@redhat.com>
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Reviewed-by: default avatarCong Wang <cong.wang@bytedance.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      98ea587a
    • Yuan Can's avatar
      igb: Fix potential invalid memory access in igb_init_module() · e0155b1b
      Yuan Can authored
      
      [ Upstream commit 0566f83d ]
      
      The pci_register_driver() can fail and when this happened, the dca_notifier
      needs to be unregistered, otherwise the dca_notifier can be called when
      igb fails to install, resulting to invalid memory access.
      
      Fixes: bbd98fe4 ("igb: Fix DCA errors and do not use context index for 82576")
      Signed-off-by: default avatarYuan Can <yuancan@huawei.com>
      Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e0155b1b
    • Louis Leseur's avatar
      net/qed: allow old cards not supporting "num_images" to work · 9da327f2
      Louis Leseur authored
      
      [ Upstream commit 7a0ea70d ]
      
      Commit 43645ce0 ("qed: Populate nvm image attribute shadow.")
      added support for populating flash image attributes, notably
      "num_images". However, some cards were not able to return this
      information. In such cases, the driver would return EINVAL, causing the
      driver to exit.
      
      Add check to return EOPNOTSUPP instead of EINVAL when the card is not
      able to return these information. The caller function already handles
      EOPNOTSUPP without error.
      
      Fixes: 43645ce0 ("qed: Populate nvm image attribute shadow.")
      Co-developed-by: default avatarFlorian Forestier <florian@forestier.re>
      Signed-off-by: default avatarFlorian Forestier <florian@forestier.re>
      Signed-off-by: default avatarLouis Leseur <louis.leseur@gmail.com>
      Link: https://patch.msgid.link/20241128083633.26431-1-louis.leseur@gmail.com
      
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9da327f2
    • Kuniyuki Iwashima's avatar
      tipc: Fix use-after-free of kernel socket in cleanup_bearer(). · 650ee9a2
      Kuniyuki Iwashima authored
      
      [ Upstream commit 6a2fa133 ]
      
      syzkaller reported a use-after-free of UDP kernel socket
      in cleanup_bearer() without repro. [0][1]
      
      When bearer_disable() calls tipc_udp_disable(), cleanup
      of the UDP kernel socket is deferred by work calling
      cleanup_bearer().
      
      tipc_net_stop() waits for such works to finish by checking
      tipc_net(net)->wq_count.  However, the work decrements the
      count too early before releasing the kernel socket,
      unblocking cleanup_net() and resulting in use-after-free.
      
      Let's move the decrement after releasing the socket in
      cleanup_bearer().
      
      [0]:
      ref_tracker: net notrefcnt@000000009b3d1faf has 1/1 users at
           sk_alloc+0x438/0x608
           inet_create+0x4c8/0xcb0
           __sock_create+0x350/0x6b8
           sock_create_kern+0x58/0x78
           udp_sock_create4+0x68/0x398
           udp_sock_create+0x88/0xc8
           tipc_udp_enable+0x5e8/0x848
           __tipc_nl_bearer_enable+0x84c/0xed8
           tipc_nl_bearer_enable+0x38/0x60
           genl_family_rcv_msg_doit+0x170/0x248
           genl_rcv_msg+0x400/0x5b0
           netlink_rcv_skb+0x1dc/0x398
           genl_rcv+0x44/0x68
           netlink_unicast+0x678/0x8b0
           netlink_sendmsg+0x5e4/0x898
           ____sys_sendmsg+0x500/0x830
      
      [1]:
      BUG: KMSAN: use-after-free in udp_hashslot include/net/udp.h:85 [inline]
      BUG: KMSAN: use-after-free in udp_lib_unhash+0x3b8/0x930 net/ipv4/udp.c:1979
       udp_hashslot include/net/udp.h:85 [inline]
       udp_lib_unhash+0x3b8/0x930 net/ipv4/udp.c:1979
       sk_common_release+0xaf/0x3f0 net/core/sock.c:3820
       inet_release+0x1e0/0x260 net/ipv4/af_inet.c:437
       inet6_release+0x6f/0xd0 net/ipv6/af_inet6.c:489
       __sock_release net/socket.c:658 [inline]
       sock_release+0xa0/0x210 net/socket.c:686
       cleanup_bearer+0x42d/0x4c0 net/tipc/udp_media.c:819
       process_one_work kernel/workqueue.c:3229 [inline]
       process_scheduled_works+0xcaf/0x1c90 kernel/workqueue.c:3310
       worker_thread+0xf6c/0x1510 kernel/workqueue.c:3391
       kthread+0x531/0x6b0 kernel/kthread.c:389
       ret_from_fork+0x60/0x80 arch/x86/kernel/process.c:147
       ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:244
      
      Uninit was created at:
       slab_free_hook mm/slub.c:2269 [inline]
       slab_free mm/slub.c:4580 [inline]
       kmem_cache_free+0x207/0xc40 mm/slub.c:4682
       net_free net/core/net_namespace.c:454 [inline]
       cleanup_net+0x16f2/0x19d0 net/core/net_namespace.c:647
       process_one_work kernel/workqueue.c:3229 [inline]
       process_scheduled_works+0xcaf/0x1c90 kernel/workqueue.c:3310
       worker_thread+0xf6c/0x1510 kernel/workqueue.c:3391
       kthread+0x531/0x6b0 kernel/kthread.c:389
       ret_from_fork+0x60/0x80 arch/x86/kernel/process.c:147
       ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:244
      
      CPU: 0 UID: 0 PID: 54 Comm: kworker/0:2 Not tainted 6.12.0-rc1-00131-gf66ebf37d69c #7 91723d6f74857f70725e1583cba3cf4adc716cfa
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.3-0-ga6ed6b701f0a-prebuilt.qemu.org 04/01/2014
      Workqueue: events cleanup_bearer
      
      Fixes: 26abe143 ("net: Modify sk_alloc to not reference count the netns of kernel sockets.")
      Reported-by: default avatarsyzkaller <syzkaller@googlegroups.com>
      Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
      Link: https://patch.msgid.link/20241127050512.28438-1-kuniyu@amazon.com
      
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      650ee9a2
    • Ivan Solodovnikov's avatar
      dccp: Fix memory leak in dccp_feat_change_recv · c99507ff
      Ivan Solodovnikov authored
      
      [ Upstream commit 22be4727 ]
      
      If dccp_feat_push_confirm() fails after new value for SP feature was accepted
      without reconciliation ('entry == NULL' branch), memory allocated for that value
      with dccp_feat_clone_sp_val() is never freed.
      
      Here is the kmemleak stack for this:
      
      unreferenced object 0xffff88801d4ab488 (size 8):
        comm "syz-executor310", pid 1127, jiffies 4295085598 (age 41.666s)
        hex dump (first 8 bytes):
          01 b4 4a 1d 80 88 ff ff                          ..J.....
        backtrace:
          [<00000000db7cabfe>] kmemdup+0x23/0x50 mm/util.c:128
          [<0000000019b38405>] kmemdup include/linux/string.h:465 [inline]
          [<0000000019b38405>] dccp_feat_clone_sp_val net/dccp/feat.c:371 [inline]
          [<0000000019b38405>] dccp_feat_clone_sp_val net/dccp/feat.c:367 [inline]
          [<0000000019b38405>] dccp_feat_change_recv net/dccp/feat.c:1145 [inline]
          [<0000000019b38405>] dccp_feat_parse_options+0x1196/0x2180 net/dccp/feat.c:1416
          [<00000000b1f6d94a>] dccp_parse_options+0xa2a/0x1260 net/dccp/options.c:125
          [<0000000030d7b621>] dccp_rcv_state_process+0x197/0x13d0 net/dccp/input.c:650
          [<000000001f74c72e>] dccp_v4_do_rcv+0xf9/0x1a0 net/dccp/ipv4.c:688
          [<00000000a6c24128>] sk_backlog_rcv include/net/sock.h:1041 [inline]
          [<00000000a6c24128>] __release_sock+0x139/0x3b0 net/core/sock.c:2570
          [<00000000cf1f3a53>] release_sock+0x54/0x1b0 net/core/sock.c:3111
          [<000000008422fa23>] inet_wait_for_connect net/ipv4/af_inet.c:603 [inline]
          [<000000008422fa23>] __inet_stream_connect+0x5d0/0xf70 net/ipv4/af_inet.c:696
          [<0000000015b6f64d>] inet_stream_connect+0x53/0xa0 net/ipv4/af_inet.c:735
          [<0000000010122488>] __sys_connect_file+0x15c/0x1a0 net/socket.c:1865
          [<00000000b4b70023>] __sys_connect+0x165/0x1a0 net/socket.c:1882
          [<00000000f4cb3815>] __do_sys_connect net/socket.c:1892 [inline]
          [<00000000f4cb3815>] __se_sys_connect net/socket.c:1889 [inline]
          [<00000000f4cb3815>] __x64_sys_connect+0x6e/0xb0 net/socket.c:1889
          [<00000000e7b1e839>] do_syscall_64+0x33/0x40 arch/x86/entry/common.c:46
          [<0000000055e91434>] entry_SYSCALL_64_after_hwframe+0x67/0xd1
      
      Clean up the allocated memory in case of dccp_feat_push_confirm() failure
      and bail out with an error reset code.
      
      Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
      
      Fixes: e77b8363 ("dccp: Process incoming Change feature-negotiation options")
      Signed-off-by: default avatarIvan Solodovnikov <solodovnikov.ia@phystech.edu>
      Link: https://patch.msgid.link/20241126143902.190853-1-solodovnikov.ia@phystech.edu
      
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c99507ff
    • Jiri Wiesner's avatar
      net/ipv6: release expired exception dst cached in socket · b90d0613
      Jiri Wiesner authored
      [ Upstream commit 3301ab7d ]
      
      Dst objects get leaked in ip6_negative_advice() when this function is
      executed for an expired IPv6 route located in the exception table. There
      are several conditions that must be fulfilled for the leak to occur:
      * an ICMPv6 packet indicating a change of the MTU for the path is received,
        resulting in an exception dst being created
      * a TCP connection that uses the exception dst for routing packets must
        start timing out so that TCP begins retransmissions
      * after the exception dst expires, the FIB6 garbage collector must not run
        before TCP executes ip6_negative_advice() for the expired exception dst
      
      When TCP executes ip6_negative_advice() for an exception dst that has
      expired and if no other socket holds a reference to the exception dst, the
      refcount of the exception dst is 2, which corresponds to the increment
      made by dst_init() and the increment made by the TCP socket for which the
      connection is timing out. The refcount made by the socket is never
      released. The refcount of the dst is decremented in sk_dst_reset() but
      that decrement is counteracted by a dst_hold() intentionally placed just
      before the sk_dst_reset() in ip6_negative_advice(). After
      ip6_negative_advice() has finished, there is no other object tied to the
      dst. The socket lost its reference stored in sk_dst_cache and the dst is
      no longer in the exception table. The exception dst becomes a leaked
      object.
      
      As a result of this dst leak, an unbalanced refcount is reported for the
      loopback device of a net namespace being destroyed under kernels that do
      not contain e5f80fcf ("ipv6: give an IPv6 dev to blackhole_netdev"):
      unregister_netdevice: waiting for lo to become free. Usage count = 2
      
      Fix the dst leak by removing the dst_hold() in ip6_negative_advice(). The
      patch that introduced the dst_hold() in ip6_negative_advice() was
      92f1655a ("net: fix __dst_negative_advice() race"). But 92f1655a
      merely refactored the code with regards to the dst refcount so the issue
      was present even before 92f1655a. The bug was introduced in
      54c1a859 ("ipv6: Don't drop cache route entry unless timer actually
      expired.") where the expired cached route is deleted and the sk_dst_cache
      member of the socket is set to NULL by calling dst_negative_advice() but
      the refcount belonging to the socket is left unbalanced.
      
      The IPv4 version - ipv4_negative_advice() - is not affected by this bug.
      When the TCP connection times out ipv4_negative_advice() merely resets the
      sk_dst_cache of the socket while decrementing the refcount of the
      exception dst.
      
      Fixes: 92f1655a ("net: fix __dst_negative_advice() race")
      Fixes: 54c1a859 ("ipv6: Don't drop cache route entry unless timer actually expired.")
      Link: https://lore.kernel.org/netdev/20241113105611.GA6723@incl/T/#u
      
      
      Signed-off-by: default avatarJiri Wiesner <jwiesner@suse.de>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Link: https://patch.msgid.link/20241128085950.GA4505@incl
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b90d0613
    • Dmitry Antipov's avatar
      can: j1939: j1939_session_new(): fix skb reference counting · b3282c2b
      Dmitry Antipov authored
      
      [ Upstream commit a8c69500 ]
      
      Since j1939_session_skb_queue() does an extra skb_get() for each new
      skb, do the same for the initial one in j1939_session_new() to avoid
      refcount underflow.
      
      Reported-by: default avatar <syzbot+d4e8dc385d9258220c31@syzkaller.appspotmail.com>
      Closes: https://syzkaller.appspot.com/bug?extid=d4e8dc385d9258220c31
      
      
      Fixes: 9d71dd0c ("can: add support of SAE J1939 protocol")
      Signed-off-by: default avatarDmitry Antipov <dmantipov@yandex.ru>
      Tested-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
      Acked-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
      Link: https://patch.msgid.link/20241105094823.2403806-1-dmantipov@yandex.ru
      
      
      [mkl: clean up commit message]
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b3282c2b
    • Eric Dumazet's avatar
      net: hsr: avoid potential out-of-bound access in fill_frame_info() · aa632691
      Eric Dumazet authored
      
      [ Upstream commit b9653d19 ]
      
      syzbot is able to feed a packet with 14 bytes, pretending
      it is a vlan one.
      
      Since fill_frame_info() is relying on skb->mac_len already,
      extend the check to cover this case.
      
      BUG: KMSAN: uninit-value in fill_frame_info net/hsr/hsr_forward.c:709 [inline]
       BUG: KMSAN: uninit-value in hsr_forward_skb+0x9ee/0x3b10 net/hsr/hsr_forward.c:724
        fill_frame_info net/hsr/hsr_forward.c:709 [inline]
        hsr_forward_skb+0x9ee/0x3b10 net/hsr/hsr_forward.c:724
        hsr_dev_xmit+0x2f0/0x350 net/hsr/hsr_device.c:235
        __netdev_start_xmit include/linux/netdevice.h:5002 [inline]
        netdev_start_xmit include/linux/netdevice.h:5011 [inline]
        xmit_one net/core/dev.c:3590 [inline]
        dev_hard_start_xmit+0x247/0xa20 net/core/dev.c:3606
        __dev_queue_xmit+0x366a/0x57d0 net/core/dev.c:4434
        dev_queue_xmit include/linux/netdevice.h:3168 [inline]
        packet_xmit+0x9c/0x6c0 net/packet/af_packet.c:276
        packet_snd net/packet/af_packet.c:3146 [inline]
        packet_sendmsg+0x91ae/0xa6f0 net/packet/af_packet.c:3178
        sock_sendmsg_nosec net/socket.c:711 [inline]
        __sock_sendmsg+0x30f/0x380 net/socket.c:726
        __sys_sendto+0x594/0x750 net/socket.c:2197
        __do_sys_sendto net/socket.c:2204 [inline]
        __se_sys_sendto net/socket.c:2200 [inline]
        __x64_sys_sendto+0x125/0x1d0 net/socket.c:2200
        x64_sys_call+0x346a/0x3c30 arch/x86/include/generated/asm/syscalls_64.h:45
        do_syscall_x64 arch/x86/entry/common.c:52 [inline]
        do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f
      
      Uninit was created at:
        slab_post_alloc_hook mm/slub.c:4091 [inline]
        slab_alloc_node mm/slub.c:4134 [inline]
        kmem_cache_alloc_node_noprof+0x6bf/0xb80 mm/slub.c:4186
        kmalloc_reserve+0x13d/0x4a0 net/core/skbuff.c:587
        __alloc_skb+0x363/0x7b0 net/core/skbuff.c:678
        alloc_skb include/linux/skbuff.h:1323 [inline]
        alloc_skb_with_frags+0xc8/0xd00 net/core/skbuff.c:6612
        sock_alloc_send_pskb+0xa81/0xbf0 net/core/sock.c:2881
        packet_alloc_skb net/packet/af_packet.c:2995 [inline]
        packet_snd net/packet/af_packet.c:3089 [inline]
        packet_sendmsg+0x74c6/0xa6f0 net/packet/af_packet.c:3178
        sock_sendmsg_nosec net/socket.c:711 [inline]
        __sock_sendmsg+0x30f/0x380 net/socket.c:726
        __sys_sendto+0x594/0x750 net/socket.c:2197
        __do_sys_sendto net/socket.c:2204 [inline]
        __se_sys_sendto net/socket.c:2200 [inline]
        __x64_sys_sendto+0x125/0x1d0 net/socket.c:2200
        x64_sys_call+0x346a/0x3c30 arch/x86/include/generated/asm/syscalls_64.h:45
        do_syscall_x64 arch/x86/entry/common.c:52 [inline]
        do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f
      
      Fixes: 48b491a5 ("net: hsr: fix mac_len checks")
      Reported-by: default avatar <syzbot+671e2853f9851d039551@syzkaller.appspotmail.com>
      Closes: https://lore.kernel.org/netdev/6745dc7f.050a0220.21d33d.0018.GAE@google.com/T/#u
      
      
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: WingMan Kwok <w-kwok2@ti.com>
      Cc: Murali Karicheri <m-karicheri2@ti.com>
      Cc: MD Danish Anwar <danishanwar@ti.com>
      Cc: Jiri Pirko <jiri@nvidia.com>
      Cc: George McCollister <george.mccollister@gmail.com>
      Link: https://patch.msgid.link/20241126144344.4177332-1-edumazet@google.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      aa632691
    • Martin Ottens's avatar
      net/sched: tbf: correct backlog statistic for GSO packets · f9653b00
      Martin Ottens authored
      
      [ Upstream commit 1596a135 ]
      
      When the length of a GSO packet in the tbf qdisc is larger than the burst
      size configured the packet will be segmented by the tbf_segment function.
      Whenever this function is used to enqueue SKBs, the backlog statistic of
      the tbf is not increased correctly. This can lead to underflows of the
      'backlog' byte-statistic value when these packets are dequeued from tbf.
      
      Reproduce the bug:
      Ensure that the sender machine has GSO enabled. Configured the tbf on
      the outgoing interface of the machine as follows (burstsize = 1 MTU):
      $ tc qdisc add dev <oif> root handle 1: tbf rate 50Mbit burst 1514 latency 50ms
      
      Send bulk TCP traffic out via this interface, e.g., by running an iPerf3
      client on this machine. Check the qdisc statistics:
      $ tc -s qdisc show dev <oif>
      
      The 'backlog' byte-statistic has incorrect values while traffic is
      transferred, e.g., high values due to u32 underflows. When the transfer
      is stopped, the value is != 0, which should never happen.
      
      This patch fixes this bug by updating the statistics correctly, even if
      single SKBs of a GSO SKB cannot be enqueued.
      
      Fixes: e43ac79a ("sch_tbf: segment too big GSO packets")
      Signed-off-by: default avatarMartin Ottens <martin.ottens@fau.de>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Link: https://patch.msgid.link/20241125174608.1484356-1-martin.ottens@fau.de
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f9653b00
    • Ajay Kaher's avatar
      ptp: Add error handling for adjfine callback in ptp_clock_adjtime · 7f5eda0e
      Ajay Kaher authored
      
      [ Upstream commit 98337d7c ]
      
      ptp_clock_adjtime sets ptp->dialed_frequency even when adjfine
      callback returns an error. This causes subsequent reads to return
      an incorrect value.
      
      Fix this by adding error check before ptp->dialed_frequency is set.
      
      Fixes: 39a8cbd9 ("ptp: remember the adjusted frequency")
      Signed-off-by: default avatarAjay Kaher <ajay.kaher@broadcom.com>
      Acked-by: default avatarRichard Cochran <richardcochran@gmail.com>
      Link: https://patch.msgid.link/20241125105954.1509971-1-ajay.kaher@broadcom.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      7f5eda0e
    • Dmitry Antipov's avatar
      netfilter: x_tables: fix LED ID check in led_tg_check() · ad28612e
      Dmitry Antipov authored
      
      [ Upstream commit 04317f4e ]
      
      Syzbot has reported the following BUG detected by KASAN:
      
      BUG: KASAN: slab-out-of-bounds in strlen+0x58/0x70
      Read of size 1 at addr ffff8881022da0c8 by task repro/5879
      ...
      Call Trace:
       <TASK>
       dump_stack_lvl+0x241/0x360
       ? __pfx_dump_stack_lvl+0x10/0x10
       ? __pfx__printk+0x10/0x10
       ? _printk+0xd5/0x120
       ? __virt_addr_valid+0x183/0x530
       ? __virt_addr_valid+0x183/0x530
       print_report+0x169/0x550
       ? __virt_addr_valid+0x183/0x530
       ? __virt_addr_valid+0x183/0x530
       ? __virt_addr_valid+0x45f/0x530
       ? __phys_addr+0xba/0x170
       ? strlen+0x58/0x70
       kasan_report+0x143/0x180
       ? strlen+0x58/0x70
       strlen+0x58/0x70
       kstrdup+0x20/0x80
       led_tg_check+0x18b/0x3c0
       xt_check_target+0x3bb/0xa40
       ? __pfx_xt_check_target+0x10/0x10
       ? stack_depot_save_flags+0x6e4/0x830
       ? nft_target_init+0x174/0xc30
       nft_target_init+0x82d/0xc30
       ? __pfx_nft_target_init+0x10/0x10
       ? nf_tables_newrule+0x1609/0x2980
       ? nf_tables_newrule+0x1609/0x2980
       ? rcu_is_watching+0x15/0xb0
       ? nf_tables_newrule+0x1609/0x2980
       ? nf_tables_newrule+0x1609/0x2980
       ? __kmalloc_noprof+0x21a/0x400
       nf_tables_newrule+0x1860/0x2980
       ? __pfx_nf_tables_newrule+0x10/0x10
       ? __nla_parse+0x40/0x60
       nfnetlink_rcv+0x14e5/0x2ab0
       ? __pfx_validate_chain+0x10/0x10
       ? __pfx_nfnetlink_rcv+0x10/0x10
       ? __lock_acquire+0x1384/0x2050
       ? netlink_deliver_tap+0x2e/0x1b0
       ? __pfx_lock_release+0x10/0x10
       ? netlink_deliver_tap+0x2e/0x1b0
       netlink_unicast+0x7f8/0x990
       ? __pfx_netlink_unicast+0x10/0x10
       ? __virt_addr_valid+0x183/0x530
       ? __check_object_size+0x48e/0x900
       netlink_sendmsg+0x8e4/0xcb0
       ? __pfx_netlink_sendmsg+0x10/0x10
       ? aa_sock_msg_perm+0x91/0x160
       ? __pfx_netlink_sendmsg+0x10/0x10
       __sock_sendmsg+0x223/0x270
       ____sys_sendmsg+0x52a/0x7e0
       ? __pfx_____sys_sendmsg+0x10/0x10
       __sys_sendmsg+0x292/0x380
       ? __pfx___sys_sendmsg+0x10/0x10
       ? lockdep_hardirqs_on_prepare+0x43d/0x780
       ? __pfx_lockdep_hardirqs_on_prepare+0x10/0x10
       ? exc_page_fault+0x590/0x8c0
       ? do_syscall_64+0xb6/0x230
       do_syscall_64+0xf3/0x230
       entry_SYSCALL_64_after_hwframe+0x77/0x7f
      ...
       </TASK>
      
      Since an invalid (without '\0' byte at all) byte sequence may be passed
      from userspace, add an extra check to ensure that such a sequence is
      rejected as possible ID and so never passed to 'kstrdup()' and further.
      
      Reported-by: default avatar <syzbot+6c8215822f35fdb35667@syzkaller.appspotmail.com>
      Closes: https://syzkaller.appspot.com/bug?extid=6c8215822f35fdb35667
      
      
      Fixes: 268cb38e ("netfilter: x_tables: add LED trigger target")
      Signed-off-by: default avatarDmitry Antipov <dmantipov@yandex.ru>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ad28612e
Loading