Skip to content

Commit

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

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

Expand Down

0 comments on commit 04e3e91

Please sign in to comment.