lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sat, 5 Sep 2015 21:18:40 +0200
From:	Andrew Lunn <andrew@...n.ch>
To:	Michael Welling <mwelling@...e.org>
Cc:	Florian Fainelli <f.fainelli@...il.com>, netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net: phy: Handle postive return codes in phy_connect

On Sat, Sep 05, 2015 at 01:01:29PM -0500, Michael Welling wrote:
> The function phy_connect_direct can possibly return a positive
> return code. Using ERR_PTR with a positive value can lead to
> deferencing of an invalid pointer.

Is this the correct fix? Would it not be better to find where the
positive return code is from and fix that?

	 Andrew

> Signed-off-by: Michael Welling <mwelling@...e.org>
> ---
>  drivers/net/phy/phy_device.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
> index c0f2111..a7e14a6 100644
> --- a/drivers/net/phy/phy_device.c
> +++ b/drivers/net/phy/phy_device.c
> @@ -477,6 +477,9 @@ struct phy_device *phy_connect(struct net_device *dev, const char *bus_id,
>  	phydev = to_phy_device(d);
>  
>  	rc = phy_connect_direct(dev, phydev, handler, interface);
> +	if (rc > 0)
> +		return ERR_PTR(-ENODEV);
> +
>  	if (rc)
>  		return ERR_PTR(rc);
>  
> -- 
> 2.1.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ