From 0884dffa8fa5d366526769710c15048ac07c4e10 Mon Sep 17 00:00:00 2001 From: Denis Kirjanov Date: Feb 06 2024 14:37:13 +0000 Subject: net: xilinx: fix possible object reference leak (git-fixed). --- diff --git a/patches.suse/net-xilinx-fix-possible-object-reference-leak.patch b/patches.suse/net-xilinx-fix-possible-object-reference-leak.patch new file mode 100644 index 0000000..e645aa7 --- /dev/null +++ b/patches.suse/net-xilinx-fix-possible-object-reference-leak.patch @@ -0,0 +1,51 @@ +From eeca73c01b1d0dfcc2941e71fb4db305aeae9304 Mon Sep 17 00:00:00 2001 +From: Wen Yang +Date: Fri, 22 Mar 2019 11:04:07 +0800 +Subject: [PATCH 2/2] net: xilinx: fix possible object reference leak +Patch-mainline: v5.1-rc3 +Git-commit: fa3a419d2f674b431d38748cb58fb7da17ee8949 +References: git-fixed + +The call to of_parse_phandle returns a node pointer with refcount +incremented thus it must be explicitly decremented after the last +usage. + +Detected by coccinelle with the following warnings: +./drivers/net/ethernet/xilinx/xilinx_axienet_main.c:1624:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 1569, but without a corresponding object release within this function. + +Signed-off-by: Wen Yang +Cc: Anirudha Sarangi +Cc: John Linn +Cc: "David S. Miller" +Cc: Michal Simek +Cc: netdev@vger.kernel.org +Cc: linux-arm-kernel@lists.infradead.org +Cc: linux-kernel@vger.kernel.org +Signed-off-by: David S. Miller +Signed-off-by: Denis Kirjanov +--- + drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +index 08658615971b..f36222aedbfa 100644 +--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c ++++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +@@ -1566,12 +1566,14 @@ static int axienet_probe(struct platform_device *pdev) + ret = of_address_to_resource(np, 0, &dmares); + if (ret) { + dev_err(&pdev->dev, "unable to get DMA resource\n"); ++ of_node_put(np); + goto free_netdev; + } + lp->dma_regs = devm_ioremap_resource(&pdev->dev, &dmares); + if (IS_ERR(lp->dma_regs)) { + dev_err(&pdev->dev, "could not map DMA regs\n"); + ret = PTR_ERR(lp->dma_regs); ++ of_node_put(np); + goto free_netdev; + } + lp->rx_irq = irq_of_parse_and_map(np, 1); +-- +2.16.4 + diff --git a/series.conf b/series.conf index 5f68453..5aaae88 100644 --- a/series.conf +++ b/series.conf @@ -48740,6 +48740,7 @@ patches.suse/net-sched-don-t-dereference-a-goto_chain-to-read-the.patch patches.suse/rhashtable-Still-do-rehash-when-we-get-EEXIST.patch patches.suse/net-hns3-fix-for-not-calculating-tx-bd-num-correctly.patch + patches.suse/net-xilinx-fix-possible-object-reference-leak.patch patches.suse/net-ibm-fix-possible-object-reference-leak.patch patches.suse/net-ethernet-ti-fix-possible-object-reference-leak.patch patches.suse/tipc-tipc-clang-warning.patch