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] [day] [month] [year] [list]
Message-ID: <eee87b139519684c1b2eb7d5f259580b29fc6841.camel@kernel.org>
Date:   Mon, 18 Oct 2021 16:35:12 +0300
From:   Jarkko Sakkinen <jarkko@...nel.org>
To:     Dave Hansen <dave.hansen@...ux.intel.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        x86@...nel.org, "H. Peter Anvin" <hpa@...or.com>
Cc:     reinette.chatre@...el.com, tony.luck@...el.com,
        linux-kernel@...r.kernel.org, linux-sgx@...r.kernel.org
Subject: Re: [PATCH v7 2/2] x86/sgx: Add an attribute for the amount of SGX
 memory in a NUMA node

On Fri, 2021-10-08 at 23:33 +0300, Jarkko Sakkinen wrote:
> +static void sgx_numa_exit(void)
> +{
> +       struct device *dev;
> +       int nid;
> +
> +       for (nid = 0; nid < num_possible_nodes(); nid++) {
> +               dev = &node_devices[nid]->dev;
> +               if (dev)
> +                       sysfs_remove_group(&dev->kobj, &sgx_node_attr_group);
> +       }
> +}
> +
> +static bool sgx_numa_init(void)
> +{
> +       struct sgx_numa_node *node;
> +       int nid;
> +       int ret;
> +
> +       for (nid = 0; nid < num_possible_nodes(); nid++) {
> +               if (!sgx_numa_nodes[nid].size)
> +                       continue;
> +
> +               node = &sgx_numa_nodes[nid];
> +               node->dev = &node_devices[nid]->dev;
> +
> +               ret = sysfs_create_group(&node->dev->kobj, &sgx_node_attr_group);
> +               if (ret) {
> +                       sgx_numa_exit();
> +                       return false;
> +               }
> +       }

Here's a mistake: node->dev should be only set after sysfe_create_group().
Otherwise, sysfs_remove_group() will issue a warning in sgx_numa_exit(), when
sgx_create_group() is unsuccessful, because the group does not exist.

I'll fix this, and send a new version.

/Jarkko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ