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: <20210412112109.145faac8@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date:   Mon, 12 Apr 2021 11:21:09 -0700
From:   Jakub Kicinski <kuba@...nel.org>
To:     Dexuan Cui <decui@...rosoft.com>
Cc:     davem@...emloft.net, kys@...rosoft.com, haiyangz@...rosoft.com,
        sthemmin@...rosoft.com, wei.liu@...nel.org, liuwe@...rosoft.com,
        netdev@...r.kernel.org, leon@...nel.org, andrew@...n.ch,
        bernd@...rovitsch.priv.at, rdunlap@...radead.org,
        shacharr@...rosoft.com, linux-kernel@...r.kernel.org,
        linux-hyperv@...r.kernel.org
Subject: Re: [PATCH v4 net-next] net: mana: Add a driver for Microsoft Azure
 Network Adapter (MANA)

On Sun, 11 Apr 2021 19:34:55 -0700 Dexuan Cui wrote:
> +	for (i = 0; i < ANA_INDIRECT_TABLE_SIZE; i++)
> +		apc->indir_table[i] = i % apc->num_queues;

ethtool_rxfh_indir_default()

> +	err = mana_cfg_vport_steering(apc, rx, true, update_hash, update_tab);
> +	return err;

return mana_...

please fix everywhere.

> +	netif_set_real_num_tx_queues(ndev, apc->num_queues);
> +
> +	err = mana_add_rx_queues(apc, ndev);
> +	if (err)
> +		goto destroy_vport;
> +
> +	apc->rss_state = apc->num_queues > 1 ? TRI_STATE_TRUE : TRI_STATE_FALSE;
> +
> +	netif_set_real_num_rx_queues(ndev, apc->num_queues);

netif_set_real_num_.. can fail.

> +	rtnl_lock();
> +
> +	netdev_lockdep_set_classes(ndev);
> +
> +	ndev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
> +	ndev->hw_features |= NETIF_F_RXCSUM;
> +	ndev->hw_features |= NETIF_F_TSO | NETIF_F_TSO6;
> +	ndev->hw_features |= NETIF_F_RXHASH;
> +	ndev->features = ndev->hw_features;
> +	ndev->vlan_features = 0;
> +
> +	err = register_netdevice(ndev);
> +	if (err) {
> +		netdev_err(ndev, "Unable to register netdev.\n");
> +		goto destroy_vport;
> +	}
> +
> +	rtnl_unlock();
> +
> +	return 0;
> +destroy_vport:
> +	rtnl_unlock();

Why do you take rtnl_lock() explicitly around this code?

> +static int mana_set_channels(struct net_device *ndev,
> +			     struct ethtool_channels *channels)
> +{
> +	struct ana_port_context *apc = netdev_priv(ndev);
> +	unsigned int new_count;
> +	unsigned int old_count;
> +	int err, err2;
> +
> +	new_count = channels->combined_count;
> +	old_count = apc->num_queues;
> +
> +	if (new_count < 1 || new_count > apc->max_queues ||
> +	    channels->rx_count || channels->tx_count || channels->other_count)

All these checks should be done by the core already.

> +		return -EINVAL;
> +
> +	if (new_count == old_count)
> +		return 0;

And so is this one.

> +	err = mana_detach(ndev);
> +	if (err) {
> +		netdev_err(ndev, "mana_detach failed: %d\n", err);
> +		return err;
> +	}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ