diff mbox series

[net,v1] ptp: Fix possible memory leak caused by invalid cast

Message ID 20210807011546.1400747-1-vinicius.gomes@intel.com (mailing list archive)
State Accepted
Commit d329e41a08f37c478159d5c3379a17b9c07befa3
Delegated to: Netdev Maintainers
Headers show
Series [net,v1] ptp: Fix possible memory leak caused by invalid cast | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net
netdev/subject_prefix success Link
netdev/cc_maintainers success CCed 4 of 4 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link

Commit Message

Vinicius Costa Gomes Aug. 7, 2021, 1:15 a.m. UTC
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(-)

Comments

patchwork-bot+netdevbpf@kernel.org Aug. 8, 2021, noon UTC | #1
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
diff mbox series

Patch

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",