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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <99b786b5-8e27-a5a5-6130-e03028e6e82c@cogentembedded.com>
Date:   Tue, 25 Sep 2018 11:50:44 +0300
From:   Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To:     Andrew Lunn <andrew@...n.ch>, David Miller <davem@...emloft.net>
Cc:     netdev <netdev@...r.kernel.org>,
        Florian Fainelli <f.fainelli@...il.com>,
        Russell King <rmk+kernel@....linux.org.uk>
Subject: Re: [PATCH net] net: phy: sfp: Fix unregistering of HWMON SFP device

Hello!

On 9/25/2018 1:38 AM, Andrew Lunn wrote:

> A HWMON device is only registered is the SFP module supports the

    s/is/if/?

> diagnostic page and is complient to SFF8472. Don't unconditionally

    Compliant?

> unregister the hwmon device when the SFP module is remove, otherwise
> we access data structures which don't exist.
> 
> Reported-by: Florian Fainelli <f.fainelli@...il.com>
> Fixes: 1323061a018a ("net: phy: sfp: Add HWMON support for module sensors")
> Signed-off-by: Andrew Lunn <andrew@...n.ch>
> ---
>   drivers/net/phy/sfp.c | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
> index 52fffb98fde9..23705ffae6bb 100644
> --- a/drivers/net/phy/sfp.c
> +++ b/drivers/net/phy/sfp.c
> @@ -1098,8 +1098,11 @@ static int sfp_hwmon_insert(struct sfp *sfp)
>   
>   static void sfp_hwmon_remove(struct sfp *sfp)
>   {
> -	hwmon_device_unregister(sfp->hwmon_dev);
> -	kfree(sfp->hwmon_name);
> +	if (!PTR_ERR_OR_NULL(sfp->hwmon_dev)) {

    Already noticed. :-)

> +		hwmon_device_unregister(sfp->hwmon_dev);
> +		sfp->hwmon_dev = NULL;
> +		kfree(sfp->hwmon_name);
> +	}
>   }
>   #else
>   static int sfp_hwmon_insert(struct sfp *sfp)

MBR, Sergei

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ