summaryrefslogtreecommitdiffstats
path: root/drivers/phy/realtek/phy-rtk-usb3.c
diff options
context:
space:
mode:
authorCharles Han <hanchunchao@inspur.com>2024-10-25 09:07:44 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-11-04 02:03:19 +0100
commitbf373d2919d98f3d1fe1b19a0304f72fe74386d9 (patch)
tree8ac6fffd97d3a69ae03b8cd4226a340d31a3af3f /drivers/phy/realtek/phy-rtk-usb3.c
parentphy: realtek: usb: fix NULL deref in rtk_usb2phy_probe (diff)
downloadlinux-bf373d2919d98f3d1fe1b19a0304f72fe74386d9.tar.xz
linux-bf373d2919d98f3d1fe1b19a0304f72fe74386d9.zip
phy: realtek: usb: fix NULL deref in rtk_usb3phy_probe
In rtk_usb3phy_probe() devm_kzalloc() may return NULL but this returned value is not checked. Fixes: adda6e82a7de ("phy: realtek: usb: Add driver for the Realtek SoC USB 3.0 PHY") Signed-off-by: Charles Han <hanchunchao@inspur.com> Link: https://lore.kernel.org/r/20241025070744.149070-1-hanchunchao@inspur.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to '')
-rw-r--r--drivers/phy/realtek/phy-rtk-usb3.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/phy/realtek/phy-rtk-usb3.c b/drivers/phy/realtek/phy-rtk-usb3.c
index dfcf4b921bba..96af483e5444 100644
--- a/drivers/phy/realtek/phy-rtk-usb3.c
+++ b/drivers/phy/realtek/phy-rtk-usb3.c
@@ -577,6 +577,8 @@ static int rtk_usb3phy_probe(struct platform_device *pdev)
rtk_phy->dev = &pdev->dev;
rtk_phy->phy_cfg = devm_kzalloc(dev, sizeof(*phy_cfg), GFP_KERNEL);
+ if (!rtk_phy->phy_cfg)
+ return -ENOMEM;
memcpy(rtk_phy->phy_cfg, phy_cfg, sizeof(*phy_cfg));