From: Greg Kroah-Hartman <gregkh@linuxfoundation•org>
To: linux-kernel@vger•kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation•org>,
stable@vger•kernel.org, Wen Yang <wen.yang99@zte•com.cn>,
Wingman Kwok <w-kwok2@ti•com>,
Murali Karicheri <m-karicheri2@ti•com>,
"David S. Miller" <davem@davemloft•net>,
netdev@vger•kernel.org,
"Sasha Levin (Microsoft)" <sashal@kernel•org>
Subject: [PATCH 4.14 35/49] net: ethernet: ti: fix possible object reference leak
Date: Thu, 2 May 2019 17:21:12 +0200 [thread overview]
Message-ID: <20190502143328.292206371@linuxfoundation.org> (raw)
In-Reply-To: <20190502143323.397051088@linuxfoundation.org>
[ Upstream commit 75eac7b5f68b0a0671e795ac636457ee27cc11d8 ]
The call to of_get_child_by_name 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/ti/netcp_ethss.c:3661:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 3654, but without a corresponding object release within this function.
./drivers/net/ethernet/ti/netcp_ethss.c:3665:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 3654, but without a corresponding object release within this function.
Signed-off-by: Wen Yang <wen.yang99@zte•com.cn>
Cc: Wingman Kwok <w-kwok2@ti•com>
Cc: Murali Karicheri <m-karicheri2@ti•com>
Cc: "David S. Miller" <davem@davemloft•net>
Cc: netdev@vger•kernel.org
Cc: linux-kernel@vger•kernel.org
Signed-off-by: David S. Miller <davem@davemloft•net>
Signed-off-by: Sasha Levin (Microsoft) <sashal@kernel•org>
---
drivers/net/ethernet/ti/netcp_ethss.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/ti/netcp_ethss.c b/drivers/net/ethernet/ti/netcp_ethss.c
index 28cb38af1a34..ff7a71ca0b13 100644
--- a/drivers/net/ethernet/ti/netcp_ethss.c
+++ b/drivers/net/ethernet/ti/netcp_ethss.c
@@ -3538,12 +3538,16 @@ static int gbe_probe(struct netcp_device *netcp_device, struct device *dev,
ret = netcp_txpipe_init(&gbe_dev->tx_pipe, netcp_device,
gbe_dev->dma_chan_name, gbe_dev->tx_queue_id);
- if (ret)
+ if (ret) {
+ of_node_put(interfaces);
return ret;
+ }
ret = netcp_txpipe_open(&gbe_dev->tx_pipe);
- if (ret)
+ if (ret) {
+ of_node_put(interfaces);
return ret;
+ }
/* Create network interfaces */
INIT_LIST_HEAD(&gbe_dev->gbe_intf_head);
--
2.19.1
prev parent reply other threads:[~2019-05-02 15:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20190502143323.397051088@linuxfoundation.org>
2019-05-02 15:21 ` [PATCH 4.14 33/49] net: xilinx: fix possible object reference leak Greg Kroah-Hartman
2019-05-02 15:21 ` [PATCH 4.14 34/49] net: ibm: " Greg Kroah-Hartman
2019-05-02 15:21 ` Greg Kroah-Hartman [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190502143328.292206371@linuxfoundation.org \
--to=gregkh@linuxfoundation$(echo .)org \
--cc=davem@davemloft$(echo .)net \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=m-karicheri2@ti$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=sashal@kernel$(echo .)org \
--cc=stable@vger$(echo .)kernel.org \
--cc=w-kwok2@ti$(echo .)com \
--cc=wen.yang99@zte$(echo .)com.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox