Netdev List
 help / color / mirror / Atom feed
From: Wentao Liang <vulab@iscas.ac.cn>
To: andrew+netdev@lunn.ch
Cc: arkadiusz.kubalewski@intel.com, davem@davemloft.net,
	edumazet@google.com, jiri@resnulli.us, kuba@kernel.org,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	pabeni@redhat.com, richardcochran@gmail.com,
	vadim.fedorenko@linux.dev, Wentao Liang <vulab@iscas.ac.cn>,
	stable@vger.kernel.org
Subject: [PATCH] ptp: ocp: Fix dpll device reference leak in ptp_ocp_probe()
Date: Thu, 17 Sep 2026 14:23:37 +0000	[thread overview]
Message-ID: <20260917142337.2156652-1-vulab@iscas.ac.cn> (raw)

ptp_ocp_probe() takes a reference on the dpll device with
dpll_device_get(), but jumps to the out label without dropping it when
dpll_device_register() fails, so the reference leaks. Put it before
returning.

Fixes: 09eeb3aecc6c ("ptp_ocp: implement DPLL ops")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 drivers/ptp/ptp_ocp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c
index beacc2ffb166..dacb941da8e9 100644
--- a/drivers/ptp/ptp_ocp.c
+++ b/drivers/ptp/ptp_ocp.c
@@ -5106,8 +5106,10 @@ ptp_ocp_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	}
 
 	err = dpll_device_register(bp->dpll, DPLL_TYPE_PPS, &dpll_ops, bp);
-	if (err)
+	if (err) {
+		dpll_device_put(bp->dpll, &bp->tracker);
 		goto out;
+	}
 
 	for (i = 0; i < OCP_SMA_NUM; i++) {
 		bp->sma[i].dpll_pin = dpll_pin_get(clkid, i, THIS_MODULE,
-- 
2.34.1


             reply	other threads:[~2026-09-17 14:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-17 14:23 Wentao Liang [this message]
2026-09-21 15:40 ` [PATCH] ptp: ocp: Fix dpll device reference leak in ptp_ocp_probe() netdev-bot+sashiko
2026-09-22  1:23 ` Jakub Kicinski

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=20260917142337.2156652-1-vulab@iscas.ac.cn \
    --to=vulab@iscas.ac.cn \
    --cc=andrew+netdev@lunn.ch \
    --cc=arkadiusz.kubalewski@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.com \
    --cc=stable@vger.kernel.org \
    --cc=vadim.fedorenko@linux.dev \
    /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