Skip to content

Commit fbf649c

Browse files
Yang Yinglianggregkh
authored andcommitted
usb: misc: brcmstb-usb-pinmap: check return value after calling platform_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>
1 parent d008890 commit fbf649c

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/usb/misc/brcmstb-usb-pinmap.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,8 @@ static int __init brcmstb_usb_pinmap_probe(struct platform_device *pdev)
263263
return -EINVAL;
264264

265265
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
266+
if (!r)
267+
return -EINVAL;
266268

267269
pdata = devm_kzalloc(&pdev->dev,
268270
sizeof(*pdata) +

0 commit comments

Comments
 (0)