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:   Mon, 16 May 2022 14:23:42 +0300
From:   Vladimir Oltean <olteanv@...il.com>
To:     Arun Ramadoss <arun.ramadoss@...rochip.com>
Cc:     linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
        Russell King <linux@...linux.org.uk>,
        Woojung Huh <woojung.huh@...rochip.com>,
        UNGLinuxDriver@...rochip.com, Andrew Lunn <andrew@...n.ch>,
        Vivien Didelot <vivien.didelot@...il.com>,
        Florian Fainelli <f.fainelli@...il.com>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>,
        Oleksij Rempel <linux@...pel-privat.de>,
        Marek Vasut <marex@...x.de>,
        Michael Grzeschik <m.grzeschik@...gutronix.de>,
        Eric Dumazet <edumazet@...gle.com>
Subject: Re: [RFC Patch net-next v2 5/9] net: dsa: microchip: move struct
 mib_names to ksz_chip_data

On Fri, May 13, 2022 at 03:52:15PM +0530, Arun Ramadoss wrote:
> The ksz88xx family has one set of mib_names. The ksz87xx, ksz9477,
> LAN937x based switches has one set of mib_names. In order to remove
> redundant declaration, moved the struct mib_names to ksz_chip_data
> structure. And allocated the mib memory in switch_register instead of
> individual switch_init function.
> 
> Signed-off-by: Arun Ramadoss <arun.ramadoss@...rochip.com>
> ---
>  static int ksz9477_switch_init(struct ksz_device *dev)
>  {
> -	int i;
> -
>  	dev->ds->ops = &ksz9477_switch_ops;
>  
>  	dev->port_mask = (1 << dev->info->port_cnt) - 1;
>  
> -	dev->reg_mib_cnt = SWITCH_COUNTER_NUM;
> -	dev->mib_cnt = TOTAL_SWITCH_COUNTER_NUM;
> -
> -	for (i = 0; i < dev->info->port_cnt; i++) {
> -		spin_lock_init(&dev->ports[i].mib.stats64_lock);
> -		mutex_init(&dev->ports[i].mib.cnt_mutex);
> -		dev->ports[i].mib.counters =
> -			devm_kzalloc(dev->dev,
> -				     sizeof(u64) *
> -				     (TOTAL_SWITCH_COUNTER_NUM + 1),
> -				     GFP_KERNEL);
> -		if (!dev->ports[i].mib.counters)
> -			return -ENOMEM;
> -	}
> -

This fixes the NULL pointer dereference on probe that was introduced in
the previous patch, but please make sure that this does not happen in
the first place, for bisectability purposes.

>  	return 0;
>  }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ