From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org, shivani.agarwal@broadcom.com
Cc: Sasha Levin <sashal@kernel.org>
Subject: Re: [PATCH v5.10] ptp: Fix possible memory leak in ptp_clock_register()
Date: Mon, 28 Jul 2025 10:20:23 -0400 [thread overview]
Message-ID: <1753710855-90354577@stable.kernel.org> (raw)
In-Reply-To: <20250728081121.95098-1-shivani.agarwal@broadcom.com>
[ Sasha's backport helper bot ]
Hi,
Summary of potential issues:
⚠️ Found follow-up fixes in mainline
The upstream commit SHA1 provided is correct: 4225fea1cb28370086e17e82c0f69bec2779dca0
WARNING: Author mismatch between patch and upstream commit:
Backport author: Shivani Agarwal <shivani.agarwal@broadcom.com>
Commit author: Yang Yingliang <yangyingliang@huawei.com>
Status in newer kernel trees:
6.15.y | Present (exact SHA1)
6.12.y | Present (exact SHA1)
6.6.y | Present (exact SHA1)
6.1.y | Present (exact SHA1)
5.15.y | Present (exact SHA1)
Found fixes commits:
11195bf5a355 ptp: fix code indentation issues
Note: The patch differs from the upstream commit:
---
1: 4225fea1cb28 ! 1: ed4903766eee ptp: Fix possible memory leak in ptp_clock_register()
@@ Metadata
## Commit message ##
ptp: Fix possible memory leak in ptp_clock_register()
+ [ Upstream commit 4225fea1cb28370086e17e82c0f69bec2779dca0 ]
+
I got memory leak as follows when doing fault injection test:
unreferenced object 0xffff88800906c618 (size 8):
@@ Commit message
Fixes: a33121e5487b ("ptp: fix the race between the release of ptp_clock and cdev")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
+ Signed-off-by: Sasha Levin <sashal@kernel.org>
+ [Shivani: Modified to apply on 5.10.y, Removed
+ kfree(ptp->vclock_index) in the ptach, since vclock_index is
+ introduced in later versions]
+ Signed-off-by: Shivani Agarwal <shivani.agarwal@broadcom.com>
## drivers/ptp/ptp_clock.c ##
@@ drivers/ptp/ptp_clock.c: struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
/* Create a posix clock and link it to the device. */
err = posix_clock_register(&ptp->clock, &ptp->dev);
if (err) {
-+ if (ptp->pps_source)
-+ pps_unregister_source(ptp->pps_source);
-+
-+ kfree(ptp->vclock_index);
++ if (ptp->pps_source)
++ pps_unregister_source(ptp->pps_source);
+
+ if (ptp->kworker)
-+ kthread_destroy_worker(ptp->kworker);
++ kthread_destroy_worker(ptp->kworker);
+
+ put_device(&ptp->dev);
+
---
Results of testing on various branches:
| Branch | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| origin/linux-5.10.y | Success | Success |
prev parent reply other threads:[~2025-07-28 14:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-28 8:11 [PATCH v5.10] ptp: Fix possible memory leak in ptp_clock_register() Shivani Agarwal
2025-07-28 14:20 ` Sasha Levin [this message]
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=1753710855-90354577@stable.kernel.org \
--to=sashal@kernel.org \
--cc=shivani.agarwal@broadcom.com \
--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