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: <20220510190927.56004f10@kernel.org>
Date:   Tue, 10 May 2022 19:09:27 -0700
From:   Jakub Kicinski <kuba@...nel.org>
To:     Tony Nguyen <anthony.l.nguyen@...el.com>
Cc:     davem@...emloft.net, pabeni@...hat.com, edumazet@...gle.com,
        Mateusz Palczewski <mateusz.palczewski@...el.com>,
        netdev@...r.kernel.org, sassmann@...hat.com,
        Sylwester Dziedziuch <sylwesterx.dziedziuch@...el.com>,
        Konrad Jankowski <konrad0.jankowski@...el.com>
Subject: Re: [PATCH net-next 2/2] iavf: Add waiting for response from PF in
 set mac

On Mon,  9 May 2022 10:35:47 -0700 Tony Nguyen wrote:
> +static int iavf_set_mac(struct net_device *netdev, void *p)
> +{
> +	struct iavf_adapter *adapter = netdev_priv(netdev);
> +	struct sockaddr *addr = p;
> +	bool handle_mac = iavf_is_mac_set_handled(netdev, addr->sa_data);
> +	int ret;
> +
> +	if (!is_valid_ether_addr(addr->sa_data))
> +		return -EADDRNOTAVAIL;
> +
> +	ret = iavf_replace_primary_mac(adapter, addr->sa_data);
> +
> +	if (ret)
> +		return ret;
> +
> +	/* If this is an initial set mac during VF spawn do not wait */
> +	if (adapter->flags & IAVF_FLAG_INITIAL_MAC_SET) {
> +		adapter->flags &= ~IAVF_FLAG_INITIAL_MAC_SET;
> +		return 0;
> +	}
> +
> +	ret = wait_event_interruptible_timeout(adapter->vc_waitqueue, handle_mac, msecs_to_jiffies(2500));

Passing in a value as a condition looks a little odd, are you sure this
is what you want? Because you can rewrite this as:

	if (handled_mac)
		goto done;

	ret = wait_eve..(wq, false, msecs...);
	if (ret < 0)
		...
	if (!ret)
		...

done:
	if (!ether_addr_equal(netdev->dev_addr, addr->sa_data))
		return -EACCESS;
	return 0;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ