Skip to content

Commit

Permalink
usb: musb: tusb6010: check return value after calling platform_get_re…
Browse files Browse the repository at this point in the history
…source()

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

Signed-off-by: Yang Yingliang <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
Yang Yingliang authored and gregkh committed Sep 21, 2021
1 parent c03d369 commit 1465149
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/usb/musb/tusb6010.c
Original file line number Diff line number Diff line change
Expand Up @@ -1103,6 +1103,11 @@ static int tusb_musb_init(struct musb *musb)

/* dma address for async dma */
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!mem) {
pr_debug("no async dma resource?\n");
ret = -ENODEV;
goto done;
}
musb->async = mem->start;

/* dma address for sync dma */
Expand Down

0 comments on commit 1465149

Please sign in to comment.