netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v1] ptp: Fix possible memory leak caused by invalid cast
@ 2021-08-07  1:15 Vinicius Costa Gomes
  2021-08-08 12:00 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Vinicius Costa Gomes @ 2021-08-07  1:15 UTC (permalink / raw)
  To: netdev; +Cc: Vinicius Costa Gomes, richardcochran, davem, yangbo.lu

Fixes possible leak of PTP virtual clocks.

The number of PTP virtual clocks to be unregistered is passed as
'u32', but the function that unregister the devices handles that as
'u8'.

Fixes: 73f37068d540 ("ptp: support ptp physical/virtual clocks conversion")
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
---
I am calling this "possible" because I only saw that while taking a
look at the code, i.e. I didn't reproduce it. 


 drivers/ptp/ptp_sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ptp/ptp_sysfs.c b/drivers/ptp/ptp_sysfs.c
index b3d96b747292..41b92dc2f011 100644
--- a/drivers/ptp/ptp_sysfs.c
+++ b/drivers/ptp/ptp_sysfs.c
@@ -154,7 +154,7 @@ static int unregister_vclock(struct device *dev, void *data)
 	struct ptp_clock *ptp = dev_get_drvdata(dev);
 	struct ptp_clock_info *info = ptp->info;
 	struct ptp_vclock *vclock;
-	u8 *num = data;
+	u32 *num = data;
 
 	vclock = info_to_vclock(info);
 	dev_info(dev->parent, "delete virtual clock ptp%d\n",
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net v1] ptp: Fix possible memory leak caused by invalid cast
  2021-08-07  1:15 [PATCH net v1] ptp: Fix possible memory leak caused by invalid cast Vinicius Costa Gomes
@ 2021-08-08 12:00 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-08-08 12:00 UTC (permalink / raw)
  To: Vinicius Costa Gomes; +Cc: netdev, richardcochran, davem, yangbo.lu

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Fri,  6 Aug 2021 18:15:46 -0700 you wrote:
> Fixes possible leak of PTP virtual clocks.
> 
> The number of PTP virtual clocks to be unregistered is passed as
> 'u32', but the function that unregister the devices handles that as
> 'u8'.
> 
> Fixes: 73f37068d540 ("ptp: support ptp physical/virtual clocks conversion")
> Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
> 
> [...]

Here is the summary with links:
  - [net,v1] ptp: Fix possible memory leak caused by invalid cast
    https://git.kernel.org/netdev/net/c/d329e41a08f3

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-08 12:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-07  1:15 [PATCH net v1] ptp: Fix possible memory leak caused by invalid cast Vinicius Costa Gomes
2021-08-08 12:00 ` patchwork-bot+netdevbpf

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).