summaryrefslogtreecommitdiff
path: root/drivers/phy
diff options
context:
space:
mode:
authorCharles Han <hanchunchao@inspur.com>2024-10-25 14:59:12 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-11-04 02:03:17 +0100
commit04e3e9188291a183b27306ddb833722c0d083d6a (patch)
treeacae985fdbd8e82bb36805a604b3e7fcf7225ed3 /drivers/phy
parent7c561b8c3e83687064c957c394ed9fe49e38fe00 (diff)
downloadlwn-04e3e9188291a183b27306ddb833722c0d083d6a.tar.gz
lwn-04e3e9188291a183b27306ddb833722c0d083d6a.zip
phy: realtek: usb: fix NULL deref in rtk_usb2phy_probe
In rtk_usb2phy_probe() devm_kzalloc() may return NULL but this returned value is not checked. Fixes: 134e6d25f6bd ("phy: realtek: usb: Add driver for the Realtek SoC USB 2.0 PHY") Signed-off-by: Charles Han <hanchunchao@inspur.com> Link: https://lore.kernel.org/r/20241025065912.143692-1-hanchunchao@inspur.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/phy')
-rw-r--r--drivers/phy/realtek/phy-rtk-usb2.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/phy/realtek/phy-rtk-usb2.c b/drivers/phy/realtek/phy-rtk-usb2.c
index e3ad7cea5109..e8ca2ec5998f 100644
--- a/drivers/phy/realtek/phy-rtk-usb2.c
+++ b/drivers/phy/realtek/phy-rtk-usb2.c
@@ -1023,6 +1023,8 @@ static int rtk_usb2phy_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));