Skip to content

Commit

Permalink
usb: misc: brcmstb-usb-pinmap: check return value after calling platf…
Browse files Browse the repository at this point in the history
…orm_get_resource()

It will cause null-ptr-deref if platform_get_resource() returns NULL,
we need check the return value.

Fixes: 517c4c4 ("usb: Add driver to allow any GPIO to be used for 7211 USB signals")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20210605080914.2057758-1-yangyingliang@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Yang Yingliang authored and Greg Kroah-Hartman committed Jun 9, 2021
1 parent d008890 commit fbf649c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/usb/misc/brcmstb-usb-pinmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@ static int __init brcmstb_usb_pinmap_probe(struct platform_device *pdev)
return -EINVAL;

r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!r)
return -EINVAL;

pdata = devm_kzalloc(&pdev->dev,
sizeof(*pdata) +
Expand Down

0 comments on commit fbf649c

Please sign in to comment.