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: <0b1be7b7-e65b-8d8e-0659-388dec303039@amd.com>
Date: Fri, 26 Jul 2024 11:45:03 -0700
From: Lizhi Hou <lizhi.hou@....com>
To: Rob Herring <robh@...nel.org>
CC: <linux-pci@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
	<devicetree@...r.kernel.org>, <linuxppc-dev@...ts.ozlabs.org>,
	<kvm-ppc@...r.kernel.org>, Bjorn Helgaas <bhelgaas@...gle.com>, Saravana
 Kannan <saravanak@...gle.com>, Vaibhav Jain <vaibhav@...ux.ibm.com>, Nicholas
 Piggin <npiggin@...il.com>, Michael Ellerman <mpe@...erman.id.au>,
	Vaidyanathan Srinivasan <svaidy@...ux.ibm.com>, Kowshik Jois B S
	<kowsjois@...ux.ibm.com>, Lukas Wunner <lukas@...ner.de>
Subject: Re: [PATCH v2] PCI: Fix crash during pci_dev hot-unplug on pseries
 KVM guest


On 7/26/24 10:52, Rob Herring wrote:
> On Thu, Jul 25, 2024 at 6:06 PM Lizhi Hou <lizhi.hou@....com> wrote:
>> Hi Amit,
>>
>>
>> I try to follow the option which add a OF flag. If Rob is ok with this,
>> I would suggest to use it instead of V1 patch
>>
>> diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c
>> index dda6092e6d3a..a401ed0463d9 100644
>> --- a/drivers/of/dynamic.c
>> +++ b/drivers/of/dynamic.c
>> @@ -382,6 +382,11 @@ void of_node_release(struct kobject *kobj)
>>                                  __func__, node);
>>           }
>>
>> +       if (of_node_check_flag(node, OF_CREATED_WITH_CSET)) {
>> +               of_changeset_revert(node->data);
>> +               of_changeset_destroy(node->data);
>> +       }
> What happens if multiple nodes are created in the changeset?
Ok. multiple nodes will not work.
>
>> +
>>           if (node->child)
>>                   pr_err("ERROR: %s() unexpected children for %pOF/%s\n",
>>                           __func__, node->parent, node->full_name);
>> @@ -507,6 +512,7 @@ struct device_node *of_changeset_create_node(struct
>> of_changeset *ocs,
>>           np = __of_node_dup(NULL, full_name);
>>           if (!np)
>>                   return NULL;
>> +       of_node_set_flag(np, OF_CREATED_WITH_CSET);
> This should be set where the data ptr is set.

Ok. It sounds the fix could be simplified to 3 lines change.


diff --git a/drivers/pci/of.c b/drivers/pci/of.c
index 51e3dd0ea5ab..0b3ba1e1b18c 100644
--- a/drivers/pci/of.c
+++ b/drivers/pci/of.c
@@ -613,7 +613,7 @@ void of_pci_remove_node(struct pci_dev *pdev)
         struct device_node *np;

         np = pci_device_to_OF_node(pdev);
-       if (!np || !of_node_check_flag(np, OF_DYNAMIC))
+       if (!np || !of_node_check_flag(np, OF_CREATED_WITH_CSET))
                 return;
         pdev->dev.of_node = NULL;

@@ -672,6 +672,7 @@ void of_pci_make_dev_node(struct pci_dev *pdev)
         if (ret)
                 goto out_free_node;

+       of_node_set_flag(np, OF_CREATED_WITH_CSET);
         np->data = cset;
         pdev->dev.of_node = np;
         kfree(name);
diff --git a/include/linux/of.h b/include/linux/of.h
index a0bedd038a05..a46317f6626e 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -153,6 +153,7 @@ extern struct device_node *of_stdout;
  #define OF_POPULATED_BUS       4 /* platform bus created for children */
  #define OF_OVERLAY             5 /* allocated for an overlay */
  #define OF_OVERLAY_FREE_CSET   6 /* in overlay cset being freed */
+#define OF_CREATED_WITH_CSET    7 /* created by of_changeset_create_node */

  #define OF_BAD_ADDR    ((u64)-1)


Lizhi

>
> Rob

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ