From nobody Sun Dec 14 19:34:14 2025 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C2602267B74; Wed, 21 May 2025 13:13:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747833221; cv=none; b=GoabfVccGdEdP02/bz3aQlMab8FZbGnhx2B34KUX69duNHk0mP2L55kikxlx83mvpA0smek+f6Wnq+Aex45xcqpBkFbxbYjApiDE85DovnLo6hZyiHD1ex4Mwgzt+0ZYxEuny/S0N17OEw7+P8nmmSJQuw8LZFtRgY/BWO/hCCU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747833221; c=relaxed/simple; bh=K7L5xXjKGwqao/240GIrsFv5DITq/nJrUbkX2CFlM4Q=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=pXv7jARHxUOnUaEpI7ANPrBM0GVex8HABAHrPQsna825VBzrtkC3l5wuiezgCPHsgIME3yh9WvhYz885R7VHl7wSGgGSczrRzRQPm74v0GUSNVAzUHBP9M/siiWqITAXcw/M1dFRNV9nIVszVbdCdqmID9c/f+wR7GyEQAjzT+g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=LYoxcSd/; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="LYoxcSd/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1747833220; x=1779369220; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=K7L5xXjKGwqao/240GIrsFv5DITq/nJrUbkX2CFlM4Q=; b=LYoxcSd/diwWCvFwtxkYuZyzXjto0SpuyiOVonnQXNtRLROy8OeiUuRz VuSma225dVqeTUmmZet2u/fjrxz4y1TAC6KdzZ+5vAIFx8I0z1M1c5Aop YBN/AQf+3Mnnhzsqk3OKv7H3pTqThC+FGtAcEzAnPUyZda+iYgq7lXlGY 95yZzUaDe/VG3mH3O1ZoquJXUCIwAQXZa6GvK+KmHXapyB6WSGP5xhZi5 L+oLkPF7gOXzAvg3ztfSk8R1V9VyiQhks8FRbpGdRe/bnBnFUX1SRyg1g 713Ro5GTMewrCoHWN0Be27V4skCP2SoUAAdXdi/kQXfteOtO4RPN4Qz66 A==; X-CSE-ConnectionGUID: Ho6MR7HOQcaGdH2JBUdWGg== X-CSE-MsgGUID: /e80DkcVStK6KBJCNc6+vg== X-IronPort-AV: E=Sophos;i="6.15,303,1739862000"; d="scan'208";a="273274614" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa5.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 21 May 2025 06:13:38 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.44; Wed, 21 May 2025 06:13:07 -0700 Received: from DEN-DL-M31836.microchip.com (10.10.85.11) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.44 via Frontend Transport; Wed, 21 May 2025 06:13:05 -0700 From: Horatiu Vultur To: , , , , , , , , , , , , CC: , , Horatiu Vultur Subject: [PATCH net] net: phy: mscc: Fix memory leak when using one step timestamping Date: Wed, 21 May 2025 15:11:14 +0200 Message-ID: <20250521131114.2719084-1-horatiu.vultur@microchip.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Fix memory leak when running one-step timestamping. When running one-step sync timestamping, the HW is configured to insert the TX time into the frame, so there is no reason to keep the skb anymore. As in this case the HW will never generate an interrupt to say that the frame was timestamped, then the frame will never released. Fix this by freeing the frame in case of one-step timestamping. Fixes: 7d272e63e0979d ("net: phy: mscc: timestamping and PHC support") Signed-off-by: Horatiu Vultur --- drivers/net/phy/mscc/mscc_ptp.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/phy/mscc/mscc_ptp.c b/drivers/net/phy/mscc/mscc_pt= p.c index ed8fb14a7f215..db8ca1dfd5322 100644 --- a/drivers/net/phy/mscc/mscc_ptp.c +++ b/drivers/net/phy/mscc/mscc_ptp.c @@ -1173,6 +1173,13 @@ static void vsc85xx_txtstamp(struct mii_timestamper = *mii_ts, return; } =20 + if (vsc8531->ptp->tx_type =3D=3D HWTSTAMP_TX_ONESTEP_SYNC) { + if (ptp_msg_is_sync(skb, type)) { + kfree_skb(skb); + return; + } + } + skb_shinfo(skb)->tx_flags |=3D SKBTX_IN_PROGRESS; =20 mutex_lock(&vsc8531->ts_lock); --=20 2.34.1