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: <20231213192652.GA1054534@bhelgaas>
Date:   Wed, 13 Dec 2023 13:26:52 -0600
From:   Bjorn Helgaas <helgaas@...nel.org>
To:     Jim Harris <jim.harris@...sung.com>
Cc:     Bjorn Helgaas <bhelgaas@...gle.com>,
        "linux-pci@...r.kernel.org" <linux-pci@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Leon Romanovsky <leonro@...dia.com>,
        Jason Gunthorpe <jgg@...dia.com>,
        Alex Williamson <alex.williamson@...hat.com>
Subject: Re: [PATCH] pci/iov: fix kobject_uevent() ordering in sriov_enable()

On Wed, Dec 13, 2023 at 06:58:28PM +0000, Jim Harris wrote:
> Wait to call kobject_uevent() until all of the associated changes are done,
> including updating the num_VFs value.

This seems right to me.  Can we add a little rationale to the commit
log?  E.g., something about how num_VFs is visible to userspace via
sysfs and we don't want a race between (a) userspace reading num_VFs
because of KOBJ_CHANGE and (b) the kernel updating num_VFs?  (If
that's the actual reason.)

If there's a problem report about this, include that reference as
well.

> Suggested by: Leon Romanovsky <leonro@...dia.com>
> Signed-off-by: Jim Harris <jim.harris@...sung.com>
> ---
>  drivers/pci/iov.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
> index 25dbe85c4217..3b768e20c7ab 100644
> --- a/drivers/pci/iov.c
> +++ b/drivers/pci/iov.c
> @@ -683,8 +683,8 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn)
>  	if (rc)
>  		goto err_pcibios;
>  
> -	kobject_uevent(&dev->dev.kobj, KOBJ_CHANGE);
>  	iov->num_VFs = nr_virtfn;
> +	kobject_uevent(&dev->dev.kobj, KOBJ_CHANGE);
>  
>  	return 0;
>  
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ