mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-25 06:46:00 +00:00
phy: Fix possible NULL pointer deference
It is possible that users of generic_phy_*() APIs may pass a valid struct phy pointer but phy->dev can be NULL, leading to NULL pointer deference in phy_dev_ops(). So call generic_phy_valid() to verify that phy and phy->dev are both valid. Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
This commit is contained in:
parent
f4c1f705aa
commit
64b69f8c89
1 changed files with 5 additions and 5 deletions
|
@ -118,7 +118,7 @@ int generic_phy_init(struct phy *phy)
|
||||||
{
|
{
|
||||||
struct phy_ops const *ops;
|
struct phy_ops const *ops;
|
||||||
|
|
||||||
if (!phy)
|
if (!generic_phy_valid(phy))
|
||||||
return 0;
|
return 0;
|
||||||
ops = phy_dev_ops(phy->dev);
|
ops = phy_dev_ops(phy->dev);
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ int generic_phy_reset(struct phy *phy)
|
||||||
{
|
{
|
||||||
struct phy_ops const *ops;
|
struct phy_ops const *ops;
|
||||||
|
|
||||||
if (!phy)
|
if (!generic_phy_valid(phy))
|
||||||
return 0;
|
return 0;
|
||||||
ops = phy_dev_ops(phy->dev);
|
ops = phy_dev_ops(phy->dev);
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ int generic_phy_exit(struct phy *phy)
|
||||||
{
|
{
|
||||||
struct phy_ops const *ops;
|
struct phy_ops const *ops;
|
||||||
|
|
||||||
if (!phy)
|
if (!generic_phy_valid(phy))
|
||||||
return 0;
|
return 0;
|
||||||
ops = phy_dev_ops(phy->dev);
|
ops = phy_dev_ops(phy->dev);
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ int generic_phy_power_on(struct phy *phy)
|
||||||
{
|
{
|
||||||
struct phy_ops const *ops;
|
struct phy_ops const *ops;
|
||||||
|
|
||||||
if (!phy)
|
if (!generic_phy_valid(phy))
|
||||||
return 0;
|
return 0;
|
||||||
ops = phy_dev_ops(phy->dev);
|
ops = phy_dev_ops(phy->dev);
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ int generic_phy_power_off(struct phy *phy)
|
||||||
{
|
{
|
||||||
struct phy_ops const *ops;
|
struct phy_ops const *ops;
|
||||||
|
|
||||||
if (!phy)
|
if (!generic_phy_valid(phy))
|
||||||
return 0;
|
return 0;
|
||||||
ops = phy_dev_ops(phy->dev);
|
ops = phy_dev_ops(phy->dev);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue