Skip to content

Commit fab1bed

Browse files
committed
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
2 parents b6add54 + 80af374 commit fab1bed

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

Documentation/devicetree/bindings/vendor-prefixes.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,8 @@ patternProperties:
507507
description: Espressif Systems Co. Ltd.
508508
"^est,.*":
509509
description: ESTeem Wireless Modems
510+
"^eswin,.*":
511+
description: Beijing ESWIN Technology Group Co. Ltd.
510512
"^ettus,.*":
511513
description: NI Ettus Research
512514
"^eukrea,.*":

drivers/of/device.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

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

drivers/of/dynamic.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -935,10 +935,15 @@ static int of_changeset_add_prop_helper(struct of_changeset *ocs,
935935
return -ENOMEM;
936936

937937
ret = of_changeset_add_property(ocs, np, new_pp);
938-
if (ret)
938+
if (ret) {
939939
__of_prop_free(new_pp);
940+
return ret;
941+
}
940942

941-
return ret;
943+
new_pp->next = np->deadprops;
944+
np->deadprops = new_pp;
945+
946+
return 0;
942947
}
943948

944949
/**

drivers/of/of_reserved_mem.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,7 @@ int of_reserved_mem_region_to_resource(const struct device_node *np,
771771
return -EINVAL;
772772

773773
resource_set_range(res, rmem->base, rmem->size);
774+
res->flags = IORESOURCE_MEM;
774775
res->name = rmem->name;
775776
return 0;
776777
}

0 commit comments

Comments
 (0)