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]
Date:   Wed, 26 Dec 2018 10:08:28 -0800
From:   Shannon Nelson <shannon.lee.nelson@...il.com>
To:     Kangjie Lu <kjlu@....edu>
Cc:     pakki001@....edu, "David S. Miller" <davem@...emloft.net>,
        Shannon Nelson <shannon.nelson@...cle.com>,
        Colin Ian King <colin.king@...onical.com>,
        Rob Taglang <rob@...lang.io>, Joe Perches <joe@...ches.com>,
        netdev@...r.kernel.org, linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] ethernet: (niu) fix missing checks of niu_pci_eeprom_read

On Mon, Dec 24, 2018 at 11:58 PM Kangjie Lu <kjlu@....edu> wrote:
>
> niu_pci_eeprom_read() may fail, so we should check its return value
> before using the read data.
>
> Signed-off-by: Kangjie Lu <kjlu@....edu>
> ---
>  drivers/net/ethernet/sun/niu.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c
> index 9319d84bf49f..d84501441edd 100644
> --- a/drivers/net/ethernet/sun/niu.c
> +++ b/drivers/net/ethernet/sun/niu.c
> @@ -8100,6 +8100,8 @@ static int niu_pci_vpd_scan_props(struct niu *np, u32 start, u32 end)
>                 start += 3;
>
>                 prop_len = niu_pci_eeprom_read(np, start + 4);
> +               if (prop_len < 0)
> +                       return prop_len;
>                 err = niu_pci_vpd_get_propname(np, start + 5, namebuf, 64);
>                 if (err < 0)
>                         return err;
> @@ -8144,8 +8146,12 @@ static int niu_pci_vpd_scan_props(struct niu *np, u32 start, u32 end)
>                         netif_printk(np, probe, KERN_DEBUG, np->dev,
>                                      "VPD_SCAN: Reading in property [%s] len[%d]\n",
>                                      namebuf, prop_len);
> -                       for (i = 0; i < prop_len; i++)
> -                               *prop_buf++ = niu_pci_eeprom_read(np, off + i);
> +                       for (i = 0; i < prop_len; i++) {
> +                               err = niu_pci_eeprom_read(np, off + i);
> +                               if (err >= 0)
> +                                       *prop_buf = err;
> +                               ++prop_buf;
> +                       }
>                 }
>
>                 start += len;
> --
> 2.17.2 (Apple Git-113)
>

Acked-by: Shannon Nelson <shannon.lee.nelson@...il.com>

-- 
==============================================
Mr. Shannon Nelson         Parents can't afford to be squeamish.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ