Skip to content

Commit

Permalink
phy: realtek: usb: fix NULL deref in rtk_usb3phy_probe
Browse files Browse the repository at this point in the history
In rtk_usb3phy_probe() devm_kzalloc() may return NULL
but this returned value is not checked.

Fixes: adda6e8 ("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>
  • Loading branch information
Charles Han authored and Greg Kroah-Hartman committed Nov 4, 2024
1 parent 04e3e91 commit bf373d2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/phy/realtek/phy-rtk-usb3.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down

0 comments on commit bf373d2

Please sign in to comment.