usb: chipidea: ci_hdrc_imx: fix usbmisc handling
commit 4e28f79e3dffa52d327b46d1a78dac16efb5810b upstream.
usbmisc is an optional device property so it is totally valid for the
corresponding data->usbmisc_data to have a NULL value.
Check that before dereferencing the pointer.
Found by Linux Verification Center (linuxtesting.org) with Svace static
analysis tool.
Fixes: 74adad500346 ("usb: chipidea: ci_hdrc_imx: decrement device's refcount in .remove() and in the error path of .probe()")
Cc: stable <stable@kernel.org>
Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
Acked-by: Peter Chen <peter.chen@kernel.org>
Link: https://lore.kernel.org/r/20250316102658.490340-2-pchelkin@ispras.ru
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
74cd6e408a
commit
887902ca73
@@ -534,7 +534,8 @@ disable_hsic_regulator:
|
||||
cpu_latency_qos_remove_request(&data->pm_qos_req);
|
||||
data->ci_pdev = NULL;
|
||||
err_put:
|
||||
put_device(data->usbmisc_data->dev);
|
||||
if (data->usbmisc_data)
|
||||
put_device(data->usbmisc_data->dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -559,7 +560,8 @@ static void ci_hdrc_imx_remove(struct platform_device *pdev)
|
||||
if (data->hsic_pad_regulator)
|
||||
regulator_disable(data->hsic_pad_regulator);
|
||||
}
|
||||
put_device(data->usbmisc_data->dev);
|
||||
if (data->usbmisc_data)
|
||||
put_device(data->usbmisc_data->dev);
|
||||
}
|
||||
|
||||
static void ci_hdrc_imx_shutdown(struct platform_device *pdev)
|
||||
|
||||
Reference in New Issue
Block a user