[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241211022612.2159956-1-make_ruc2021@163.com>
Date: Wed, 11 Dec 2024 10:26:12 +0800
From: Ma Ke <make_ruc2021@....com>
To: richardcochran@...il.com,
andrew+netdev@...n.ch,
davem@...emloft.net,
edumazet@...gle.com,
kuba@...nel.org,
pabeni@...hat.com,
vdronov@...hat.com
Cc: netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
Ma Ke <make_ruc2021@....com>,
stable@...r.kernel.org
Subject: [PATCH] ptp: Check dev_set_name() return value
It's possible that dev_set_name() returns -ENOMEM. We could catch and
handle it by adding dev_set_name() return value check.
Cc: stable@...r.kernel.org
Fixes: a33121e5487b ("ptp: fix the race between the release of ptp_clock and cdev")
Signed-off-by: Ma Ke <make_ruc2021@....com>
---
drivers/ptp/ptp_clock.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
index 77a36e7bddd5..82405c07be3e 100644
--- a/drivers/ptp/ptp_clock.c
+++ b/drivers/ptp/ptp_clock.c
@@ -348,7 +348,9 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
ptp->dev.groups = ptp->pin_attr_groups;
ptp->dev.release = ptp_clock_release;
dev_set_drvdata(&ptp->dev, ptp);
- dev_set_name(&ptp->dev, "ptp%d", ptp->index);
+ err = dev_set_name(&ptp->dev, "ptp%d", ptp->index);
+ if (err)
+ goto no_pps;
/* Create a posix clock and link it to the device. */
err = posix_clock_register(&ptp->clock, &ptp->dev);
--
2.25.1
Powered by blists - more mailing lists