2
0
mirror of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-09-04 20:19:47 +08:00

Compare commits

...

6 Commits

Author SHA1 Message Date
Linus Torvalds
fab1beda75 Devicetree fixes for v6.17, part 1:
- Fix a memory leak for of_pci_add_properties() failure case. Then fix
   the introduced UAF.
 
 - Add missing IORESOURCE_MEM flag on of_reserved_mem_region_to_resource()
 
 - Add already in use vendor prefix "eswin"
 
 - Clarify "of of" comment in of_match_device(). After many years of
   drive-by patches dropping the 2nd "of" (which referred to
   OpenFirmware), a correct patch finally arrived.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEktVUI4SxYhzZyEuo+vtdtY28YcMFAmisyBAACgkQ+vtdtY28
 YcObaw/+JazBJy6SKKZPE0X3Ry69DtOVOgTKFwMAekWwasFGdgzth47Wore9EqmA
 smqwDGMB20NCUzbXCx7NIzzjp5enH9OQOcSyXN/xHRE6khg4t3Qq0iYfevfwXRtv
 Y9eTYIGoUvdVcxObpbbRGPq9AszUlwQBCpQcTJKl2MiHGqa3IpBrr0ypMjxXtstY
 Om7q51iKSi5yIYO2lxPgXRI6PtT2q8MisoyNHnGocsY3xnNBQb1RDBJe70R3XXZP
 78piVoumBb/3jnH1qsCFLGi6RSR/chjb8JwAJ4SuGpCVzWhmysLQJP72SggTIptq
 Z5igbf7bQ5FhWab+XhMGg9OsaXEnZ58Qvg1KAswwU3/k3MN8w5V4qLLOPTFI3m8w
 K7etUL91lw6q5EguzZ5VveV9qPagu8waTPP56JfA597IR6VdT9omT1XAPbeM2nrz
 0k7qnX/9Pb3M400Z6jNu1Fk++c4xzC0+w8T2acE3BGVwnGzCf9tdDd8ixlCDDWPx
 HsQxbnFjxggRBqulrR4IElCSEYcbwHgLh4WWNJVmDsJFBvZUQ0mscgDT9/bkELu1
 IHvvwoeY1saa+oI3PkhVvhE+yA9wmMrTrb61/hIFliU3sDJfn/notNWdOy5Rbtci
 e+5ec6LFZnW6Ig8XG9o3FYFdv5rcHk8ExdqIiQosYgNirRdLVgM=
 =0m5V
 -----END PGP SIGNATURE-----

Merge tag 'devicetree-fixes-for-6.17-1' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux

Pull devicetree fixes from Rob Herring:

 - Fix a memory leak for of_pci_add_properties() failure case. Then fix
   the introduced UAF.

 - Add missing IORESOURCE_MEM flag on of_reserved_mem_region_to_resource()

 - Add already in use vendor prefix "eswin"

 - Clarify "of of" comment in of_match_device(). After many years of
   drive-by patches dropping the 2nd "of" (which referred to
   OpenFirmware), a correct patch finally arrived

* tag 'devicetree-fixes-for-6.17-1' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux:
  of: dynamic: Fix use after free in of_changeset_add_prop_helper()
  dt-bindings: vendor-prefixes: add eswin
  of: reserved_mem: Add missing IORESOURCE_MEM flag on resources
  of: dynamic: Fix memleak when of_pci_add_properties() failed
  of: Clarify OF device context in of_match_device() comment
2025-08-25 18:47:58 -07:00
Dan Carpenter
80af3745ca of: dynamic: Fix use after free in of_changeset_add_prop_helper()
If the of_changeset_add_property() function call fails, then this code
frees "new_pp" and then dereference it on the next line.  Return the
error code directly instead.

Fixes: c81f6ce167 ("of: dynamic: Fix memleak when of_pci_add_properties() failed")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/aKgljjhnpa4lVpdx@stanley.mountain
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
2025-08-22 16:21:35 -05:00
Pritesh Patel
ac29e4487a dt-bindings: vendor-prefixes: add eswin
Add new vendor string to dt bindings.
This new vendor string is used by
- ESWIN EIC770X SoC
- HiFive Premier P550 board which uses EIC7700 SoC.

Link: https://www.eswin.com/en/
Signed-off-by: Pritesh Patel <pritesh.patel@einfochips.com>
Reviewed-by: Samuel Holland <samuel.holland@sifive.com>
Signed-off-by: Pinkesh Vaghela <pinkesh.vaghela@einfochips.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20250616112316.3833343-4-pinkesh.vaghela@einfochips.com
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
2025-08-21 14:10:39 -05:00
Rob Herring (Arm)
aea70964b5 of: reserved_mem: Add missing IORESOURCE_MEM flag on resources
Commit f4fcfdda2f ('of: reserved_mem: Add functions to parse
"memory-region"') failed to set IORESOURCE_MEM flag on the resources.
The result is functions such as devm_ioremap_resource_wc() will fail.
Add the missing flag.

Fixes: f4fcfdda2f ('of: reserved_mem: Add functions to parse "memory-region"')
Reported-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Reported-by: Daniel Baluta <daniel.baluta@gmail.com>
Tested-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Reviewed-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Reviewed-by: Saravana Kannan <saravanak@google.com>
Link: https://lore.kernel.org/r/20250820192805.565568-1-robh@kernel.org
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
2025-08-21 12:21:36 -05:00
Lizhi Hou
c81f6ce167 of: dynamic: Fix memleak when of_pci_add_properties() failed
When of_pci_add_properties() failed, of_changeset_destroy() is called to
free the changeset. And of_changeset_destroy() puts device tree node in
each entry but does not free property in the entry. This leads to memory
leak in the failure case.

In of_changeset_add_prop_helper(), add the property to the device tree node
deadprops list. Thus, the property will also be freed along with device
tree node.

Fixes: b544fc2b86 ("of: dynamic: Add interfaces for creating device node dynamically")
Reported-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
Closes: https://lore.kernel.org/all/aJms+YT8TnpzpCY8@lpieralisi/
Tested-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
Link: https://lore.kernel.org/r/20250818152221.3685724-1-lizhi.hou@amd.com
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
2025-08-20 18:37:51 -05:00
Bagas Sanjaya
79aef1a370 of: Clarify OF device context in of_match_device() comment
Open Firmware abbreviation (OF) in of_match_device() comment is written
in lowercase instead, which is mistaken for prepositional word "of"
([1], [2], [3], [4]) duplicate.

Clarify the context.

Link: https://lore.kernel.org/all/CAL_JsqLypcBCOVZ8yYWK0J_xc2Vcr+ANrX_3v4vN55Srp4RknQ@mail.gmail.com/ [1]
Link: https://lore.kernel.org/all/20220926185852.GA2581083-robh@kernel.org/ [2]
Link: https://lore.kernel.org/all/CAL_JsqL4GvgFYzGUfhW5pvm4wYGrFaj6gHOYZjnOMuk2zCz67w@mail.gmail.com/ [3]
Link: https://lore.kernel.org/all/20220627173825.GA2637590-robh@kernel.org/ [4]
Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
Link: https://lore.kernel.org/r/20250730013113.11264-1-bagasdotme@gmail.com
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
2025-07-30 17:49:06 -05:00
4 changed files with 12 additions and 4 deletions

View File

@ -507,6 +507,8 @@ patternProperties:
description: Espressif Systems Co. Ltd.
"^est,.*":
description: ESTeem Wireless Modems
"^eswin,.*":
description: Beijing ESWIN Technology Group Co. Ltd.
"^ettus,.*":
description: NI Ettus Research
"^eukrea,.*":

View File

@ -17,8 +17,8 @@
/**
* of_match_device - Tell if a struct device matches an of_device_id list
* @matches: array of of device match structures to search in
* @dev: the of device structure to match against
* @matches: array of of_device_id match structures to search in
* @dev: the OF device structure to match against
*
* Used by a driver to check whether an platform_device present in the
* system is in its list of supported devices.

View File

@ -935,10 +935,15 @@ static int of_changeset_add_prop_helper(struct of_changeset *ocs,
return -ENOMEM;
ret = of_changeset_add_property(ocs, np, new_pp);
if (ret)
if (ret) {
__of_prop_free(new_pp);
return ret;
}
return ret;
new_pp->next = np->deadprops;
np->deadprops = new_pp;
return 0;
}
/**

View File

@ -771,6 +771,7 @@ int of_reserved_mem_region_to_resource(const struct device_node *np,
return -EINVAL;
resource_set_range(res, rmem->base, rmem->size);
res->flags = IORESOURCE_MEM;
res->name = rmem->name;
return 0;
}