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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+h21ho_pibJNnYkyYrJGACmwU16Qk3ZZ=BJEqQjBbK3CW+Gog@mail.gmail.com>
Date:   Wed, 18 Sep 2019 23:40:59 +0300
From:   Vladimir Oltean <olteanv@...il.com>
To:     Navid Emamdoost <navid.emamdoost@...il.com>
Cc:     Navid Emamdoost <emamd001@....edu>,
        Stephen McCamant <smccaman@....edu>, kjlu@....edu,
        Andrew Lunn <andrew@...n.ch>,
        Vivien Didelot <vivien.didelot@...il.com>,
        Florian Fainelli <f.fainelli@...il.com>,
        "David S. Miller" <davem@...emloft.net>,
        lkml <linux-kernel@...r.kernel.org>,
        netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH v3] net: dsa: sja1105: prevent leaking memory

On Wed, 18 Sep 2019 at 23:34, Navid Emamdoost <navid.emamdoost@...il.com> wrote:
>
> In sja1105_static_config_upload, in two cases memory is leaked: when
> static_config_buf_prepare_for_upload fails and when sja1105_inhibit_tx
> fails. In both cases config_buf should be released.
>
> Fixes: 8aa9ebccae87 ("net: dsa: Introduce driver for NXP SJA1105 5-port
> L2 switch")
>
> Fixes: 1a4c69406cc1 ("net: dsa: sja1105: Prevent PHY jabbering during
> switch reset")
>
> Signed-off-by: Navid Emamdoost <navid.emamdoost@...il.com>
> ---

Reviewed-by: Vladimir Oltean <olteanv@...il.com>

>  drivers/net/dsa/sja1105/sja1105_spi.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/dsa/sja1105/sja1105_spi.c b/drivers/net/dsa/sja1105/sja1105_spi.c
> index 84dc603138cf..58dd37ecde17 100644
> --- a/drivers/net/dsa/sja1105/sja1105_spi.c
> +++ b/drivers/net/dsa/sja1105/sja1105_spi.c
> @@ -409,7 +409,8 @@ int sja1105_static_config_upload(struct sja1105_private *priv)
>         rc = static_config_buf_prepare_for_upload(priv, config_buf, buf_len);
>         if (rc < 0) {
>                 dev_err(dev, "Invalid config, cannot upload\n");
> -               return -EINVAL;
> +               rc = -EINVAL;
> +               goto out;
>         }
>         /* Prevent PHY jabbering during switch reset by inhibiting
>          * Tx on all ports and waiting for current packet to drain.
> @@ -418,7 +419,8 @@ int sja1105_static_config_upload(struct sja1105_private *priv)
>         rc = sja1105_inhibit_tx(priv, port_bitmap, true);
>         if (rc < 0) {
>                 dev_err(dev, "Failed to inhibit Tx on ports\n");
> -               return -ENXIO;
> +               rc = -ENXIO;
> +               goto out;
>         }
>         /* Wait for an eventual egress packet to finish transmission
>          * (reach IFG). It is guaranteed that a second one will not
> --
> 2.17.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ