linux-stable/drivers/phy
Vladimir Zapolskiy bf7ffcd006 phy: qcom-qusb2: Fix a memory leak on probe
On success nvmem_cell_read() returns a pointer to a dynamically allocated
buffer, and therefore it shall be freed after usage.

The issue is reported by kmemleak:

  # cat /sys/kernel/debug/kmemleak
  unreferenced object 0xffff3b3803e4b280 (size 128):
    comm "kworker/u16:1", pid 107, jiffies 4294892861 (age 94.120s)
    hex dump (first 32 bytes):
      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    backtrace:
      [<000000007739afdc>] __kmalloc+0x27c/0x41c
      [<0000000071c0fbf8>] nvmem_cell_read+0x40/0xe0
      [<00000000e803ef1f>] qusb2_phy_init+0x258/0x5bc
      [<00000000fc81fcfa>] phy_init+0x70/0x110
      [<00000000e3d48a57>] dwc3_core_soft_reset+0x4c/0x234
      [<0000000027d1dbd4>] dwc3_core_init+0x68/0x990
      [<000000001965faf9>] dwc3_probe+0x4f4/0x730
      [<000000002f7617ca>] platform_probe+0x74/0xf0
      [<00000000a2576cac>] really_probe+0xc4/0x470
      [<00000000bc77f2c5>] __driver_probe_device+0x11c/0x190
      [<00000000130db71f>] driver_probe_device+0x48/0x110
      [<0000000019f36c2b>] __device_attach_driver+0xa4/0x140
      [<00000000e5812ff7>]  bus_for_each_drv+0x84/0xe0
      [<00000000f4bac574>] __device_attach+0xe4/0x1c0
      [<00000000d3beb631>] device_initial_probe+0x20/0x30
      [<000000008019b9db>] bus_probe_device+0xa4/0xb0

Fixes: ca04d9d3e1 ("phy: qcom-qusb2: New driver for QUSB2 PHY on Qcom chips")
Signed-off-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20210922233548.2150244-1-vladimir.zapolskiy@linaro.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2021-10-26 16:36:22 +05:30
..
allwinner phy: sun4i-usb: remove enable_pmu_unk1 from sun50i_h6_cfg 2020-11-19 11:49:18 +05:30
amlogic phy: amlogic: meson8b-usb2: don't log an error on -EPROBE_DEFER 2021-08-17 16:00:44 +05:30
broadcom phy: broadcom: Kconfig: Add configuration menu for Broadcom phy drivers 2021-10-01 13:50:38 +05:30
cadence phy: cadence-torrent: Check PIPE mode PHY status to be ready for operation 2021-08-17 15:42:44 +05:30
freescale phy: freescale: convert to devm_platform_ioremap_resource 2020-11-16 12:47:46 +05:30
hisilicon phy: HiSilicon: Add driver for Kirin 970 PCIe PHY 2021-10-01 13:42:18 +05:30
ingenic phy: ingenic: Fix a typo in ingenic_usb_phy_probe() 2021-03-30 23:35:17 +05:30
intel phy: intel: Fix for warnings due to EMMC clock 175Mhz change in FIP 2021-06-29 16:45:16 +02:00
lantiq phy: lantiq: rcu-usb2: wait after clock enable 2021-01-13 19:29:03 +05:30
marvell phy: marvell: phy-mvebu-a3700-comphy: Remove unsupported modes 2021-08-27 12:20:33 +01:00
mediatek phy: phy-mtk-mipi-dsi: convert to devm_platform_ioremap_resource 2021-08-17 15:51:59 +05:30
microchip phy: Sparx5 Eth SerDes: check return value after calling platform_get_resource() 2021-06-03 11:18:19 +05:30
motorola phy-for-5.12 2021-02-09 09:32:35 +01:00
mscc
qualcomm phy: qcom-qusb2: Fix a memory leak on probe 2021-10-26 16:36:22 +05:30
ralink phy-for-5.14 version 2 2021-06-23 10:33:34 +02:00
renesas phy: renesas: phy-rcar-gen3-usb2: Add USB2.0 PHY support for RZ/G2L 2021-08-06 18:12:30 +05:30
rockchip phy: rockchip-inno-usb2: Make use of the helper function devm_add_action_or_reset() 2021-10-01 15:54:23 +05:30
samsung phy: samsung: unify naming and describe driver in KConfig 2021-10-01 11:46:20 +05:30
socionext phy: uniphier-pcie: Fix updating phy parameters 2021-06-21 12:03:05 +05:30
st phy/drivers/stm32: use HZ macros 2021-09-08 11:50:26 -07:00
tegra phy: tegra: xusb: mark PM functions as __maybe_unused 2021-07-22 14:41:07 +05:30
ti phy: phy-twl4030-usb: Disable PHY for suspend 2021-08-06 17:32:51 +05:30
xilinx phy: xilinx: zynqmp: skip PHY initialization and PLL lock for USB 2021-08-18 15:44:14 +05:30
Kconfig phy: pistachio-usb: Depend on MIPS || COMPILE_TEST 2021-08-12 16:01:49 +02:00
Makefile phy: phy-can-transceiver: Add support for generic CAN transceiver driver 2021-06-14 11:20:17 +05:30
phy-can-transceiver.c phy: phy-can-transceiver: Add support for generic CAN transceiver driver 2021-06-14 11:20:17 +05:30
phy-core-mipi-dphy.c phy: phy-core-mipi-dphy.c: Correct reference version 2021-05-14 17:49:29 +05:30
phy-core.c phy: Allow a NULL phy name for devm_phy_get() 2021-05-14 17:48:41 +05:30
phy-lgm-usb.c phy: Add USB3 PHY support for Intel LGM SoC 2020-09-11 17:12:49 +05:30
phy-lpc18xx-usb-otg.c
phy-pistachio-usb.c
phy-xgene.c phy: phy-xgene.c: Fix alignment of comment 2021-05-31 14:08:55 +05:30