* [PATCH v2 2/9] drm/mediatek: fix OF sibling-node lookup
[not found] <20180827082153.22537-1-johan@kernel.org>
@ 2018-08-27 8:21 ` Johan Hovold
2018-08-27 8:21 ` [PATCH v2 3/9] drm/msm: fix OF child-node lookup Johan Hovold
` (5 subsequent siblings)
6 siblings, 0 replies; 20+ messages in thread
From: Johan Hovold @ 2018-08-27 8:21 UTC (permalink / raw)
To: Rob Herring, Greg Kroah-Hartman
Cc: Frank Rowand, devicetree, linux-kernel, Johan Hovold, stable,
Junzhi Zhao, Philipp Zabel, CK Hu, David Airlie
Use the new of_get_compatible_child() helper to lookup the sibling
instead of using of_find_compatible_node(), which searches the entire
tree from a given start node and thus can return an unrelated (i.e.
non-sibling) node.
This also addresses a potential use-after-free (e.g. after probe
deferral) as the tree-wide helper drops a reference to its first
argument (i.e. the parent device node).
While at it, also fix the related cec-node reference leak.
Fixes: 8f83f26891e1 ("drm/mediatek: Add HDMI support")
Cc: stable <stable@vger.kernel.org> # 4.8
Cc: Junzhi Zhao <junzhi.zhao@mediatek.com>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Cc: CK Hu <ck.hu@mediatek.com>
Cc: David Airlie <airlied@linux.ie>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/gpu/drm/mediatek/mtk_hdmi.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c
index 2d45d1dd9554..643f5edd68fe 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
@@ -1446,8 +1446,7 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi,
}
/* The CEC module handles HDMI hotplug detection */
- cec_np = of_find_compatible_node(np->parent, NULL,
- "mediatek,mt8173-cec");
+ cec_np = of_get_compatible_child(np->parent, "mediatek,mt8173-cec");
if (!cec_np) {
dev_err(dev, "Failed to find CEC node\n");
return -EINVAL;
@@ -1457,8 +1456,10 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi,
if (!cec_pdev) {
dev_err(hdmi->dev, "Waiting for CEC device %pOF\n",
cec_np);
+ of_node_put(cec_np);
return -EPROBE_DEFER;
}
+ of_node_put(cec_np);
hdmi->cec_dev = &cec_pdev->dev;
/*
--
2.18.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v2 3/9] drm/msm: fix OF child-node lookup
[not found] <20180827082153.22537-1-johan@kernel.org>
2018-08-27 8:21 ` [PATCH v2 2/9] drm/mediatek: fix OF sibling-node lookup Johan Hovold
@ 2018-08-27 8:21 ` Johan Hovold
2018-08-27 8:21 ` [PATCH v2 4/9] mmc: meson-mx-sdio: " Johan Hovold
` (4 subsequent siblings)
6 siblings, 0 replies; 20+ messages in thread
From: Johan Hovold @ 2018-08-27 8:21 UTC (permalink / raw)
To: Rob Herring, Greg Kroah-Hartman
Cc: Frank Rowand, devicetree, linux-kernel, Johan Hovold, stable,
Jordan Crouse, Rob Clark, David Airlie
Use the new of_get_compatible_child() helper to lookup the legacy
pwrlevels child node instead of using of_find_compatible_node(), which
searches the entire tree from a given start node and thus can return an
unrelated (i.e. non-child) node.
This also addresses a potential use-after-free (e.g. after probe
deferral) as the tree-wide helper drops a reference to its first
argument (i.e. the probed device's node).
While at it, also fix the related child-node reference leak.
Fixes: e2af8b6b0ca1 ("drm/msm: gpu: Use OPP tables if we can")
Cc: stable <stable@vger.kernel.org> # 4.12
Cc: Jordan Crouse <jcrouse@codeaurora.org>
Cc: Rob Clark <robdclark@gmail.com>
Cc: David Airlie <airlied@linux.ie>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/gpu/drm/msm/adreno/adreno_gpu.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
index da1363a0c54d..93d70f4a2154 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
@@ -633,8 +633,7 @@ static int adreno_get_legacy_pwrlevels(struct device *dev)
struct device_node *child, *node;
int ret;
- node = of_find_compatible_node(dev->of_node, NULL,
- "qcom,gpu-pwrlevels");
+ node = of_get_compatible_child(dev->of_node, "qcom,gpu-pwrlevels");
if (!node) {
dev_err(dev, "Could not find the GPU powerlevels\n");
return -ENXIO;
@@ -655,6 +654,8 @@ static int adreno_get_legacy_pwrlevels(struct device *dev)
dev_pm_opp_add(dev, val, 0);
}
+ of_node_put(node);
+
return 0;
}
--
2.18.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v2 4/9] mmc: meson-mx-sdio: fix OF child-node lookup
[not found] <20180827082153.22537-1-johan@kernel.org>
2018-08-27 8:21 ` [PATCH v2 2/9] drm/mediatek: fix OF sibling-node lookup Johan Hovold
2018-08-27 8:21 ` [PATCH v2 3/9] drm/msm: fix OF child-node lookup Johan Hovold
@ 2018-08-27 8:21 ` Johan Hovold
2018-08-27 14:44 ` Ulf Hansson
2018-08-27 8:21 ` [PATCH v2 5/9] mtd: nand: atmel: " Johan Hovold
` (3 subsequent siblings)
6 siblings, 1 reply; 20+ messages in thread
From: Johan Hovold @ 2018-08-27 8:21 UTC (permalink / raw)
To: Rob Herring, Greg Kroah-Hartman
Cc: Frank Rowand, devicetree, linux-kernel, Johan Hovold, stable,
Carlo Caione, Martin Blumenstingl, Ulf Hansson
Use the new of_get_compatible_child() helper to lookup the slot child
node instead of using of_find_compatible_node(), which searches the
entire tree from a given start node and thus can return an unrelated
(i.e. non-child) node.
This also addresses a potential use-after-free (e.g. after probe
deferral) as the tree-wide helper drops a reference to its first
argument (i.e. the node of the device being probed).
While at it, also fix up the related slot-node reference leak.
Fixes: ed80a13bb4c4 ("mmc: meson-mx-sdio: Add a driver for the Amlogic Meson8 and Meson8b SoCs")
Cc: stable <stable@vger.kernel.org> # 4.15
Cc: Carlo Caione <carlo@endlessm.com>
Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Cc: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/mmc/host/meson-mx-sdio.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/host/meson-mx-sdio.c b/drivers/mmc/host/meson-mx-sdio.c
index 09cb89645d06..2cfec33178c1 100644
--- a/drivers/mmc/host/meson-mx-sdio.c
+++ b/drivers/mmc/host/meson-mx-sdio.c
@@ -517,19 +517,23 @@ static struct mmc_host_ops meson_mx_mmc_ops = {
static struct platform_device *meson_mx_mmc_slot_pdev(struct device *parent)
{
struct device_node *slot_node;
+ struct platform_device *pdev;
/*
* TODO: the MMC core framework currently does not support
* controllers with multiple slots properly. So we only register
* the first slot for now
*/
- slot_node = of_find_compatible_node(parent->of_node, NULL, "mmc-slot");
+ slot_node = of_get_compatible_child(parent->of_node, "mmc-slot");
if (!slot_node) {
dev_warn(parent, "no 'mmc-slot' sub-node found\n");
return ERR_PTR(-ENOENT);
}
- return of_platform_device_create(slot_node, NULL, parent);
+ pdev = of_platform_device_create(slot_node, NULL, parent);
+ of_node_put(slot_node);
+
+ return pdev;
}
static int meson_mx_mmc_add_host(struct meson_mx_mmc_host *host)
--
2.18.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v2 5/9] mtd: nand: atmel: fix OF child-node lookup
[not found] <20180827082153.22537-1-johan@kernel.org>
` (2 preceding siblings ...)
2018-08-27 8:21 ` [PATCH v2 4/9] mmc: meson-mx-sdio: " Johan Hovold
@ 2018-08-27 8:21 ` Johan Hovold
2018-08-27 8:28 ` Boris Brezillon
2018-08-27 8:21 ` [PATCH v2 6/9] net: bcmgenet: " Johan Hovold
` (2 subsequent siblings)
6 siblings, 1 reply; 20+ messages in thread
From: Johan Hovold @ 2018-08-27 8:21 UTC (permalink / raw)
To: Rob Herring, Greg Kroah-Hartman
Cc: Frank Rowand, devicetree, linux-kernel, Johan Hovold, stable,
Nicolas Ferre, Josh Wu, Boris Brezillon
Use the new of_get_compatible_child() helper to lookup the nfc child
node instead of using of_find_compatible_node(), which searches the
entire tree from a given start node and thus can return an unrelated
(i.e. non-child) node.
This also addresses a potential use-after-free (e.g. after probe
deferral) as the tree-wide helper drops a reference to its first
argument (i.e. the node of the device being probed).
While at it, also fix a related nfc-node reference leak.
Fixes: f88fc122cc34 ("mtd: nand: Cleanup/rework the atmel_nand driver")
Cc: stable <stable@vger.kernel.org> # 4.11
Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
Cc: Josh Wu <rainyfeeling@outlook.com>
Cc: Boris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/mtd/nand/raw/atmel/nand-controller.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/mtd/nand/raw/atmel/nand-controller.c b/drivers/mtd/nand/raw/atmel/nand-controller.c
index a068b214ebaa..d3dfe63956ac 100644
--- a/drivers/mtd/nand/raw/atmel/nand-controller.c
+++ b/drivers/mtd/nand/raw/atmel/nand-controller.c
@@ -2061,8 +2061,7 @@ atmel_hsmc_nand_controller_legacy_init(struct atmel_hsmc_nand_controller *nc)
int ret;
nand_np = dev->of_node;
- nfc_np = of_find_compatible_node(dev->of_node, NULL,
- "atmel,sama5d3-nfc");
+ nfc_np = of_get_compatible_child(dev->of_node, "atmel,sama5d3-nfc");
nc->clk = of_clk_get(nfc_np, 0);
if (IS_ERR(nc->clk)) {
@@ -2472,15 +2471,19 @@ static int atmel_nand_controller_probe(struct platform_device *pdev)
}
if (caps->legacy_of_bindings) {
+ struct device_node *nfc_node;
u32 ale_offs = 21;
/*
* If we are parsing legacy DT props and the DT contains a
* valid NFC node, forward the request to the sama5 logic.
*/
- if (of_find_compatible_node(pdev->dev.of_node, NULL,
- "atmel,sama5d3-nfc"))
+ nfc_node = of_get_compatible_child(pdev->dev.of_node,
+ "atmel,sama5d3-nfc");
+ if (nfc_node) {
caps = &atmel_sama5_nand_caps;
+ of_node_put(nfc_node);
+ }
/*
* Even if the compatible says we are dealing with an
--
2.18.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v2 6/9] net: bcmgenet: fix OF child-node lookup
[not found] <20180827082153.22537-1-johan@kernel.org>
` (3 preceding siblings ...)
2018-08-27 8:21 ` [PATCH v2 5/9] mtd: nand: atmel: " Johan Hovold
@ 2018-08-27 8:21 ` Johan Hovold
2018-08-31 0:47 ` Florian Fainelli
2018-08-27 8:21 ` [PATCH v2 8/9] NFC: nfcmrvl_uart: " Johan Hovold
2018-08-27 8:21 ` [PATCH v2 9/9] power: supply: twl4030-charger: fix OF sibling-node lookup Johan Hovold
6 siblings, 1 reply; 20+ messages in thread
From: Johan Hovold @ 2018-08-27 8:21 UTC (permalink / raw)
To: Rob Herring, Greg Kroah-Hartman
Cc: Frank Rowand, devicetree, linux-kernel, Johan Hovold, stable,
Florian Fainelli, David S . Miller
Use the new of_get_compatible_child() helper to lookup the mdio child
node instead of using of_find_compatible_node(), which searches the
entire tree from a given start node and thus can return an unrelated
(i.e. non-child) node.
This also addresses a potential use-after-free (e.g. after probe
deferral) as the tree-wide helper drops a reference to its first
argument (i.e. the node of the device being probed).
Fixes: aa09677cba42 ("net: bcmgenet: add MDIO routines")
Cc: stable <stable@vger.kernel.org> # 3.15
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/net/ethernet/broadcom/genet/bcmmii.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c
index 5333274a283c..87fc65560ceb 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmmii.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c
@@ -333,7 +333,7 @@ static struct device_node *bcmgenet_mii_of_find_mdio(struct bcmgenet_priv *priv)
if (!compat)
return NULL;
- priv->mdio_dn = of_find_compatible_node(dn, NULL, compat);
+ priv->mdio_dn = of_get_compatible_child(dn, compat);
kfree(compat);
if (!priv->mdio_dn) {
dev_err(kdev, "unable to find MDIO bus node\n");
--
2.18.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v2 8/9] NFC: nfcmrvl_uart: fix OF child-node lookup
[not found] <20180827082153.22537-1-johan@kernel.org>
` (4 preceding siblings ...)
2018-08-27 8:21 ` [PATCH v2 6/9] net: bcmgenet: " Johan Hovold
@ 2018-08-27 8:21 ` Johan Hovold
2018-08-27 8:21 ` [PATCH v2 9/9] power: supply: twl4030-charger: fix OF sibling-node lookup Johan Hovold
6 siblings, 0 replies; 20+ messages in thread
From: Johan Hovold @ 2018-08-27 8:21 UTC (permalink / raw)
To: Rob Herring, Greg Kroah-Hartman
Cc: Frank Rowand, devicetree, linux-kernel, Johan Hovold, stable,
Vincent Cuissard, Samuel Ortiz
Use the new of_get_compatible_child() helper to lookup the nfc child
node instead of using of_find_compatible_node(), which searches the
entire tree from a given start node and thus can return an unrelated
(i.e. non-child) node.
This also addresses a potential use-after-free (e.g. after probe
deferral) as the tree-wide helper drops a reference to its first
argument (i.e. the parent node).
Fixes: e097dc624f78 ("NFC: nfcmrvl: add UART driver")
Fixes: d8e018c0b321 ("NFC: nfcmrvl: update device tree bindings for Marvell NFC")
Cc: stable <stable@vger.kernel.org> # 4.2
Cc: Vincent Cuissard <cuissard@marvell.com>
Cc: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/nfc/nfcmrvl/uart.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/nfc/nfcmrvl/uart.c b/drivers/nfc/nfcmrvl/uart.c
index 91162f8e0366..9a22056e8d9e 100644
--- a/drivers/nfc/nfcmrvl/uart.c
+++ b/drivers/nfc/nfcmrvl/uart.c
@@ -73,10 +73,9 @@ static int nfcmrvl_uart_parse_dt(struct device_node *node,
struct device_node *matched_node;
int ret;
- matched_node = of_find_compatible_node(node, NULL, "marvell,nfc-uart");
+ matched_node = of_get_compatible_child(node, "marvell,nfc-uart");
if (!matched_node) {
- matched_node = of_find_compatible_node(node, NULL,
- "mrvl,nfc-uart");
+ matched_node = of_get_compatible_child(node, "mrvl,nfc-uart");
if (!matched_node)
return -ENODEV;
}
--
2.18.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v2 9/9] power: supply: twl4030-charger: fix OF sibling-node lookup
[not found] <20180827082153.22537-1-johan@kernel.org>
` (5 preceding siblings ...)
2018-08-27 8:21 ` [PATCH v2 8/9] NFC: nfcmrvl_uart: " Johan Hovold
@ 2018-08-27 8:21 ` Johan Hovold
6 siblings, 0 replies; 20+ messages in thread
From: Johan Hovold @ 2018-08-27 8:21 UTC (permalink / raw)
To: Rob Herring, Greg Kroah-Hartman
Cc: Frank Rowand, devicetree, linux-kernel, Johan Hovold, stable,
NeilBrown, Felipe Balbi, Sebastian Reichel
Use the new of_get_compatible_child() helper to lookup the usb sibling
node instead of using of_find_compatible_node(), which searches the
entire tree from a given start node and thus can return an unrelated
(non-sibling) node.
This also addresses a potential use-after-free (e.g. after probe
deferral) as the tree-wide helper drops a reference to its first
argument (i.e. the parent device node).
While at it, also fix the related phy-node reference leak.
Fixes: f5e4edb8c888 ("power: twl4030_charger: find associated phy by more reliable means.")
Cc: stable <stable@vger.kernel.org> # 4.2
Cc: NeilBrown <neilb@suse.de>
Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
Cc: Sebastian Reichel <sre@kernel.org>
Reviewed-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/power/supply/twl4030_charger.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/power/supply/twl4030_charger.c b/drivers/power/supply/twl4030_charger.c
index bbcaee56db9d..b6a7d9f74cf3 100644
--- a/drivers/power/supply/twl4030_charger.c
+++ b/drivers/power/supply/twl4030_charger.c
@@ -996,12 +996,13 @@ static int twl4030_bci_probe(struct platform_device *pdev)
if (bci->dev->of_node) {
struct device_node *phynode;
- phynode = of_find_compatible_node(bci->dev->of_node->parent,
- NULL, "ti,twl4030-usb");
+ phynode = of_get_compatible_child(bci->dev->of_node->parent,
+ "ti,twl4030-usb");
if (phynode) {
bci->usb_nb.notifier_call = twl4030_bci_usb_ncb;
bci->transceiver = devm_usb_get_phy_by_node(
bci->dev, phynode, &bci->usb_nb);
+ of_node_put(phynode);
if (IS_ERR(bci->transceiver)) {
ret = PTR_ERR(bci->transceiver);
if (ret == -EPROBE_DEFER)
--
2.18.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH v2 5/9] mtd: nand: atmel: fix OF child-node lookup
2018-08-27 8:21 ` [PATCH v2 5/9] mtd: nand: atmel: " Johan Hovold
@ 2018-08-27 8:28 ` Boris Brezillon
2018-08-27 8:44 ` Johan Hovold
0 siblings, 1 reply; 20+ messages in thread
From: Boris Brezillon @ 2018-08-27 8:28 UTC (permalink / raw)
To: Johan Hovold
Cc: Rob Herring, Greg Kroah-Hartman, Frank Rowand, devicetree,
linux-kernel, stable, Nicolas Ferre, Josh Wu
Hi Johan
On Mon, 27 Aug 2018 10:21:49 +0200
Johan Hovold <johan@kernel.org> wrote:
> Use the new of_get_compatible_child() helper to lookup the nfc child
> node instead of using of_find_compatible_node(), which searches the
> entire tree from a given start node and thus can return an unrelated
> (i.e. non-child) node.
>
> This also addresses a potential use-after-free (e.g. after probe
> deferral) as the tree-wide helper drops a reference to its first
> argument (i.e. the node of the device being probed).
>
> While at it, also fix a related nfc-node reference leak.
>
> Fixes: f88fc122cc34 ("mtd: nand: Cleanup/rework the atmel_nand driver")
> Cc: stable <stable@vger.kernel.org> # 4.11
> Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
> Cc: Josh Wu <rainyfeeling@outlook.com>
> Cc: Boris Brezillon <boris.brezillon@bootlin.com>
> Signed-off-by: Johan Hovold <johan@kernel.org>
Acked-by: Boris Brezillon <boris.brezillon@bootlin.com>
I'll let Miquel queue this patch to the nand/next branch, unless you
want it to be merged in 4.19, in which case I'll queue it to the
mtd/fixes branch.
Thanks,
Boris
> ---
> drivers/mtd/nand/raw/atmel/nand-controller.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/atmel/nand-controller.c b/drivers/mtd/nand/raw/atmel/nand-controller.c
> index a068b214ebaa..d3dfe63956ac 100644
> --- a/drivers/mtd/nand/raw/atmel/nand-controller.c
> +++ b/drivers/mtd/nand/raw/atmel/nand-controller.c
> @@ -2061,8 +2061,7 @@ atmel_hsmc_nand_controller_legacy_init(struct atmel_hsmc_nand_controller *nc)
> int ret;
>
> nand_np = dev->of_node;
> - nfc_np = of_find_compatible_node(dev->of_node, NULL,
> - "atmel,sama5d3-nfc");
> + nfc_np = of_get_compatible_child(dev->of_node, "atmel,sama5d3-nfc");
>
> nc->clk = of_clk_get(nfc_np, 0);
> if (IS_ERR(nc->clk)) {
> @@ -2472,15 +2471,19 @@ static int atmel_nand_controller_probe(struct platform_device *pdev)
> }
>
> if (caps->legacy_of_bindings) {
> + struct device_node *nfc_node;
> u32 ale_offs = 21;
>
> /*
> * If we are parsing legacy DT props and the DT contains a
> * valid NFC node, forward the request to the sama5 logic.
> */
> - if (of_find_compatible_node(pdev->dev.of_node, NULL,
> - "atmel,sama5d3-nfc"))
> + nfc_node = of_get_compatible_child(pdev->dev.of_node,
> + "atmel,sama5d3-nfc");
> + if (nfc_node) {
> caps = &atmel_sama5_nand_caps;
> + of_node_put(nfc_node);
> + }
>
> /*
> * Even if the compatible says we are dealing with an
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 5/9] mtd: nand: atmel: fix OF child-node lookup
2018-08-27 8:28 ` Boris Brezillon
@ 2018-08-27 8:44 ` Johan Hovold
2018-08-27 8:48 ` Boris Brezillon
0 siblings, 1 reply; 20+ messages in thread
From: Johan Hovold @ 2018-08-27 8:44 UTC (permalink / raw)
To: Boris Brezillon
Cc: Johan Hovold, Rob Herring, Greg Kroah-Hartman, Frank Rowand,
devicetree, linux-kernel, stable, Nicolas Ferre, Josh Wu
On Mon, Aug 27, 2018 at 10:28:20AM +0200, Boris Brezillon wrote:
> Hi Johan
>
> On Mon, 27 Aug 2018 10:21:49 +0200
> Johan Hovold <johan@kernel.org> wrote:
>
> > Use the new of_get_compatible_child() helper to lookup the nfc child
> > node instead of using of_find_compatible_node(), which searches the
> > entire tree from a given start node and thus can return an unrelated
> > (i.e. non-child) node.
> >
> > This also addresses a potential use-after-free (e.g. after probe
> > deferral) as the tree-wide helper drops a reference to its first
> > argument (i.e. the node of the device being probed).
> >
> > While at it, also fix a related nfc-node reference leak.
> >
> > Fixes: f88fc122cc34 ("mtd: nand: Cleanup/rework the atmel_nand driver")
> > Cc: stable <stable@vger.kernel.org> # 4.11
> > Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
> > Cc: Josh Wu <rainyfeeling@outlook.com>
> > Cc: Boris Brezillon <boris.brezillon@bootlin.com>
> > Signed-off-by: Johan Hovold <johan@kernel.org>
>
> Acked-by: Boris Brezillon <boris.brezillon@bootlin.com>
Thanks for the ack.
> I'll let Miquel queue this patch to the nand/next branch, unless you
> want it to be merged in 4.19, in which case I'll queue it to the
> mtd/fixes branch.
Note that there's a dependency on the first patch of the series which
adds the new helper. Rob can pick up the entire series if the various
maintainers agree, otherwise I'll try to get at the least the helper
into -rc2.
I'd prefer getting the use-after-frees fixed in 4.19, but queuing for
4.20 should be fine too.
Thanks,
Johan
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 5/9] mtd: nand: atmel: fix OF child-node lookup
2018-08-27 8:44 ` Johan Hovold
@ 2018-08-27 8:48 ` Boris Brezillon
2018-08-27 9:44 ` Johan Hovold
0 siblings, 1 reply; 20+ messages in thread
From: Boris Brezillon @ 2018-08-27 8:48 UTC (permalink / raw)
To: Johan Hovold
Cc: Rob Herring, Greg Kroah-Hartman, Frank Rowand, devicetree,
linux-kernel, stable, Nicolas Ferre, Josh Wu
On Mon, 27 Aug 2018 10:44:14 +0200
Johan Hovold <johan@kernel.org> wrote:
> On Mon, Aug 27, 2018 at 10:28:20AM +0200, Boris Brezillon wrote:
> > Hi Johan
> >
> > On Mon, 27 Aug 2018 10:21:49 +0200
> > Johan Hovold <johan@kernel.org> wrote:
> >
> > > Use the new of_get_compatible_child() helper to lookup the nfc child
> > > node instead of using of_find_compatible_node(), which searches the
> > > entire tree from a given start node and thus can return an unrelated
> > > (i.e. non-child) node.
> > >
> > > This also addresses a potential use-after-free (e.g. after probe
> > > deferral) as the tree-wide helper drops a reference to its first
> > > argument (i.e. the node of the device being probed).
> > >
> > > While at it, also fix a related nfc-node reference leak.
> > >
> > > Fixes: f88fc122cc34 ("mtd: nand: Cleanup/rework the atmel_nand driver")
> > > Cc: stable <stable@vger.kernel.org> # 4.11
> > > Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
> > > Cc: Josh Wu <rainyfeeling@outlook.com>
> > > Cc: Boris Brezillon <boris.brezillon@bootlin.com>
> > > Signed-off-by: Johan Hovold <johan@kernel.org>
> >
> > Acked-by: Boris Brezillon <boris.brezillon@bootlin.com>
>
> Thanks for the ack.
>
> > I'll let Miquel queue this patch to the nand/next branch, unless you
> > want it to be merged in 4.19, in which case I'll queue it to the
> > mtd/fixes branch.
>
> Note that there's a dependency on the first patch of the series which
> adds the new helper.
I was not Cc-ed on this patch :P.
> Rob can pick up the entire series if the various
> maintainers agree, otherwise I'll try to get at the least the helper
> into -rc2.
If everything goes in 4.19-rc2 through Rob's tree that's fine, but if
it's queued for 4.20 we might need an immutable tag just in case we
queue conflicting changes to the NAND tree.
Thanks,
Boris
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 5/9] mtd: nand: atmel: fix OF child-node lookup
2018-08-27 8:48 ` Boris Brezillon
@ 2018-08-27 9:44 ` Johan Hovold
2018-10-23 18:28 ` Rob Herring
0 siblings, 1 reply; 20+ messages in thread
From: Johan Hovold @ 2018-08-27 9:44 UTC (permalink / raw)
To: Boris Brezillon
Cc: Johan Hovold, Rob Herring, Greg Kroah-Hartman, Frank Rowand,
devicetree, linux-kernel, stable, Nicolas Ferre, Josh Wu
On Mon, Aug 27, 2018 at 10:48:42AM +0200, Boris Brezillon wrote:
> On Mon, 27 Aug 2018 10:44:14 +0200
> Johan Hovold <johan@kernel.org> wrote:
>
> > On Mon, Aug 27, 2018 at 10:28:20AM +0200, Boris Brezillon wrote:
> > > Hi Johan
> > >
> > > On Mon, 27 Aug 2018 10:21:49 +0200
> > > Johan Hovold <johan@kernel.org> wrote:
> > >
> > > > Use the new of_get_compatible_child() helper to lookup the nfc child
> > > > node instead of using of_find_compatible_node(), which searches the
> > > > entire tree from a given start node and thus can return an unrelated
> > > > (i.e. non-child) node.
> > > >
> > > > This also addresses a potential use-after-free (e.g. after probe
> > > > deferral) as the tree-wide helper drops a reference to its first
> > > > argument (i.e. the node of the device being probed).
> > > >
> > > > While at it, also fix a related nfc-node reference leak.
> > > >
> > > > Fixes: f88fc122cc34 ("mtd: nand: Cleanup/rework the atmel_nand driver")
> > > > Cc: stable <stable@vger.kernel.org> # 4.11
> > > > Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
> > > > Cc: Josh Wu <rainyfeeling@outlook.com>
> > > > Cc: Boris Brezillon <boris.brezillon@bootlin.com>
> > > > Signed-off-by: Johan Hovold <johan@kernel.org>
> > >
> > > Acked-by: Boris Brezillon <boris.brezillon@bootlin.com>
> >
> > Thanks for the ack.
> >
> > > I'll let Miquel queue this patch to the nand/next branch, unless you
> > > want it to be merged in 4.19, in which case I'll queue it to the
> > > mtd/fixes branch.
> >
> > Note that there's a dependency on the first patch of the series which
> > adds the new helper.
>
> I was not Cc-ed on this patch :P.
Yeah, sorry about that. I made sure everyone was CCed on the
cover letter, but guess I could have reused that list for the helper as
well.
> > Rob can pick up the entire series if the various
> > maintainers agree, otherwise I'll try to get at the least the helper
> > into -rc2.
>
> If everything goes in 4.19-rc2 through Rob's tree that's fine, but if
> it's queued for 4.20 we might need an immutable tag just in case we
> queue conflicting changes to the NAND tree.
Ok, thanks.
Johan
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 4/9] mmc: meson-mx-sdio: fix OF child-node lookup
2018-08-27 8:21 ` [PATCH v2 4/9] mmc: meson-mx-sdio: " Johan Hovold
@ 2018-08-27 14:44 ` Ulf Hansson
2018-09-04 12:54 ` Johan Hovold
0 siblings, 1 reply; 20+ messages in thread
From: Ulf Hansson @ 2018-08-27 14:44 UTC (permalink / raw)
To: Johan Hovold
Cc: Rob Herring, Greg Kroah-Hartman, Frank Rowand, DTML,
Linux Kernel Mailing List, stable, Carlo Caione,
Martin Blumenstingl
On 27 August 2018 at 10:21, Johan Hovold <johan@kernel.org> wrote:
> Use the new of_get_compatible_child() helper to lookup the slot child
> node instead of using of_find_compatible_node(), which searches the
> entire tree from a given start node and thus can return an unrelated
> (i.e. non-child) node.
>
> This also addresses a potential use-after-free (e.g. after probe
> deferral) as the tree-wide helper drops a reference to its first
> argument (i.e. the node of the device being probed).
>
> While at it, also fix up the related slot-node reference leak.
>
> Fixes: ed80a13bb4c4 ("mmc: meson-mx-sdio: Add a driver for the Amlogic Meson8 and Meson8b SoCs")
> Cc: stable <stable@vger.kernel.org> # 4.15
> Cc: Carlo Caione <carlo@endlessm.com>
> Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> Cc: Ulf Hansson <ulf.hansson@linaro.org>
> Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> Signed-off-by: Johan Hovold <johan@kernel.org>
Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Kind regards
Uffe
> ---
> drivers/mmc/host/meson-mx-sdio.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/host/meson-mx-sdio.c b/drivers/mmc/host/meson-mx-sdio.c
> index 09cb89645d06..2cfec33178c1 100644
> --- a/drivers/mmc/host/meson-mx-sdio.c
> +++ b/drivers/mmc/host/meson-mx-sdio.c
> @@ -517,19 +517,23 @@ static struct mmc_host_ops meson_mx_mmc_ops = {
> static struct platform_device *meson_mx_mmc_slot_pdev(struct device *parent)
> {
> struct device_node *slot_node;
> + struct platform_device *pdev;
>
> /*
> * TODO: the MMC core framework currently does not support
> * controllers with multiple slots properly. So we only register
> * the first slot for now
> */
> - slot_node = of_find_compatible_node(parent->of_node, NULL, "mmc-slot");
> + slot_node = of_get_compatible_child(parent->of_node, "mmc-slot");
> if (!slot_node) {
> dev_warn(parent, "no 'mmc-slot' sub-node found\n");
> return ERR_PTR(-ENOENT);
> }
>
> - return of_platform_device_create(slot_node, NULL, parent);
> + pdev = of_platform_device_create(slot_node, NULL, parent);
> + of_node_put(slot_node);
> +
> + return pdev;
> }
>
> static int meson_mx_mmc_add_host(struct meson_mx_mmc_host *host)
> --
> 2.18.0
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 6/9] net: bcmgenet: fix OF child-node lookup
2018-08-27 8:21 ` [PATCH v2 6/9] net: bcmgenet: " Johan Hovold
@ 2018-08-31 0:47 ` Florian Fainelli
2018-09-04 12:56 ` Johan Hovold
0 siblings, 1 reply; 20+ messages in thread
From: Florian Fainelli @ 2018-08-31 0:47 UTC (permalink / raw)
To: Johan Hovold, Rob Herring, Greg Kroah-Hartman
Cc: Frank Rowand, devicetree, linux-kernel, stable, David S . Miller
On 08/27/2018 01:21 AM, Johan Hovold wrote:
> Use the new of_get_compatible_child() helper to lookup the mdio child
> node instead of using of_find_compatible_node(), which searches the
> entire tree from a given start node and thus can return an unrelated
> (i.e. non-child) node.
>
> This also addresses a potential use-after-free (e.g. after probe
> deferral) as the tree-wide helper drops a reference to its first
> argument (i.e. the node of the device being probed).
>
> Fixes: aa09677cba42 ("net: bcmgenet: add MDIO routines")
> Cc: stable <stable@vger.kernel.org> # 3.15
> Cc: Florian Fainelli <f.fainelli@gmail.com>
> Cc: David S. Miller <davem@davemloft.net>
> Signed-off-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 4/9] mmc: meson-mx-sdio: fix OF child-node lookup
2018-08-27 14:44 ` Ulf Hansson
@ 2018-09-04 12:54 ` Johan Hovold
2018-09-05 6:30 ` Ulf Hansson
0 siblings, 1 reply; 20+ messages in thread
From: Johan Hovold @ 2018-09-04 12:54 UTC (permalink / raw)
To: Ulf Hansson
Cc: Johan Hovold, Rob Herring, Greg Kroah-Hartman, Frank Rowand, DTML,
Linux Kernel Mailing List, stable, Carlo Caione,
Martin Blumenstingl
On Mon, Aug 27, 2018 at 04:44:44PM +0200, Ulf Hansson wrote:
> On 27 August 2018 at 10:21, Johan Hovold <johan@kernel.org> wrote:
> > Use the new of_get_compatible_child() helper to lookup the slot child
> > node instead of using of_find_compatible_node(), which searches the
> > entire tree from a given start node and thus can return an unrelated
> > (i.e. non-child) node.
> >
> > This also addresses a potential use-after-free (e.g. after probe
> > deferral) as the tree-wide helper drops a reference to its first
> > argument (i.e. the node of the device being probed).
> >
> > While at it, also fix up the related slot-node reference leak.
> >
> > Fixes: ed80a13bb4c4 ("mmc: meson-mx-sdio: Add a driver for the Amlogic Meson8 and Meson8b SoCs")
> > Cc: stable <stable@vger.kernel.org> # 4.15
> > Cc: Carlo Caione <carlo@endlessm.com>
> > Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> > Cc: Ulf Hansson <ulf.hansson@linaro.org>
> > Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> > Signed-off-by: Johan Hovold <johan@kernel.org>
>
> Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Thanks for the ack. Rob's gotten the helper into -rc2, so feel free to
pick this one up directly to whichever mmc branch you prefer. I've been
able to trigger crashes after probe deferrals due to the use-after-free,
but this seems unlikely to be exploitable.
Thanks,
Johan
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 6/9] net: bcmgenet: fix OF child-node lookup
2018-08-31 0:47 ` Florian Fainelli
@ 2018-09-04 12:56 ` Johan Hovold
0 siblings, 0 replies; 20+ messages in thread
From: Johan Hovold @ 2018-09-04 12:56 UTC (permalink / raw)
To: Florian Fainelli
Cc: Johan Hovold, Rob Herring, Greg Kroah-Hartman, Frank Rowand,
devicetree, linux-kernel, stable, David S . Miller
On Thu, Aug 30, 2018 at 05:47:33PM -0700, Florian Fainelli wrote:
> On 08/27/2018 01:21 AM, Johan Hovold wrote:
> > Use the new of_get_compatible_child() helper to lookup the mdio child
> > node instead of using of_find_compatible_node(), which searches the
> > entire tree from a given start node and thus can return an unrelated
> > (i.e. non-child) node.
> >
> > This also addresses a potential use-after-free (e.g. after probe
> > deferral) as the tree-wide helper drops a reference to its first
> > argument (i.e. the node of the device being probed).
> >
> > Fixes: aa09677cba42 ("net: bcmgenet: add MDIO routines")
> > Cc: stable <stable@vger.kernel.org> # 3.15
> > Cc: Florian Fainelli <f.fainelli@gmail.com>
> > Cc: David S. Miller <davem@davemloft.net>
> > Signed-off-by: Johan Hovold <johan@kernel.org>
>
> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Thanks for reviewing.
Rob's gotten the helper into -rc2:
36156f9241cb of: add helper to lookup compatible child node
so feel free to pick this one up directly to whichever net tree you
prefer. I've been able to trigger crashes after probe deferrals due to
the use-after-free, but this seems unlikely to be exploitable.
Thanks,
Johan
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 4/9] mmc: meson-mx-sdio: fix OF child-node lookup
2018-09-04 12:54 ` Johan Hovold
@ 2018-09-05 6:30 ` Ulf Hansson
0 siblings, 0 replies; 20+ messages in thread
From: Ulf Hansson @ 2018-09-05 6:30 UTC (permalink / raw)
To: Johan Hovold
Cc: Rob Herring, Greg Kroah-Hartman, Frank Rowand, DTML,
Linux Kernel Mailing List, stable, Carlo Caione,
Martin Blumenstingl
On 4 September 2018 at 14:54, Johan Hovold <johan@kernel.org> wrote:
> On Mon, Aug 27, 2018 at 04:44:44PM +0200, Ulf Hansson wrote:
>> On 27 August 2018 at 10:21, Johan Hovold <johan@kernel.org> wrote:
>> > Use the new of_get_compatible_child() helper to lookup the slot child
>> > node instead of using of_find_compatible_node(), which searches the
>> > entire tree from a given start node and thus can return an unrelated
>> > (i.e. non-child) node.
>> >
>> > This also addresses a potential use-after-free (e.g. after probe
>> > deferral) as the tree-wide helper drops a reference to its first
>> > argument (i.e. the node of the device being probed).
>> >
>> > While at it, also fix up the related slot-node reference leak.
>> >
>> > Fixes: ed80a13bb4c4 ("mmc: meson-mx-sdio: Add a driver for the Amlogic Meson8 and Meson8b SoCs")
>> > Cc: stable <stable@vger.kernel.org> # 4.15
>> > Cc: Carlo Caione <carlo@endlessm.com>
>> > Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
>> > Cc: Ulf Hansson <ulf.hansson@linaro.org>
>> > Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
>> > Signed-off-by: Johan Hovold <johan@kernel.org>
>>
>> Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
>
> Thanks for the ack. Rob's gotten the helper into -rc2, so feel free to
> pick this one up directly to whichever mmc branch you prefer. I've been
> able to trigger crashes after probe deferrals due to the use-after-free,
> but this seems unlikely to be exploitable.
Applied for fixes, thanks!
Kind regards
Uffe
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 5/9] mtd: nand: atmel: fix OF child-node lookup
2018-08-27 9:44 ` Johan Hovold
@ 2018-10-23 18:28 ` Rob Herring
2018-10-23 18:51 ` Boris Brezillon
0 siblings, 1 reply; 20+ messages in thread
From: Rob Herring @ 2018-10-23 18:28 UTC (permalink / raw)
To: Johan Hovold, Boris Brezillon
Cc: Greg Kroah-Hartman, Frank Rowand, devicetree,
linux-kernel@vger.kernel.org, stable, Nicolas Ferre, Josh Wu
On Mon, Aug 27, 2018 at 4:44 AM Johan Hovold <johan@kernel.org> wrote:
>
> On Mon, Aug 27, 2018 at 10:48:42AM +0200, Boris Brezillon wrote:
> > On Mon, 27 Aug 2018 10:44:14 +0200
> > Johan Hovold <johan@kernel.org> wrote:
> >
> > > On Mon, Aug 27, 2018 at 10:28:20AM +0200, Boris Brezillon wrote:
> > > > Hi Johan
> > > >
> > > > On Mon, 27 Aug 2018 10:21:49 +0200
> > > > Johan Hovold <johan@kernel.org> wrote:
> > > >
> > > > > Use the new of_get_compatible_child() helper to lookup the nfc child
> > > > > node instead of using of_find_compatible_node(), which searches the
> > > > > entire tree from a given start node and thus can return an unrelated
> > > > > (i.e. non-child) node.
> > > > >
> > > > > This also addresses a potential use-after-free (e.g. after probe
> > > > > deferral) as the tree-wide helper drops a reference to its first
> > > > > argument (i.e. the node of the device being probed).
> > > > >
> > > > > While at it, also fix a related nfc-node reference leak.
> > > > >
> > > > > Fixes: f88fc122cc34 ("mtd: nand: Cleanup/rework the atmel_nand driver")
> > > > > Cc: stable <stable@vger.kernel.org> # 4.11
> > > > > Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
> > > > > Cc: Josh Wu <rainyfeeling@outlook.com>
> > > > > Cc: Boris Brezillon <boris.brezillon@bootlin.com>
> > > > > Signed-off-by: Johan Hovold <johan@kernel.org>
> > > >
> > > > Acked-by: Boris Brezillon <boris.brezillon@bootlin.com>
> > >
> > > Thanks for the ack.
> > >
> > > > I'll let Miquel queue this patch to the nand/next branch, unless you
> > > > want it to be merged in 4.19, in which case I'll queue it to the
> > > > mtd/fixes branch.
> > >
> > > Note that there's a dependency on the first patch of the series which
> > > adds the new helper.
> >
> > I was not Cc-ed on this patch :P.
>
> Yeah, sorry about that. I made sure everyone was CCed on the
> cover letter, but guess I could have reused that list for the helper as
> well.
>
> > > Rob can pick up the entire series if the various
> > > maintainers agree, otherwise I'll try to get at the least the helper
> > > into -rc2.
> >
> > If everything goes in 4.19-rc2 through Rob's tree that's fine, but if
> > it's queued for 4.20 we might need an immutable tag just in case we
> > queue conflicting changes to the NAND tree.
>
> Ok, thanks.
Hi Boris, can you pick this one up. It conflicts with "mtd: rawnand:
atmel: Fix potential NULL pointer dereference"
Rob
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 5/9] mtd: nand: atmel: fix OF child-node lookup
2018-10-23 18:28 ` Rob Herring
@ 2018-10-23 18:51 ` Boris Brezillon
2018-11-15 14:26 ` Johan Hovold
0 siblings, 1 reply; 20+ messages in thread
From: Boris Brezillon @ 2018-10-23 18:51 UTC (permalink / raw)
To: Rob Herring
Cc: Johan Hovold, Greg Kroah-Hartman, Frank Rowand, devicetree,
linux-kernel@vger.kernel.org, stable, Nicolas Ferre, Josh Wu
On Tue, 23 Oct 2018 13:28:09 -0500
Rob Herring <robh+dt@kernel.org> wrote:
> On Mon, Aug 27, 2018 at 4:44 AM Johan Hovold <johan@kernel.org> wrote:
> >
> > On Mon, Aug 27, 2018 at 10:48:42AM +0200, Boris Brezillon wrote:
> > > On Mon, 27 Aug 2018 10:44:14 +0200
> > > Johan Hovold <johan@kernel.org> wrote:
> > >
> > > > On Mon, Aug 27, 2018 at 10:28:20AM +0200, Boris Brezillon wrote:
> > > > > Hi Johan
> > > > >
> > > > > On Mon, 27 Aug 2018 10:21:49 +0200
> > > > > Johan Hovold <johan@kernel.org> wrote:
> > > > >
> > > > > > Use the new of_get_compatible_child() helper to lookup the nfc child
> > > > > > node instead of using of_find_compatible_node(), which searches the
> > > > > > entire tree from a given start node and thus can return an unrelated
> > > > > > (i.e. non-child) node.
> > > > > >
> > > > > > This also addresses a potential use-after-free (e.g. after probe
> > > > > > deferral) as the tree-wide helper drops a reference to its first
> > > > > > argument (i.e. the node of the device being probed).
> > > > > >
> > > > > > While at it, also fix a related nfc-node reference leak.
> > > > > >
> > > > > > Fixes: f88fc122cc34 ("mtd: nand: Cleanup/rework the atmel_nand driver")
> > > > > > Cc: stable <stable@vger.kernel.org> # 4.11
> > > > > > Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
> > > > > > Cc: Josh Wu <rainyfeeling@outlook.com>
> > > > > > Cc: Boris Brezillon <boris.brezillon@bootlin.com>
> > > > > > Signed-off-by: Johan Hovold <johan@kernel.org>
> > > > >
> > > > > Acked-by: Boris Brezillon <boris.brezillon@bootlin.com>
> > > >
> > > > Thanks for the ack.
> > > >
> > > > > I'll let Miquel queue this patch to the nand/next branch, unless you
> > > > > want it to be merged in 4.19, in which case I'll queue it to the
> > > > > mtd/fixes branch.
> > > >
> > > > Note that there's a dependency on the first patch of the series which
> > > > adds the new helper.
> > >
> > > I was not Cc-ed on this patch :P.
> >
> > Yeah, sorry about that. I made sure everyone was CCed on the
> > cover letter, but guess I could have reused that list for the helper as
> > well.
> >
> > > > Rob can pick up the entire series if the various
> > > > maintainers agree, otherwise I'll try to get at the least the helper
> > > > into -rc2.
> > >
> > > If everything goes in 4.19-rc2 through Rob's tree that's fine, but if
> > > it's queued for 4.20 we might need an immutable tag just in case we
> > > queue conflicting changes to the NAND tree.
> >
> > Ok, thanks.
>
> Hi Boris, can you pick this one up. It conflicts with "mtd: rawnand:
> atmel: Fix potential NULL pointer dereference"
Sure, I'll queue it for -rc2.
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 5/9] mtd: nand: atmel: fix OF child-node lookup
2018-10-23 18:51 ` Boris Brezillon
@ 2018-11-15 14:26 ` Johan Hovold
2018-11-18 10:45 ` Boris Brezillon
0 siblings, 1 reply; 20+ messages in thread
From: Johan Hovold @ 2018-11-15 14:26 UTC (permalink / raw)
To: Boris Brezillon
Cc: Rob Herring, Johan Hovold, Greg Kroah-Hartman, Frank Rowand,
devicetree, linux-kernel@vger.kernel.org, stable, Nicolas Ferre,
Josh Wu
On Tue, Oct 23, 2018 at 08:51:17PM +0200, Boris Brezillon wrote:
> On Tue, 23 Oct 2018 13:28:09 -0500
> Rob Herring <robh+dt@kernel.org> wrote:
>
> > On Mon, Aug 27, 2018 at 4:44 AM Johan Hovold <johan@kernel.org> wrote:
> > >
> > > On Mon, Aug 27, 2018 at 10:48:42AM +0200, Boris Brezillon wrote:
> > > > On Mon, 27 Aug 2018 10:44:14 +0200
> > > > Johan Hovold <johan@kernel.org> wrote:
> > > >
> > > > > On Mon, Aug 27, 2018 at 10:28:20AM +0200, Boris Brezillon wrote:
> > > > > > Hi Johan
> > > > > >
> > > > > > On Mon, 27 Aug 2018 10:21:49 +0200
> > > > > > Johan Hovold <johan@kernel.org> wrote:
> > > > > >
> > > > > > > Use the new of_get_compatible_child() helper to lookup the nfc child
> > > > > > > node instead of using of_find_compatible_node(), which searches the
> > > > > > > entire tree from a given start node and thus can return an unrelated
> > > > > > > (i.e. non-child) node.
> > > > > > >
> > > > > > > This also addresses a potential use-after-free (e.g. after probe
> > > > > > > deferral) as the tree-wide helper drops a reference to its first
> > > > > > > argument (i.e. the node of the device being probed).
> > > > > > >
> > > > > > > While at it, also fix a related nfc-node reference leak.
> > > > > > >
> > > > > > > Fixes: f88fc122cc34 ("mtd: nand: Cleanup/rework the atmel_nand driver")
> > > > > > > Cc: stable <stable@vger.kernel.org> # 4.11
> > > > > > > Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
> > > > > > > Cc: Josh Wu <rainyfeeling@outlook.com>
> > > > > > > Cc: Boris Brezillon <boris.brezillon@bootlin.com>
> > > > > > > Signed-off-by: Johan Hovold <johan@kernel.org>
> > > > > >
> > > > > > Acked-by: Boris Brezillon <boris.brezillon@bootlin.com>
> > > > >
> > > > > Thanks for the ack.
> > > > >
> > > > > > I'll let Miquel queue this patch to the nand/next branch, unless you
> > > > > > want it to be merged in 4.19, in which case I'll queue it to the
> > > > > > mtd/fixes branch.
> > > > >
> > > > > Note that there's a dependency on the first patch of the series which
> > > > > adds the new helper.
> > > >
> > > > I was not Cc-ed on this patch :P.
> > >
> > > Yeah, sorry about that. I made sure everyone was CCed on the
> > > cover letter, but guess I could have reused that list for the helper as
> > > well.
> > >
> > > > > Rob can pick up the entire series if the various
> > > > > maintainers agree, otherwise I'll try to get at the least the helper
> > > > > into -rc2.
> > > >
> > > > If everything goes in 4.19-rc2 through Rob's tree that's fine, but if
> > > > it's queued for 4.20 we might need an immutable tag just in case we
> > > > queue conflicting changes to the NAND tree.
> > >
> > > Ok, thanks.
> >
> > Hi Boris, can you pick this one up. It conflicts with "mtd: rawnand:
> > atmel: Fix potential NULL pointer dereference"
>
> Sure, I'll queue it for -rc2.
This one hasn't showed up in -next yet, so sending a reminder.
Johan
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 5/9] mtd: nand: atmel: fix OF child-node lookup
2018-11-15 14:26 ` Johan Hovold
@ 2018-11-18 10:45 ` Boris Brezillon
0 siblings, 0 replies; 20+ messages in thread
From: Boris Brezillon @ 2018-11-18 10:45 UTC (permalink / raw)
To: Johan Hovold
Cc: Rob Herring, Greg Kroah-Hartman, Frank Rowand, devicetree,
linux-kernel@vger.kernel.org, stable, Nicolas Ferre, Josh Wu
On Thu, 15 Nov 2018 15:26:48 +0100
Johan Hovold <johan@kernel.org> wrote:
> On Tue, Oct 23, 2018 at 08:51:17PM +0200, Boris Brezillon wrote:
> > On Tue, 23 Oct 2018 13:28:09 -0500
> > Rob Herring <robh+dt@kernel.org> wrote:
> >
> > > On Mon, Aug 27, 2018 at 4:44 AM Johan Hovold <johan@kernel.org> wrote:
> > > >
> > > > On Mon, Aug 27, 2018 at 10:48:42AM +0200, Boris Brezillon wrote:
> > > > > On Mon, 27 Aug 2018 10:44:14 +0200
> > > > > Johan Hovold <johan@kernel.org> wrote:
> > > > >
> > > > > > On Mon, Aug 27, 2018 at 10:28:20AM +0200, Boris Brezillon wrote:
> > > > > > > Hi Johan
> > > > > > >
> > > > > > > On Mon, 27 Aug 2018 10:21:49 +0200
> > > > > > > Johan Hovold <johan@kernel.org> wrote:
> > > > > > >
> > > > > > > > Use the new of_get_compatible_child() helper to lookup the nfc child
> > > > > > > > node instead of using of_find_compatible_node(), which searches the
> > > > > > > > entire tree from a given start node and thus can return an unrelated
> > > > > > > > (i.e. non-child) node.
> > > > > > > >
> > > > > > > > This also addresses a potential use-after-free (e.g. after probe
> > > > > > > > deferral) as the tree-wide helper drops a reference to its first
> > > > > > > > argument (i.e. the node of the device being probed).
> > > > > > > >
> > > > > > > > While at it, also fix a related nfc-node reference leak.
> > > > > > > >
> > > > > > > > Fixes: f88fc122cc34 ("mtd: nand: Cleanup/rework the atmel_nand driver")
> > > > > > > > Cc: stable <stable@vger.kernel.org> # 4.11
> > > > > > > > Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
> > > > > > > > Cc: Josh Wu <rainyfeeling@outlook.com>
> > > > > > > > Cc: Boris Brezillon <boris.brezillon@bootlin.com>
> > > > > > > > Signed-off-by: Johan Hovold <johan@kernel.org>
> > > > > > >
> > > > > > > Acked-by: Boris Brezillon <boris.brezillon@bootlin.com>
> > > > > >
> > > > > > Thanks for the ack.
> > > > > >
> > > > > > > I'll let Miquel queue this patch to the nand/next branch, unless you
> > > > > > > want it to be merged in 4.19, in which case I'll queue it to the
> > > > > > > mtd/fixes branch.
> > > > > >
> > > > > > Note that there's a dependency on the first patch of the series which
> > > > > > adds the new helper.
> > > > >
> > > > > I was not Cc-ed on this patch :P.
> > > >
> > > > Yeah, sorry about that. I made sure everyone was CCed on the
> > > > cover letter, but guess I could have reused that list for the helper as
> > > > well.
> > > >
> > > > > > Rob can pick up the entire series if the various
> > > > > > maintainers agree, otherwise I'll try to get at the least the helper
> > > > > > into -rc2.
> > > > >
> > > > > If everything goes in 4.19-rc2 through Rob's tree that's fine, but if
> > > > > it's queued for 4.20 we might need an immutable tag just in case we
> > > > > queue conflicting changes to the NAND tree.
> > > >
> > > > Ok, thanks.
> > >
> > > Hi Boris, can you pick this one up. It conflicts with "mtd: rawnand:
> > > atmel: Fix potential NULL pointer dereference"
> >
> > Sure, I'll queue it for -rc2.
>
> This one hasn't showed up in -next yet, so sending a reminder.
Applied (thanks for the reminder, I had forgotten :-)). It should show
up in -rc4.
Thanks,
Boris
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2018-11-18 21:05 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20180827082153.22537-1-johan@kernel.org>
2018-08-27 8:21 ` [PATCH v2 2/9] drm/mediatek: fix OF sibling-node lookup Johan Hovold
2018-08-27 8:21 ` [PATCH v2 3/9] drm/msm: fix OF child-node lookup Johan Hovold
2018-08-27 8:21 ` [PATCH v2 4/9] mmc: meson-mx-sdio: " Johan Hovold
2018-08-27 14:44 ` Ulf Hansson
2018-09-04 12:54 ` Johan Hovold
2018-09-05 6:30 ` Ulf Hansson
2018-08-27 8:21 ` [PATCH v2 5/9] mtd: nand: atmel: " Johan Hovold
2018-08-27 8:28 ` Boris Brezillon
2018-08-27 8:44 ` Johan Hovold
2018-08-27 8:48 ` Boris Brezillon
2018-08-27 9:44 ` Johan Hovold
2018-10-23 18:28 ` Rob Herring
2018-10-23 18:51 ` Boris Brezillon
2018-11-15 14:26 ` Johan Hovold
2018-11-18 10:45 ` Boris Brezillon
2018-08-27 8:21 ` [PATCH v2 6/9] net: bcmgenet: " Johan Hovold
2018-08-31 0:47 ` Florian Fainelli
2018-09-04 12:56 ` Johan Hovold
2018-08-27 8:21 ` [PATCH v2 8/9] NFC: nfcmrvl_uart: " Johan Hovold
2018-08-27 8:21 ` [PATCH v2 9/9] power: supply: twl4030-charger: fix OF sibling-node lookup Johan Hovold
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).