Re: [PATCH] usb: typec: fix null-pointer-dereference in wcove_typec_probe()

Greg KH <[email protected]>
Newsgroups org.kernel.vger.stable,org.kernel.vger.linux-kernel,org.kernel.vger.linux-usb
Message-ID <2026082125-getting-upstroke-a146@gregkh>
On Fri, Aug 21, 2026 at 07:22:46PM +0530, Jeffin Philip wrote:
> dev_get_drvdata() on the parent device can return NULL if we attempt to
> bind our device as a root device with no parent. This causes a null pointer
> dereference when accessing pmic->regmap later as pmic uses the parent
> struct. Fix this by adding a NULL check for pmic and returning -ENODEV
> if to_platform_device() returns NULL for pmic.
> 
> Reported-by: [email protected]
> Closes: https://syzkaller.appspot.com/bug?extid=1a01783ea233350598b5
> Fixes: d2061f9cc32d ("usb: typec: add driver for Intel Whiskey Cove PMIC USB Type-C PHY")
> Cc: [email protected]
> Signed-off-by: Jeffin Philip <[email protected]>
> ---
>  drivers/usb/typec/tcpm/wcove.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/usb/typec/tcpm/wcove.c b/drivers/usb/typec/tcpm/wcove.c
> index 0e5a3e277c3e..80bca8edeba6 100644
> --- a/drivers/usb/typec/tcpm/wcove.c
> +++ b/drivers/usb/typec/tcpm/wcove.c
> @@ -612,6 +612,10 @@ static int wcove_typec_probe(struct platform_device *pdev)
>  	int irq;
>  	int ret;
>  
> +	/* check if we have a parent device first */
> +	if (!pmic)
> +		return -ENODEV;

How can a platform device NOT have a parent device?  WHat system is this
broken in?  Why not fix the platform definition properly instead as
something is really wrong here if this is a "root" platform device as
that should never happen.

thanks,

greg k-h
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.