patches.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	patches@lists.linux.dev, Michal Pecio <michal.pecio@gmail.com>,
	Simon Horman <horms@kernel.org>, Jakub Kicinski <kuba@kernel.org>
Subject: [PATCH 6.12 062/117] net: usb: rtl8150: Fix frame padding
Date: Mon, 27 Oct 2025 19:36:28 +0100	[thread overview]
Message-ID: <20251027183455.693928987@linuxfoundation.org> (raw)
In-Reply-To: <20251027183453.919157109@linuxfoundation.org>

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Michal Pecio <michal.pecio@gmail.com>

commit 75cea9860aa6b2350d90a8d78fed114d27c7eca2 upstream.

TX frames aren't padded and unknown memory is sent into the ether.

Theoretically, it isn't even guaranteed that the extra memory exists
and can be sent out, which could cause further problems. In practice,
I found that plenty of tailroom exists in the skb itself (in my test
with ping at least) and skb_padto() easily succeeds, so use it here.

In the event of -ENOMEM drop the frame like other drivers do.

The use of one more padding byte instead of a USB zero-length packet
is retained to avoid regression. I have a dodgy Etron xHCI controller
which doesn't seem to support sending ZLPs at all.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Michal Pecio <michal.pecio@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20251014203528.3f9783c4.michal.pecio@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/usb/rtl8150.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

--- a/drivers/net/usb/rtl8150.c
+++ b/drivers/net/usb/rtl8150.c
@@ -685,9 +685,16 @@ static netdev_tx_t rtl8150_start_xmit(st
 	rtl8150_t *dev = netdev_priv(netdev);
 	int count, res;
 
+	/* pad the frame and ensure terminating USB packet, datasheet 9.2.3 */
+	count = max(skb->len, ETH_ZLEN);
+	if (count % 64 == 0)
+		count++;
+	if (skb_padto(skb, count)) {
+		netdev->stats.tx_dropped++;
+		return NETDEV_TX_OK;
+	}
+
 	netif_stop_queue(netdev);
-	count = (skb->len < 60) ? 60 : skb->len;
-	count = (count & 0x3f) ? count : count + 1;
 	dev->tx_skb = skb;
 	usb_fill_bulk_urb(dev->tx_urb, dev->udev, usb_sndbulkpipe(dev->udev, 2),
 		      skb->data, count, write_bulk_callback, dev);



  parent reply	other threads:[~2025-10-27 19:22 UTC|newest]

Thread overview: 132+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-27 18:35 [PATCH 6.12 000/117] 6.12.56-rc1 review Greg Kroah-Hartman
2025-10-27 18:35 ` [PATCH 6.12 001/117] exec: Fix incorrect type for ret Greg Kroah-Hartman
2025-10-27 18:35 ` [PATCH 6.12 002/117] nios2: ensure that memblock.current_limit is set when setting pfn limits Greg Kroah-Hartman
2025-10-27 18:35 ` [PATCH 6.12 003/117] hfs: clear offset and space out of valid records in b-tree node Greg Kroah-Hartman
2025-10-27 18:35 ` [PATCH 6.12 004/117] hfs: make proper initalization of struct hfs_find_data Greg Kroah-Hartman
2025-10-27 18:35 ` [PATCH 6.12 005/117] hfsplus: fix KMSAN uninit-value issue in __hfsplus_ext_cache_extent() Greg Kroah-Hartman
2025-10-27 18:35 ` [PATCH 6.12 006/117] hfs: validate record offset in hfsplus_bmap_alloc Greg Kroah-Hartman
2025-10-27 18:35 ` [PATCH 6.12 007/117] hfsplus: fix KMSAN uninit-value issue in hfsplus_delete_cat() Greg Kroah-Hartman
2025-10-27 18:35 ` [PATCH 6.12 008/117] dlm: check for defined force value in dlm_lockspace_release Greg Kroah-Hartman
2025-10-27 18:35 ` [PATCH 6.12 009/117] hfs: fix KMSAN uninit-value issue in hfs_find_set_zero_bits() Greg Kroah-Hartman
2025-10-27 18:35 ` [PATCH 6.12 010/117] hfsplus: return EIO when type of hidden directory mismatch in hfsplus_fill_super() Greg Kroah-Hartman
2025-10-27 18:35 ` [PATCH 6.12 011/117] PCI: Test for bit underflow in pcie_set_readrq() Greg Kroah-Hartman
2025-10-27 18:35 ` [PATCH 6.12 012/117] lkdtm: fortify: Fix potential NULL dereference on kmalloc failure Greg Kroah-Hartman
2025-10-27 18:35 ` [PATCH 6.12 013/117] arm64: sysreg: Correct sign definitions for EIESB and DoubleLock Greg Kroah-Hartman
2025-10-27 18:35 ` [PATCH 6.12 014/117] gfs2: Fix unlikely race in gdlm_put_lock Greg Kroah-Hartman
2025-10-27 18:35 ` [PATCH 6.12 015/117] m68k: bitops: Fix find_*_bit() signatures Greg Kroah-Hartman
2025-10-27 18:35 ` [PATCH 6.12 016/117] powerpc/32: Remove PAGE_KERNEL_TEXT to fix startup failure Greg Kroah-Hartman
2025-10-27 18:35 ` [PATCH 6.12 017/117] drivers/perf: hisi: Relax the event ID check in the framework Greg Kroah-Hartman
2025-10-27 18:35 ` [PATCH 6.12 018/117] s390/mm: Use __GFP_ACCOUNT for user page table allocations Greg Kroah-Hartman
2025-10-27 18:35 ` [PATCH 6.12 019/117] smb: server: let smb_direct_flush_send_list() invalidate a remote key first Greg Kroah-Hartman
2025-10-27 18:35 ` [PATCH 6.12 020/117] Unbreak make tools/* for user-space targets Greg Kroah-Hartman
2025-10-27 18:35 ` [PATCH 6.12 021/117] PM: EM: Drop unused parameter from em_adjust_new_capacity() Greg Kroah-Hartman
2025-10-27 18:35 ` [PATCH 6.12 022/117] PM: EM: Slightly reduce em_check_capacity_update() overhead Greg Kroah-Hartman
2025-10-27 18:35 ` [PATCH 6.12 023/117] PM: EM: Move CPU capacity check to em_adjust_new_capacity() Greg Kroah-Hartman
2025-10-27 18:35 ` [PATCH 6.12 024/117] PM: EM: Fix late boot with holes in CPU topology Greg Kroah-Hartman
2025-10-27 18:35 ` [PATCH 6.12 025/117] net/mlx5e: Return 1 instead of 0 in invalid case in mlx5e_mpwrq_umr_entry_size() Greg Kroah-Hartman
2025-10-27 18:35 ` [PATCH 6.12 026/117] rtnetlink: Allow deleting FDB entries in user namespace Greg Kroah-Hartman
2025-10-27 18:35 ` [PATCH 6.12 027/117] net: enetc: fix the deadlock of enetc_mdio_lock Greg Kroah-Hartman
2025-10-27 18:35 ` [PATCH 6.12 028/117] net: enetc: correct the value of ENETC_RXB_TRUESIZE Greg Kroah-Hartman
2025-10-27 18:35 ` [PATCH 6.12 029/117] dpaa2-eth: fix the pointer passed to PTR_ALIGN on Tx path Greg Kroah-Hartman
2025-10-27 18:35 ` [PATCH 6.12 030/117] can: bxcan: bxcan_start_xmit(): use can_dev_dropped_skb() instead of can_dropped_invalid_skb() Greg Kroah-Hartman
2025-10-27 18:35 ` [PATCH 6.12 031/117] can: esd: acc_start_xmit(): " Greg Kroah-Hartman
2025-10-27 18:35 ` [PATCH 6.12 032/117] can: rockchip-canfd: rkcanfd_start_xmit(): " Greg Kroah-Hartman
2025-10-27 18:35 ` [PATCH 6.12 033/117] selftests: net: fix server bind failure in sctp_vrf.sh Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 034/117] net/mlx5e: Reuse per-RQ XDP buffer to avoid stack zeroing overhead Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 035/117] net/mlx5e: RX, Fix generating skb from non-linear xdp_buff for legacy RQ Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 036/117] net/mlx5e: RX, Fix generating skb from non-linear xdp_buff for striding RQ Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 037/117] net/smc: fix general protection fault in __smc_diag_dump Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 038/117] net: ethernet: ti: am65-cpts: fix timestamp loss due to race conditions Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 039/117] arm64, mm: avoid always making PTE dirty in pte_mkwrite() Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 040/117] ptp: ocp: Fix typo using index 1 instead of i in SMA initialization loop Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 041/117] sctp: avoid NULL dereference when chunk data buffer is missing Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 042/117] net: phy: micrel: always set shared->phydev for LAN8814 Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 043/117] net/mlx5: Fix IPsec cleanup over MPV device Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 044/117] fs/notify: call exportfs_encode_fid with s_umount Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 045/117] net: bonding: fix possible peer notify event loss or dup issue Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 046/117] dma-debug: dont report false positives with DMA_BOUNCE_UNALIGNED_KMALLOC Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 047/117] arch_topology: Fix incorrect error check in topology_parse_cpu_capacity() Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 048/117] btrfs: directly free partially initialized fs_info in btrfs_check_leaked_roots() Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 049/117] gpio: pci-idio-16: Define maximum valid register address offset Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 050/117] gpio: 104-idio-16: " Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 051/117] xfs: fix locking in xchk_nlinks_collect_dir Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 052/117] Revert "cpuidle: menu: Avoid discarding useful information" Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 053/117] slab: Avoid race on slab->obj_exts in alloc_slab_obj_exts Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 054/117] slab: Fix obj_ext mistakenly considered NULL due to race condition Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 055/117] ACPICA: Work around bogus -Wstringop-overread warning since GCC 11 Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 056/117] can: netlink: can_changelink(): allow disabling of automatic restart Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 057/117] cifs: Fix TCP_Server_Info::credits to be signed Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 058/117] MIPS: Malta: Fix keyboard resource preventing i8042 driver from registering Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 059/117] ocfs2: clear extent cache after moving/defragmenting extents Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 060/117] vsock: fix lock inversion in vsock_assign_transport() Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 061/117] net: stmmac: dwmac-rk: Fix disabling set_clock_selection Greg Kroah-Hartman
2025-10-27 18:36 ` Greg Kroah-Hartman [this message]
2025-10-27 18:36 ` [PATCH 6.12 063/117] net: ravb: Enforce descriptor type ordering Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 064/117] net: ravb: Ensure memory write completes before ringing TX doorbell Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 065/117] selftests: mptcp: join: mark flush re-add as skipped if not supported Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 066/117] selftests: mptcp: join: mark implicit tests " Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 067/117] mm: prevent poison consumption when splitting THP Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 068/117] drm/amd/display: increase max link count and fix link->enc NULL pointer access Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 069/117] spi: spi-nxp-fspi: add extra delay after dll locked Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 070/117] arm64: dts: broadcom: bcm2712: Add default GIC address cells Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 071/117] arm64: dts: broadcom: bcm2712: Define VGIC interrupt Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 072/117] firmware: arm_scmi: Account for failed debug initialization Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 073/117] firmware: arm_scmi: Fix premature SCMI_XFER_FLAG_IS_RAW clearing in raw mode Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 074/117] spi: airoha: return an error for continuous mode dirmap creation cases Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 075/117] spi: airoha: add support of dual/quad wires spi modes to exec_op() handler Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 076/117] spi: airoha: do not keep {tx,rx} dma buffer always mapped Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 077/117] spi: airoha: switch back to non-dma mode in the case of error Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 078/117] spi: airoha: fix reading/writing of flashes with more than one plane per lun Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 079/117] drm/panthor: Fix kernel panic on partial unmap of a GPU VA region Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 080/117] RISC-V: Define pgprot_dmacoherent() for non-coherent devices Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 081/117] RISC-V: Dont print details of CPUs disabled in DT Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 082/117] riscv: hwprobe: avoid uninitialized variable use in hwprobe_arch_id() Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 083/117] hwmon: (sht3x) Fix error handling Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 084/117] nbd: override creds to kernel when calling sock_{send,recv}msg() Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 085/117] drm/panic: Fix drawing the logo on a small narrow screen Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 086/117] drm/panic: Fix qr_code, ensure vmargin is positive Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 087/117] gpio: ljca: Fix duplicated IRQ mapping Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 088/117] io_uring: correct __must_hold annotation in io_install_fixed_file Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 089/117] sched: Remove never used code in mm_cid_get() Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 090/117] io_uring/sqpoll: switch away from getrusage() for CPU accounting Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 091/117] io_uring/sqpoll: be smarter on when to update the stime usage Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 092/117] Bluetooth: btintel: Add DSBR support for BlazarIW, BlazarU and GaP Greg Kroah-Hartman
2025-10-27 18:36 ` [PATCH 6.12 093/117] platform/x86/amd/hsmp: Ensure sock->metric_tbl_addr is non-NULL Greg Kroah-Hartman
2025-10-27 18:37 ` [PATCH 6.12 094/117] USB: serial: option: add UNISOC UIS7720 Greg Kroah-Hartman
2025-10-27 18:37 ` [PATCH 6.12 095/117] USB: serial: option: add Quectel RG255C Greg Kroah-Hartman
2025-10-27 18:37 ` [PATCH 6.12 096/117] USB: serial: option: add Telit FN920C04 ECM compositions Greg Kroah-Hartman
2025-10-27 18:37 ` [PATCH 6.12 097/117] usb/core/quirks: Add Huawei ME906S to wakeup quirk Greg Kroah-Hartman
2025-10-27 18:37 ` [PATCH 6.12 098/117] usb: raw-gadget: do not limit transfer length Greg Kroah-Hartman
2025-10-27 18:37 ` [PATCH 6.12 099/117] xhci: dbc: enable back DbC in resume if it was enabled before suspend Greg Kroah-Hartman
2025-10-27 18:37 ` [PATCH 6.12 100/117] xhci: dbc: fix bogus 1024 byte prefix if ttyDBC read races with stall event Greg Kroah-Hartman
2025-10-27 18:37 ` [PATCH 6.12 101/117] x86/microcode: Fix Entrysign revision check for Zen1/Naples Greg Kroah-Hartman
2025-10-27 18:37 ` [PATCH 6.12 102/117] binder: remove "invalid inc weak" check Greg Kroah-Hartman
2025-10-27 18:37 ` [PATCH 6.12 103/117] comedi: fix divide-by-zero in comedi_buf_munge() Greg Kroah-Hartman
2025-10-27 18:37 ` [PATCH 6.12 104/117] mei: me: add wildcat lake P DID Greg Kroah-Hartman
2025-10-27 18:37 ` [PATCH 6.12 105/117] objtool/rust: add one more `noreturn` Rust function Greg Kroah-Hartman
2025-10-27 18:37 ` [PATCH 6.12 106/117] misc: fastrpc: Fix dma_buf object leak in fastrpc_map_lookup Greg Kroah-Hartman
2025-10-27 18:37 ` [PATCH 6.12 107/117] most: usb: Fix use-after-free in hdm_disconnect Greg Kroah-Hartman
2025-10-27 18:37 ` [PATCH 6.12 108/117] most: usb: hdm_probe: Fix calling put_device() before device initialization Greg Kroah-Hartman
2025-10-27 18:37 ` [PATCH 6.12 109/117] tcpm: switch check for role_sw device with fw_node Greg Kroah-Hartman
2025-10-27 18:37 ` [PATCH 6.12 110/117] dt-bindings: usb: dwc3-imx8mp: dma-range is required only for imx8mp Greg Kroah-Hartman
2025-10-27 18:37 ` [PATCH 6.12 111/117] serial: 8250_dw: handle reset control deassert error Greg Kroah-Hartman
2025-10-27 18:37 ` [PATCH 6.12 112/117] serial: 8250_exar: add support for Advantech 2 port card with Device ID 0x0018 Greg Kroah-Hartman
2025-10-27 18:37 ` [PATCH 6.12 113/117] serial: 8250_mtk: Enable baud clock and manage in runtime PM Greg Kroah-Hartman
2025-10-27 18:37 ` [PATCH 6.12 114/117] serial: sc16is7xx: remove useless enable of enhanced features Greg Kroah-Hartman
2025-10-27 18:37 ` [PATCH 6.12 115/117] devcoredump: Fix circular locking dependency with devcd->mutex Greg Kroah-Hartman
2025-10-27 18:37 ` [PATCH 6.12 116/117] arm64: mte: Do not warn if the page is already tagged in copy_highpage() Greg Kroah-Hartman
2025-10-27 18:37 ` [PATCH 6.12 117/117] xfs: always warn about deprecated mount options Greg Kroah-Hartman
2025-10-27 21:40 ` [PATCH 6.12 000/117] 6.12.56-rc1 review Florian Fainelli
2025-10-28  4:13 ` Peter Schneider
2025-10-28  7:59 ` Harshit Mogalapalli
2025-10-28 11:29 ` Jon Hunter
2025-10-28 11:44 ` Ron Economos
2025-10-28 13:53 ` Brett A C Sheffield
2025-10-28 13:53 ` Naresh Kamboju
2025-10-28 14:09 ` Brett Mastbergen
2025-10-28 17:11 ` Dileep malepu
2025-10-28 19:24 ` Shuah Khan
2025-10-28 22:12 ` Slade Watkins
2025-10-29 11:36 ` Miguel Ojeda
2025-10-29 13:19 ` Mark Brown
2025-10-31 11:06 ` Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251027183455.693928987@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=michal.pecio@gmail.com \
    --cc=patches@lists.linux.dev \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).