Skip to content

Commit

Permalink
ptp: Fix possible memory leak caused by invalid cast
Browse files Browse the repository at this point in the history
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: 73f3706 ("ptp: support ptp physical/virtual clocks conversion")
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Vinicius Costa Gomes authored and David S. Miller committed Aug 8, 2021
1 parent 2383cb9 commit d329e41
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/ptp/ptp_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit d329e41

Please sign in to comment.